Skip to content

Commit

Permalink
Revert "also show ncalls"
Browse files Browse the repository at this point in the history
This reverts commit 0689b32.
  • Loading branch information
matthiasdiener committed May 16, 2023
1 parent 0689b32 commit bcca59c
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions pyinstrument/renderers/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,18 @@ class FrameDesc:
code_position_short: Optional[str]
function: str


def walk(frame: Frame):
frame_desc = FrameDesc(frame.code_position_short, frame.function)
frame_desc_to_self_time[frame_desc] = (
frame_desc_to_self_time.get(frame_desc, 0) + frame.total_self_time
)
frame_desc_to_frame[frame_desc] = frame
frame_desc_to_ncalls[frame_desc] = frame_desc_to_ncalls.get(frame_desc, 0) + 1

for child in frame.children:
walk(child)

frame_desc_to_self_time: Dict[FrameDesc, float] = {}
frame_desc_to_frame: Dict[FrameDesc, Frame] = {}
frame_desc_to_ncalls: Dict[FrameDesc, int] = {}

walk(frame)

Expand All @@ -187,15 +184,14 @@ def walk(frame: Frame):

color = self._ansi_color_for_time(self_time)

res += "{color}{val:.3f}{unit}{c.end} {name_color}{function}{c.end} {c.faint}{code_position}{c.end} {ncalls}\n".format(
res += "{color}{val:.3f}{unit}{c.end} {name_color}{function}{c.end} {c.faint}{code_position}{c.end}\n".format(
color=color,
val=val,
unit=unit,
c=self.colors,
name_color=self._ansi_color_for_name(frame_desc_to_frame[frame_desc]),
function=frame_desc.function,
code_position=frame_desc.code_position_short,
ncalls=frame_desc_to_ncalls[frame_desc],
)

return res
Expand Down

0 comments on commit bcca59c

Please sign in to comment.