I have a method. Remove your headphones and listen to your teammates. I've always used the "fucks per-hour" as a measurement of productivity.
For the uninitiated, the more fucks, the more productivity.. ie, they are looking at the code and trying to do something.
True story-- at my first job the fucks were so bad they moved some of us into our own offices.