Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove PyThreadState.tick_counter field #63398

Closed
vstinner opened this issue Oct 8, 2013 · 8 comments
Closed

Remove PyThreadState.tick_counter field #63398

vstinner opened this issue Oct 8, 2013 · 8 comments

Comments

@vstinner
Copy link
Member

vstinner commented Oct 8, 2013

BPO 19199
Nosy @tim-one, @arigo, @jcea, @pitrou, @vstinner, @nedbat, @bitdancer, @serhiy-storchaka
Files
  • remove_tick_counter.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2013-10-09.12:53:18.286>
    created_at = <Date 2013-10-08.21:18:41.108>
    labels = []
    title = 'Remove PyThreadState.tick_counter field'
    updated_at = <Date 2013-10-09.23:11:22.534>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2013-10-09.23:11:22.534>
    actor = 'jcea'
    assignee = 'none'
    closed = True
    closed_date = <Date 2013-10-09.12:53:18.286>
    closer = 'python-dev'
    components = []
    creation = <Date 2013-10-08.21:18:41.108>
    creator = 'vstinner'
    dependencies = []
    files = ['32007']
    hgrepos = []
    issue_num = 19199
    keywords = ['patch']
    message_count = 8.0
    messages = ['199256', '199257', '199259', '199261', '199262', '199263', '199279', '199293']
    nosy_count = 9.0
    nosy_names = ['tim.peters', 'arigo', 'jcea', 'pitrou', 'vstinner', 'nedbat', 'r.david.murray', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue19199'
    versions = ['Python 3.4']

    @vstinner
    Copy link
    Member Author

    vstinner commented Oct 8, 2013

    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?

    @pitrou
    Copy link
    Member

    pitrou commented Oct 8, 2013

    Yes, we can :)

    @vstinner
    Copy link
    Member Author

    vstinner commented Oct 8, 2013

    Here is a patch.

    I'm going to commit it in one week if nobody complains.

    @bitdancer
    Copy link
    Member

    Should there be a mention in whats new in case any external tools are (still) looking at it and thinking it is meaningful?

    @vstinner
    Copy link
    Member Author

    vstinner commented Oct 8, 2013

    PyThreadState.tick_counter field was added in 2002 by Armin Rigo: see issue bpo-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?

    @pitrou
    Copy link
    Member

    pitrou commented Oct 8, 2013

    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.

    @arigo
    Copy link
    Mannequin

    arigo mannequin commented Oct 9, 2013

    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 :-)

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 9, 2013

    New changeset 3ce0102e4c1f by Victor Stinner in branch 'default':
    Close bpo-19199: Remove PyThreadState.tick_counter field
    http://hg.python.org/cpython/rev/3ce0102e4c1f

    @python-dev python-dev mannequin closed this as completed Oct 9, 2013
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants