[New-bugs-announce] [issue32025] Add time.thread_time()

Antoine Pitrou report at bugs.python.org
Tue Nov 14 08:50:20 EST 2017


New submission from Antoine Pitrou <pitrou at free.fr>:

Currently, the time module has time.process_time(), a cross-platform function for getting per-process elapsed CPU time.

Similarly, we could expose time.thread_time(), to get per-thread elapsed CPU time.
On a modern POSIX platform, it can use clock_gettime(CLOCK_THREAD_CPUTIME_ID).
On Windows, it can use GetThreadTimes(): https://msdn.microsoft.com/en-us/library/ms683237%28VS.85%29.aspx
On other platforms, it can simply raise NotImplementedError.

Currently, you would need ctypes hacks to call GetThreadTimes(), which is not very nice.

----------
components: Library (Lib)
messages: 306210
nosy: belopolsky, haypo, pitrou
priority: normal
severity: normal
status: open
title: Add time.thread_time()
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32025>
_______________________________________


More information about the New-bugs-announce mailing list