summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-10-17 21:46:45 (GMT)
committerGitHub <noreply@github.com>2017-10-17 21:46:45 (GMT)
commit884d13a55fc328e2e1e3948a82b361b30804b818 (patch)
tree8b68f04b9261c26d4f2f5ed7a7beaa1d31c236c0 /Doc
parentde86073a761cd3539aaca6f886a1f55effc0d9da (diff)
downloadcpython-884d13a55fc328e2e1e3948a82b361b30804b818.zip
cpython-884d13a55fc328e2e1e3948a82b361b30804b818.tar.gz
cpython-884d13a55fc328e2e1e3948a82b361b30804b818.tar.bz2
time.clock() now emits a DeprecationWarning (GH-4020)
bpo-31803: time.clock() and time.get_clock_info('clock') now emit a DeprecationWarning warning. Replace time.clock() with time.perf_counter() in tests and demos. Remove also hasattr(time, 'monotonic') in test_time since time.monotonic() is now always available since Python 3.5.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/profile.rst2
-rw-r--r--Doc/library/time.rst8
2 files changed, 9 insertions, 1 deletions
diff --git a/Doc/library/profile.rst b/Doc/library/profile.rst
index 5796e3a..68f24ab 100644
--- a/Doc/library/profile.rst
+++ b/Doc/library/profile.rst
@@ -575,7 +575,7 @@ procedure can be used to obtain a better constant for a given platform (see
The method executes the number of Python calls given by the argument, directly
and again under the profiler, measuring the time for both. It then computes the
hidden overhead per profiler event, and returns that as a float. For example,
-on a 1.8Ghz Intel Core i5 running Mac OS X, and using Python's time.clock() as
+on a 1.8Ghz Intel Core i5 running Mac OS X, and using Python's time.process_time() as
the timer, the magical number is about 4.04e-6.
The object of this exercise is to get a fairly consistent result. If your
diff --git a/Doc/library/time.rst b/Doc/library/time.rst
index 25a4ab5..c5d1e83 100644
--- a/Doc/library/time.rst
+++ b/Doc/library/time.rst
@@ -289,6 +289,9 @@ Functions
.. function:: perf_counter()
+ .. index::
+ single: benchmarking
+
Return the value (in fractional seconds) of a performance counter, i.e. a
clock with the highest available resolution to measure a short duration. It
does include time elapsed during sleep and is system-wide. The reference
@@ -300,6 +303,11 @@ Functions
.. function:: process_time()
+ .. 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 process. It does not include time elapsed during
sleep. It is process-wide by definition. The reference point of the