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

Method _format_heatmap

vprof/code_heatmap.py:176–188  ·  view source on GitHub ↗

Formats heatmap for UI.

(self, filename, heatmap, execution_count)

Source from the content-addressed store, hash-verified

174 return base_profiler.run_in_separate_process(self._profile_package)
175
176 def _format_heatmap(self, filename, heatmap, execution_count):
177 """Formats heatmap for UI."""
178 with open(filename) as src_file:
179 file_source = src_file.read().split('\n')
180 skip_map = self._calc_skips(heatmap, len(file_source))
181 run_time = sum(time for time in heatmap.values())
182 return {
183 'name': filename,
184 'heatmap': heatmap,
185 'executionCount': execution_count,
186 'srcCode': self._skip_lines(file_source, skip_map),
187 'runTime': run_time
188 }
189
190 def _profile_module(self):
191 """Calculates heatmap for a module."""

Callers 2

_profile_packageMethod · 0.95
_profile_moduleMethod · 0.95

Calls 2

_calc_skipsMethod · 0.95
_skip_linesMethod · 0.95

Tested by

no test coverage detected