bpo-33717: pythoninfo logs information of all clocks (GH-11460)
test.pythoninfo now logs information of all clocks, not only time.time() and time.perf_counter().
This commit is contained in:
parent
df8e1fb4e3
commit
ddd7c422fd
@ -6,6 +6,7 @@ import errno
|
|||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
def normalize_text(text):
|
def normalize_text(text):
|
||||||
@ -380,9 +381,17 @@ def collect_time(info_add):
|
|||||||
copy_attributes(info_add, time, 'time.%s', attributes)
|
copy_attributes(info_add, time, 'time.%s', attributes)
|
||||||
|
|
||||||
if hasattr(time, 'get_clock_info'):
|
if hasattr(time, 'get_clock_info'):
|
||||||
for clock in ('time', 'perf_counter'):
|
for clock in ('clock', 'monotonic', 'perf_counter',
|
||||||
tinfo = time.get_clock_info(clock)
|
'process_time', 'thread_time', 'time'):
|
||||||
info_add('time.get_clock_info(%s)' % clock, tinfo)
|
try:
|
||||||
|
# prevent DeprecatingWarning on get_clock_info('clock')
|
||||||
|
with warnings.catch_warnings(record=True):
|
||||||
|
clock_info = time.get_clock_info(clock)
|
||||||
|
except ValueError:
|
||||||
|
# missing clock like time.thread_time()
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
info_add('time.get_clock_info(%s)' % clock, clock_info)
|
||||||
|
|
||||||
|
|
||||||
def collect_datetime(info_add):
|
def collect_datetime(info_add):
|
||||||
|
@ -0,0 +1,2 @@
|
|||||||
|
test.pythoninfo now logs information of all clocks, not only time.time() and
|
||||||
|
time.perf_counter().
|
Loading…
x
Reference in New Issue
Block a user