Comment

Peter

Isn't timeit just for strings of code?
In my setup I was able to "listen in" on a running program.

Parent comment

Andrew

Instead of writing your own timing stuff, why not use the timeit module in the standard library?