MCPcopy Index your code
hub / github.com/python/cpython / _Utils

Class _Utils

Lib/profiling/tracing/_utils.py:1–32  ·  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

1class _Utils:
2 """Support class for utility functions which are shared by
3 profile.py and cProfile.py modules.
4 Not supposed to be used directly.
5 """
6
7 def __init__(self, profiler):
8 self.profiler = profiler
9
10 def run(self, statement, filename, sort):
11 prof = self.profiler()
12 try:
13 prof.run(statement)
14 except SystemExit:
15 pass
16 finally:
17 self._show(prof, filename, sort)
18
19 def runctx(self, statement, globals, locals, filename, sort):
20 prof = self.profiler()
21 try:
22 prof.runctx(statement, globals, locals)
23 except SystemExit:
24 pass
25 finally:
26 self._show(prof, filename, sort)
27
28 def _show(self, prof, filename, sort):
29 if filename is not None:
30 prof.dump_stats(filename)
31 else:
32 prof.print_stats(sort)

Callers 2

runFunction · 0.90
runctxFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…