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

better timer resolution for profile.py #37556

Closed
jmg mannequin opened this issue Nov 30, 2002 · 4 comments
Closed

better timer resolution for profile.py #37556

jmg mannequin opened this issue Nov 30, 2002 · 4 comments
Labels
stdlib Python modules in the Lib dir

Comments

@jmg
Copy link
Mannequin

jmg mannequin commented Nov 30, 2002

BPO 645894
Nosy @loewis, @brettcannon, @birkenfeld
Files
  • profile.py.patch: add resource.getrusage timer
  • 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 2005-03-03.11:40:42.000>
    created_at = <Date 2002-11-30.00:17:55.000>
    labels = ['library']
    title = 'better timer resolution for profile.py'
    updated_at = <Date 2005-03-03.11:40:42.000>
    user = 'https://bugs.python.org/jmg'

    bugs.python.org fields:

    activity = <Date 2005-03-03.11:40:42.000>
    actor = 'loewis'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2002-11-30.00:17:55.000>
    creator = 'jmg'
    dependencies = []
    files = ['4757']
    hgrepos = []
    issue_num = 645894
    keywords = ['patch']
    message_count = 4.0
    messages = ['41859', '41860', '41861', '41862']
    nosy_count = 4.0
    nosy_names = ['loewis', 'brett.cannon', 'georg.brandl', 'jmg']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue645894'
    versions = []

    @jmg
    Copy link
    Mannequin Author

    jmg mannequin commented Nov 30, 2002

    On some platforms time.clock() does not return a high
    resolution counter. On FreeBSD, it's resolution is
    only 1/128th of a second. In order to get microsecond
    accuracy, the getrusage syscall from resource needs to
    be used.

    Attached is a patch that uses getrusage from the
    resource library in preference of os.clock.

    This was done on behalf of Vernier Networks, Inc.

    @jmg jmg mannequin closed this as completed Nov 30, 2002
    @jmg jmg mannequin added the stdlib Python modules in the Lib dir label Nov 30, 2002
    @jmg jmg mannequin closed this as completed Nov 30, 2002
    @jmg jmg mannequin added the stdlib Python modules in the Lib dir label Nov 30, 2002
    @brettcannon
    Copy link
    Member

    Logged In: YES
    user_id=357491

    Is there any possibility that using this could lead to worse timing
    under another OS?

    And I assume this is still an issue under FreeBSD 5.

    @birkenfeld
    Copy link
    Member

    Logged In: YES
    user_id=1188172

    If this leads to better resolution on FreeBSD, it seems like
    a good idea. However, if you don't know about other OS, what
    about restricting the patch to FreeBSD?

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Mar 3, 2005

    Logged In: YES
    user_id=21627

    I believe getrusage is always the better choice, as clock()
    wraps around after 36 minutes on a POSIX system. Committed as

    profile.py 1.62
    NEWS 1.1258

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants