def profile_function(self):
with _CodeHeatmapCalculator() as prof:<EOL><INDENT>result = self._run_object(*self._run_args, **self._run_kwargs)<EOL><DEDENT>code_lines, start_line = inspect.getsourcelines(self._run_object)<EOL>source_lines = []<EOL>for line in code_lines:<EOL><INDENT>source_lines.append(('<STR_LIT>', start_line, line))<EOL>start_line += <NUM_LIT:1><EOL><DEDENT>filename = os.path.abspath(inspect.getsourcefile(self._run_object))<EOL>heatmap = prof.heatmap[filename]<EOL>run_time = sum(time for time in heatmap.values())<EOL>return {<EOL>'<STR_LIT>': self._object_name,<EOL>'<STR_LIT>': run_time,<EOL>'<STR_LIT:result>': result,<EOL>'<STR_LIT>': int(time.time()),<EOL>'<STR_LIT>': [{<EOL>'<STR_LIT:name>': self._object_name,<EOL>'<STR_LIT>': heatmap,<EOL>'<STR_LIT>': prof.execution_count[filename],<EOL>'<STR_LIT>': source_lines,<EOL>'<STR_LIT>': run_time<EOL>}]<EOL>}<EOL>
Calculates heatmap for function.