Skip to content

Commit

Permalink
Prevent ZeroDivisionError when options.colour_nodes_by_selftime is set
Browse files Browse the repository at this point in the history
  • Loading branch information
ppolewicz committed Jun 11, 2016
1 parent 2f3c164 commit 7f295e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gprof2dot.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,13 +714,13 @@ def prune(self, node_thres, edge_thres, colour_nodes_by_selftime):
weights.append(function[TIME_RATIO])
except UndefinedEvent:
pass
max_ratio = max(weights)
max_ratio = max(weights or [1])

# apply rescaled weights for coloriung
for function in compat_itervalues(self.functions):
try:
function.weight = function[TIME_RATIO] / max_ratio
except UndefinedEvent:
except (ZeroDivisionError, UndefinedEvent):
pass

def dump(self):
Expand Down

0 comments on commit 7f295e1

Please sign in to comment.