MCPcopy
hub / github.com/nvdv/vprof / _transform_stats

Method _transform_stats

vprof/profiler.py:18–34  ·  view source on GitHub ↗

Processes collected stats for UI.

(prof)

Source from the content-addressed store, hash-verified

16
17 @staticmethod
18 def _transform_stats(prof):
19 """Processes collected stats for UI."""
20 records = []
21 for info, params in prof.stats.items():
22 filename, lineno, funcname = info
23 cum_calls, num_calls, time_per_call, cum_time, _ = params
24 if prof.total_tt == 0:
25 percentage = 0
26 else:
27 percentage = round(100 * (cum_time / prof.total_tt), 4)
28 cum_time = round(cum_time, 4)
29 func_name = '%s @ %s' % (funcname, filename)
30 color_hash = base_profiler.hash_name(func_name)
31 records.append(
32 (filename, lineno, funcname, cum_time, percentage, num_calls,
33 cum_calls, time_per_call, filename, color_hash))
34 return sorted(records, key=operator.itemgetter(4), reverse=True)
35
36 def _profile_package(self):
37 """Runs cProfile on a package."""

Callers 4

_profile_packageMethod · 0.95
_profile_moduleMethod · 0.95
profile_functionMethod · 0.95
testTransformStatsMethod · 0.80

Calls

no outgoing calls

Tested by 1

testTransformStatsMethod · 0.64