Issue 19199: Remove PyThreadState.tick_counter field (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/63398

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:51 admin set github: 63398
2013-10-09 23:11:22 jcea set nosy: + jcea
2013-10-09 12:53:18 python-dev set status: open -> closednosy: + python-devmessages: + resolution: fixedstage: resolved
2013-10-09 09:43:36 arigo set messages: +
2013-10-08 22:02:49 tim.peters set nosy: + tim.peters
2013-10-08 22:02:31 tim.peters set nosy: + arigo
2013-10-08 21:51:03 pitrou set messages: +
2013-10-08 21:47:03 vstinner set messages: +
2013-10-08 21:38:04 r.david.murray set nosy: + r.david.murray, nedbatmessages: +
2013-10-08 21:26:54 vstinner set files: + remove_tick_counter.patchkeywords: + patchmessages: +
2013-10-08 21:19:19 pitrou set messages: +
2013-10-08 21🔞41 vstinner create