[Python-Dev] tick_counter? (original) (raw)

Tim Peters tim.one at comcast.net
Sun Mar 28 21:41:18 EST 2004


[Tim]

Anyone know what the purpose of PyThreadState.tickcounter might be? AFAICT, it's initialized to 0, incremented by the eval loop now & again, and otherwise never referenced.

[Hye-Shik Chang]

According to SF #617311 written by Armin:

tstate->tickcounter is incremented whenever the checkinterval 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 can be of interest to profilers (like psyco.jit()). ...

Thanks! That rings a vague bell, and I checked in a code comment so this doesn't continue to look like a mistake.

I know the Python source has a habit of not commenting the purpose of struct members, but that's not something to emulate, and comments about something this obscure definitely belong in the code instead of the checkin comment.



More information about the Python-Dev mailing list