Skip to content

Commit

Permalink
Merge pull request #335 from joerick/fix-302
Browse files Browse the repository at this point in the history
Fix 302 divide by zero error
  • Loading branch information
joerick authored Aug 26, 2024
2 parents d178a77 + c953489 commit cb443f1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyinstrument/renderers/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ def frame_description(self, frame: Frame, *, override_time: float | None = None)
return f"{value_str} {function_str} {code_position_str}"

def frame_proportion_of_total_time(self, time: float) -> float:
if self.root_frame.time == 0:
return 1
return time / self.root_frame.time

def _ansi_color_for_time(self, time: float) -> str:
Expand Down

0 comments on commit cb443f1

Please sign in to comment.