[Python-checkins] peps: PEP 418: Minor updates
victor.stinner
python-checkins at python.org
Thu Apr 19 02:48:10 CEST 2012
http://hg.python.org/peps/rev/02b5d0d2ba55
changeset: 4273:02b5d0d2ba55
user: Victor Stinner <victor.stinner at gmail.com>
date: Thu Apr 19 02:47:52 2012 +0200
summary:
PEP 418: Minor updates
files:
pep-0418.txt | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/pep-0418.txt b/pep-0418.txt
--- a/pep-0418.txt
+++ b/pep-0418.txt
@@ -38,8 +38,8 @@
To measure CPU time, Python does not provide directly a portable
function. ``time.clock()`` can be used on Unix, but it has a bad
-precision. ``resource.getrusage()`` can also be used on Unix, but it
-requires to get fields of a structure and compute the sum of time
+precision. ``resource.getrusage()`` or ``os.times()`` can also be
+used on Unix, but they requires to compute the sum of time
spent in kernel space and user space. The new ``time.process_time()``
function acts as a portable counter that always measures CPU time
(doesn't include time elapsed during sleep) and has the best available
@@ -127,14 +127,14 @@
Windows and on other operating systems, ``time.monotonic()`` is
system-wide.
-Availability: Windows, Mac OS X, Unix, Solaris. Not available on
-GNU/Hurd.
+Availability: Windows, Mac OS X, Linux, FreeBSD, OpenBSD, Solaris.
+Not available on GNU/Hurd.
Pseudo-code [#pseudo]_::
if os.name == 'nt':
# GetTickCount64() requires Windows Vista, Server 2008 or later
- if hasattr(_time, '_GetTickCount64'):
+ if hasattr(_time, 'GetTickCount64'):
def monotonic():
return _time.GetTickCount64() * 1e-3
else:
@@ -174,7 +174,7 @@
^^^^^^^^^^^^^^^^^^^
Performance counter with the highest available precision to measure a
-duration. It does include time elapsed during sleep and is
+short duration. It does include time elapsed during sleep and is
system-wide. The reference point of the returned value is undefined,
so that only the difference between the results of consecutive calls
is valid and is a number of seconds.
@@ -225,8 +225,8 @@
if os.name == 'nt':
def process_time():
- handle = win32process.GetCurrentProcess()
- process_times = win32process.GetProcessTimes(handle)
+ handle = _time.GetCurrentProcess()
+ process_times = _time.GetProcessTimes(handle)
return (process_times['UserTime'] + process_times['KernelTime']) * 1e-7
else:
try:
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list