summaryrefslogtreecommitdiffstats
path: root/Doc/library/time.rst
diff options
context:
space:
mode:
authorAntoine Pitrou <pitrou@free.fr>2017-11-15 21:52:21 (GMT)
committerGitHub <noreply@github.com>2017-11-15 21:52:21 (GMT)
commit4bd41c9b52ea0c730e9e294caaf003e54c088c6e (patch)
tree9bb2c82cd67af88b9a3990ef081dd4b2c2f668c8 /Doc/library/time.rst
parent762b9571c9c8c6b036f1bf90140a1d030b3f9a01 (diff)
downloadcpython-4bd41c9b52ea0c730e9e294caaf003e54c088c6e.zip
cpython-4bd41c9b52ea0c730e9e294caaf003e54c088c6e.tar.gz
cpython-4bd41c9b52ea0c730e9e294caaf003e54c088c6e.tar.bz2
bpo-32025: Add time.thread_time() (#4410)
* bpo-32025: Add time.thread_time() * Add missing #endif * Add NEWS blurb * Add docs and whatsnew * Address review comments * Review comments
Diffstat (limited to 'Doc/library/time.rst')
-rw-r--r--Doc/library/time.rst27
1 files changed, 27 insertions, 0 deletions
diff --git a/Doc/library/time.rst b/Doc/library/time.rst
index 4ffb4d2..ccbb3f3 100644
--- a/Doc/library/time.rst
+++ b/Doc/library/time.rst
@@ -241,6 +241,7 @@ Functions
* ``'monotonic'``: :func:`time.monotonic`
* ``'perf_counter'``: :func:`time.perf_counter`
* ``'process_time'``: :func:`time.process_time`
+ * ``'thread_time'``: :func:`time.thread_time`
* ``'time'``: :func:`time.time`
The result has the following attributes:
@@ -603,6 +604,32 @@ Functions
of the calendar date may be accessed as attributes.
+.. function:: thread_time() -> float
+
+ .. index::
+ single: CPU time
+ single: processor time
+ single: benchmarking
+
+ Return the value (in fractional seconds) of the sum of the system and user
+ CPU time of the current thread. It does not include time elapsed during
+ sleep. It is thread-specific by definition. The reference point of the
+ returned value is undefined, so that only the difference between the results
+ of consecutive calls in the same thread is valid.
+
+ Availability: Windows, Linux, Unix systems supporting
+ ``CLOCK_THREAD_CPUTIME_ID``.
+
+ .. versionadded:: 3.7
+
+
+.. function:: thread_time_ns() -> int
+
+ Similar to :func:`thread_time` but return time as nanoseconds.
+
+ .. versionadded:: 3.7
+
+
.. function:: time_ns() -> int
Similar to :func:`time` but returns time as an integer number of nanoseconds