This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Remove PyThreadState.tick_counter field
Type: Stage: resolved
Components: Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: arigo, jcea, nedbat, pitrou, python-dev, r.david.murray, serhiy.storchaka, tim.peters, vstinner
Priority: normal Keywords: patch

Created on 2013-10-08 21:18 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
remove_tick_counter.patch vstinner, 2013-10-08 21:26 review
Messages (8)
msg199256 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-10-08 21:18
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?
msg199257 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-08 21:19
Yes, we can :)
msg199259 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-10-08 21:26
Here is a patch.

I'm going to commit it in one week if nobody complains.
msg199261 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-10-08 21:38
Should there be a mention in whats new in case any external tools are (still) looking at it and thinking it is meaningful?
msg199262 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-10-08 21:47
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?
msg199263 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-10-08 21:51
> 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.
msg199279 - (view) Author: Armin Rigo (arigo) * (Python committer) Date: 2013-10-09 09:43
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 :-)
msg199293 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-09 12:53
New changeset 3ce0102e4c1f by Victor Stinner in branch 'default':
Close #19199: Remove ``PyThreadState.tick_counter`` field
http://hg.python.org/cpython/rev/3ce0102e4c1f
History
Date User Action Args
2022-04-11 14:57:51adminsetgithub: 63398
2013-10-09 23:11:22jceasetnosy: + jcea
2013-10-09 12:53:18python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg199293

resolution: fixed
stage: resolved
2013-10-09 09:43:36arigosetmessages: + msg199279
2013-10-08 22:02:49tim.peterssetnosy: + tim.peters
2013-10-08 22:02:31tim.peterssetnosy: + arigo
2013-10-08 21:51:03pitrousetmessages: + msg199263
2013-10-08 21:47:03vstinnersetmessages: + msg199262
2013-10-08 21:38:04r.david.murraysetnosy: + r.david.murray, nedbat
messages: + msg199261
2013-10-08 21:26:54vstinnersetfiles: + remove_tick_counter.patch
keywords: + patch
messages: + msg199259
2013-10-08 21:19:19pitrousetmessages: + msg199257
2013-10-08 21:18:41vstinnercreate