Skip to content

Commit

Permalink
Show full filename in tooltips for Python profiles.
Browse files Browse the repository at this point in the history
Only works with some graphviz output formats (e.g. SVG).

Only supports the 'pstats' input format (mostly because I'm unfamiliar
with the other formats, and because I don't know if the problem is as
pressing with those as it is with Python profiles).

Fixes jrfonseca#14.
  • Loading branch information
mgedmin authored and jrfonseca committed Dec 1, 2015
1 parent a449a9a commit f853915
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gprof2dot.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def __init__(self, id, name):
self.called = None
self.weight = None
self.cycle = None
self.filename = None

def add_call(self, call):
if call.callee_id in self.calls:
Expand Down Expand Up @@ -2583,6 +2584,7 @@ def get_function(self, key):
id = len(self.function_ids)
name = self.get_function_name(key)
function = Function(id, name)
function.filename = key[0]
self.profile.functions[id] = function
self.function_ids[key] = id
else:
Expand Down Expand Up @@ -2917,6 +2919,7 @@ def graph(self, profile, theme):
color = self.color(theme.node_bgcolor(weight)),
fontcolor = self.color(theme.node_fgcolor(weight)),
fontsize = "%.2f" % theme.node_fontsize(weight),
tooltip = function.filename,
)

for _, call in sorted_iteritems(function.calls):
Expand Down Expand Up @@ -2981,6 +2984,8 @@ def attr_list(self, attrs):
self.write(' [')
first = True
for name, value in sorted_iteritems(attrs):
if value is None:
continue
if first:
first = False
else:
Expand Down

0 comments on commit f853915

Please sign in to comment.