MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _Utils

Class _Utils

tools/python-3.11.9-amd64/Lib/profile.py:42–73  ·  view source on GitHub ↗

Support class for utility functions which are shared by profile.py and cProfile.py modules. Not supposed to be used directly.

Source from the content-addressed store, hash-verified

40#itimes = integer_timer # replace with C coded timer returning integers
41
42class _Utils:
43 """Support class for utility functions which are shared by
44 profile.py and cProfile.py modules.
45 Not supposed to be used directly.
46 """
47
48 def __init__(self, profiler):
49 self.profiler = profiler
50
51 def run(self, statement, filename, sort):
52 prof = self.profiler()
53 try:
54 prof.run(statement)
55 except SystemExit:
56 pass
57 finally:
58 self._show(prof, filename, sort)
59
60 def runctx(self, statement, globals, locals, filename, sort):
61 prof = self.profiler()
62 try:
63 prof.runctx(statement, globals, locals)
64 except SystemExit:
65 pass
66 finally:
67 self._show(prof, filename, sort)
68
69 def _show(self, prof, filename, sort):
70 if filename is not None:
71 prof.dump_stats(filename)
72 else:
73 prof.print_stats(sort)
74
75
76#**************************************************************************

Callers 2

runFunction · 0.85
runctxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected