The C structure "PyThreadState" has a counter which is incremented in the bytecode evaluation loop (ceval.c), but never used. /* XXX doesn't mean anything anymore (the comment below is obsolete) => deprecate or remove? */ /* tick_counter is incremented whenever the check_interval ticker * reaches zero. The purpose is to give a useful measure of the number * of interpreted bytecode instructions in a given thread. This * extremely lightweight statistic collector may be of interest to * profilers (like psyco.jit()), although nothing in the core uses it. */ int tick_counter; Antoine Pitrou added the XXX comment when he merged the "new GIL" of Python 3.2. Can we now remove it?
PyThreadState.tick_counter field was added in 2002 by Armin Rigo: see issue #617311. "A very very small statistic-collecting patch. (...) The purpose is to give a useful measure of the number of interpreted bytecode instructions in a given thread." My patch will probably break the following module :-) http://packages.ubuntu.com/fr/lucid/python-tickcount "Python C extension module giving access to the internal tickcounter of python. This is useful for certain forms of profiling or performance analysis." (But tickcounter was meanless since Python 3.2.) The PyThreadState.tick_counter field was mentionned in the following question: "Read how many Python instructions have been interpreted?" http://stackoverflow.com/questions/16437487/read-how-many-python-instructions-have-been-interpreted Should we add a new counter to count the number of executed Python instructions per thread? Or fix tick_counter? Does we really need such counter or other profilers (cProfile) are enough?
> Should we add a new counter to count the number of executed Python > instructions per thread? Or fix tick_counter? Let's just drop it. It's useless and nobody complained.
Better remove this field if its value is now useless anyway. If someone needs it again for a similar reason, he can contribute a patch like I did in 2002 :-)