Two different solutions; RescueTime is good at analysing how your time is spent after the fact. A chess clock is a great real time stopwatch
"oh man i've been googling rhubarb crumble recipes for 14 minutes..."
If you're on Mac then Qbserve[1] (our app) will show feedback on your productivity in real time.