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
Comments
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. |
The test is too strict, it fails on many buildbots. Four examples: ====================================================================== 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 ====================================================================== 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 ====================================================================== 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 ====================================================================== 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 |
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? |
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. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: