diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2014-01-27 13:22:57 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2014-01-27 13:22:57 -0500 |
commit | f4b77776564aad05530faab46e92c24c03d8d393 (patch) | |
tree | c0a72509fffa94e53e3410d9da9d1bb9cf1e1bd9 | |
parent | 0f9b99cd68f9d77dfa7eeb9af085f1f7553fbeb5 (diff) |
Include task stats in comments of graph dot strs
-rwxr-xr-x | ecrts14/graph.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/ecrts14/graph.py b/ecrts14/graph.py index 95e63cb..dc2807d 100755 --- a/ecrts14/graph.py +++ b/ecrts14/graph.py | |||
@@ -84,7 +84,16 @@ class node: | |||
84 | elif self.isSink: | 84 | elif self.isSink: |
85 | attr.append('style=filled') | 85 | attr.append('style=filled') |
86 | attr.append('color="#E04050D3"') | 86 | attr.append('color="#E04050D3"') |
87 | return 'node [%s]; %d;' % (', '.join(attr), self.id) | 87 | node_str = 'node [%s]; %d;' % (', '.join(attr), self.id) |
88 | if hasattr(self, 'task'): | ||
89 | # assumes time is in microseconds | ||
90 | cost_str = format(self.task.cost/1000.0, '.4f').rstrip('0').rstrip('.') | ||
91 | period_str = format(self.task.period/1000.0, '.4f').rstrip('0').rstrip('.') | ||
92 | extra_str = ' /* node_%d: exec: %s, period: %s, split: %d, cluster %d, is_src: %s, is_sink: %s */' % ( | ||
93 | self.id, cost_str, period_str, self.task.split, self.task.partition, self.isSrc, self.isSink) | ||
94 | else: | ||
95 | extra_str = '' | ||
96 | return node_str + extra_str | ||
88 | 97 | ||
89 | class edge: | 98 | class edge: |
90 | def __init__(self, a, b): | 99 | def __init__(self, a, b): |
@@ -97,7 +106,10 @@ class edge: | |||
97 | 106 | ||
98 | def dot(self): | 107 | def dot(self): |
99 | criticalPath = (self.p.isSpine and self.s.isSpine and abs(self.s.privLevel - self.p.privLevel) == 1) | 108 | criticalPath = (self.p.isSpine and self.s.isSpine and abs(self.s.privLevel - self.p.privLevel) == 1) |
100 | return '%d -> %d [%s];' % (self.p.id, self.s.id, ('style="", color=dimgrey', 'style=bold, color="#E04050"')[criticalPath]) | 109 | edge_str = '%d -> %d [%s];' % (self.p.id, self.s.id, ('style="", color=dimgrey', 'style=bold, color="#E04050"')[criticalPath]) |
110 | wss_str = format(self.wss, '.4f').rstrip('0').rstrip('.') | ||
111 | extra_str = ' /* parent: node_%d, child: node_%d, wss: %s, is_spine: %s */' % (self.p.id, self.s.id, wss_str, criticalPath) | ||
112 | return edge_str + extra_str | ||
101 | 113 | ||
102 | class graph: | 114 | class graph: |
103 | def __init__(self): | 115 | def __init__(self): |
@@ -124,6 +136,10 @@ class graph: | |||
124 | outs.write('\tratio="compress";\n') | 136 | outs.write('\tratio="compress";\n') |
125 | outs.write('\tsize="11,8.5";\n') | 137 | outs.write('\tsize="11,8.5";\n') |
126 | 138 | ||
139 | extra_str = '/* graph_%d: depth: %d, nr_nodes: %d, nr_src: %d, nr_sink: %d, nr_edges: %d */' % ( | ||
140 | self.id, self.depth, len(self.nodes), len(self.sources), len(self.sinks), len(self.edges)) | ||
141 | outs.write('\t%s\n' % extra_str) | ||
142 | |||
127 | # draw nodes | 143 | # draw nodes |
128 | for n in self.nodes: | 144 | for n in self.nodes: |
129 | outs.write('\t') | 145 | outs.write('\t') |