Skip to content

Commit

Permalink
node label
Browse files Browse the repository at this point in the history
this showes a problem in time event ranking
  • Loading branch information
pashkoff committed May 11, 2012
1 parent feb3542 commit 6535d7f
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions main.py
Expand Up @@ -36,6 +36,10 @@ def is_shrinkable(self):
return False
def get_dot_name(self):
return None
def get_dot_attrib(self):
return '[]'
def get_dot_node_name_attrib(self):
return '{0} {1};'.format(self.get_dot_name(), self.get_dot_attrib())

def set_parent(self, par):
if self.parent != par:
Expand Down Expand Up @@ -103,13 +107,18 @@ def __init__(self, time, thread, event):

def get_dot_name(self):
return '"{0}"'.format(self.event.line)
def get_dot_label(self):
return r'{0}\n{1}'.format(self.event.line, self.event.time)
def get_dot_attrib(self):
return '[label="{0}"]'.format(self.get_dot_label())

pass

class Graph():
def __init__(self, events):
self.events = events
self.raw_events = events

self.events = list()
self.times = set()
self.time_events = dict()
self.time_events_th_uniq = dict()
Expand All @@ -124,7 +133,7 @@ def make_graph(self):
lg.info(funcname())

# parse all events and fill base structures
for _,v in self.events.iteritems():
for _,v in self.raw_events.iteritems():
tm = TimeNode(v.time)
if not tm in self.times:
self.times.add(tm)
Expand All @@ -140,6 +149,8 @@ def make_graph(self):
ev = EventNode(tm, th, v)
self.thread_events[th].append(ev)
self.time_events[tm].append(ev)
self.events.append(ev)

pass

# build the linked list of event and thread nodes
Expand Down Expand Up @@ -197,6 +208,12 @@ def node_list(node):
pass
pass

# nodes attributes
for ev in self.events:
fd.write(ev.get_dot_node_name_attrib())
fd.write('\n')
pass


# footer
fd.write('}')
Expand Down

0 comments on commit 6535d7f

Please sign in to comment.