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

expose pthread_getcpuclockid in time module #75777

Closed
pdox mannequin opened this issue Sep 26, 2017 · 6 comments
Closed

expose pthread_getcpuclockid in time module #75777

pdox mannequin opened this issue Sep 26, 2017 · 6 comments
Labels
3.7 (EOL) end of life extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@pdox
Copy link
Mannequin

pdox mannequin commented Sep 26, 2017

BPO 31596
Nosy @vstinner, @benjaminp, @pdox
PRs
  • bpo-31596: Add an interface for pthread_getcpuclockid(3) #3756
  • weaken pthread_getcpuclockid test (more bpo-31596) #3904
  • 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 2017-10-05.07:01:58.393>
    created_at = <Date 2017-09-26.18:33:14.144>
    labels = ['extension-modules', 'type-feature', '3.7']
    title = 'expose pthread_getcpuclockid in time module'
    updated_at = <Date 2017-10-06.09:03:39.636>
    user = 'https://github.com/pdox'

    bugs.python.org fields:

    activity = <Date 2017-10-06.09:03:39.636>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-10-05.07:01:58.393>
    closer = 'benjamin.peterson'
    components = ['Extension Modules']
    creation = <Date 2017-09-26.18:33:14.144>
    creator = 'pdox'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31596
    keywords = []
    message_count = 6.0
    messages = ['303059', '303743', '303769', '303781', '303800', '303809']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'benjamin.peterson', 'pdox']
    pr_nums = ['3756', '3904']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue31596'
    versions = ['Python 3.7']

    @pdox
    Copy link
    Mannequin Author

    pdox mannequin commented Sep 26, 2017

    time.clock_gettime() makes it possible to retrieve the thread-specific cpu-time clock for the current thread using time.CLOCK_THREAD_CPUTIME_ID. However, it is currently not possible in Python to retrieve the thread-specific clock for other threads. Exposing pthread_getcpuclockid() makes this possible.

    @pdox pdox mannequin added 3.7 (EOL) end of life extension-modules C modules in the Modules dir type-feature A feature request or enhancement labels Sep 26, 2017
    @benjaminp
    Copy link
    Contributor

    New changeset e14679c by Benjamin Peterson (pdox) in branch 'master':
    closes bpo-31596: Add an interface for pthread_getcpuclockid(3) (bpo-3756)
    e14679c

    @vstinner
    Copy link
    Member

    vstinner commented Oct 5, 2017

    The test is too strict, it fails on many buildbots.

    Four examples:

    http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.x%20Shared%203.x/builds/1008/steps/test/logs/stdio

    ======================================================================
    FAIL: test_pthread_getcpuclockid (test.test_time.TimeTestCase)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/usr/home/buildbot/python/3.x.koobs-freebsd10/build/Lib/test/test_time.py", line 100, in test_pthread_getcpuclockid
        self.assertLessEqual(t2, t3)
    AssertionError: 16.309616 not less than or equal to 16.309358

    http://buildbot.python.org/all/builders/s390x%20Debian%203.x/builds/1466/steps/test/logs/stdio

    ======================================================================
    FAIL: test_pthread_getcpuclockid (test.test_time.TimeTestCase)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/dje/cpython-buildarea/3.x.edelsohn-debian-z/build/Lib/test/test_time.py", line 99, in test_pthread_getcpuclockid
        self.assertLessEqual(t1, t2)
    AssertionError: 0.938456056 not less than or equal to 0.8324859600000001

    http://buildbot.python.org/all/builders/AMD64%20FreeBSD%20CURRENT%20Non-Debug%203.x/builds/999/steps/test/logs/stdio

    ======================================================================
    FAIL: test_pthread_getcpuclockid (test.test_time.TimeTestCase)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/usr/home/buildbot/python/3.x.koobs-freebsd-current.nondebug/build/Lib/test/test_time.py", line 100, in test_pthread_getcpuclockid
        self.assertLessEqual(t2, t3)
    AssertionError: 0.813547 not less than or equal to 0.81335

    http://buildbot.python.org/all/builders/AMD64%20FreeBSD%20CURRENT%20Debug%203.x/builds/996/steps/test/logs/stdio

    ======================================================================
    FAIL: test_pthread_getcpuclockid (test.test_time.TimeTestCase)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/usr/home/buildbot/python/3.x.koobs-freebsd-current/build/Lib/test/test_time.py", line 100, in test_pthread_getcpuclockid
        self.assertLessEqual(t2, t3)
    AssertionError: 1.121773 not less than or equal to 1.121547

    @pdox
    Copy link
    Mannequin Author

    pdox mannequin commented Oct 5, 2017

    This looks specific to FreeBSD and s390x. Those platforms might not provide the same cpu-time clock consistency guarantees as Linux+glibc+x86. Would it be ok to just disable the ordering check for those systems?

    @benjaminp
    Copy link
    Contributor

    New changeset 8656670 by Benjamin Peterson in branch 'master':
    weaken pthread_getcpuclockid test (more bpo-31596) (bpo-3904)
    8656670

    @vstinner
    Copy link
    Member

    vstinner commented Oct 6, 2017

    Thank you Benjamin, buildots are back to green :-)

    I prefer the new unit test which only tests pthread_getcpuclockid() clock and not make any assumption on the link between this clock and CLOCK_THREAD_CPUTIME_ID.

    @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
    3.7 (EOL) end of life extension-modules C modules in the Modules dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants