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

Method _profile_package

vprof/code_heatmap.py:150–170  ·  view source on GitHub ↗

Calculates heatmap for a package.

(self)

Source from the content-addressed store, hash-verified

148 return code_with_skips
149
150 def _profile_package(self):
151 """Calculates heatmap for a package."""
152 with _CodeHeatmapCalculator() as prof:
153 try:
154 runpy.run_path(self._run_object, run_name='__main__')
155 except SystemExit:
156 pass
157
158 heatmaps = []
159 for filename, heatmap in prof.heatmap.items():
160 if os.path.isfile(filename):
161 heatmaps.append(
162 self._format_heatmap(
163 filename, heatmap, prof.execution_count[filename]))
164
165 run_time = sum(heatmap['runTime'] for heatmap in heatmaps)
166 return {
167 'objectName': self._run_object,
168 'runTime': run_time,
169 'heatmaps': heatmaps
170 }
171
172 def profile_package(self):
173 """Runs package profiler in a separate process."""

Callers

nothing calls this directly

Calls 2

_format_heatmapMethod · 0.95

Tested by

no test coverage detected