Skip to content

Commit

Permalink
graph: translate_dict() now also sort the labels
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed Apr 19, 2017
1 parent 1f679be commit 461fb6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions module/benchpress/grapher/bar_per_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ def render(self):
scripts.sort()

# Get translation of the components and scripts
comp_dict = translate_dict(comps, self.args.stack_map)
script_dict = translate_dict(scripts, self.args.script_map)
(comp_dict, comps) = translate_dict(comps, self.args.stack_map)
(script_dict, scripts) = translate_dict(scripts, self.args.script_map)

# Convert to a bar-plot friendly format
data = []
Expand Down
5 changes: 4 additions & 1 deletion module/benchpress/grapher/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,19 @@ def translate_dict(names, name_map):

names = list(names)
ret = {}
ret_list = []
for (old, new) in name_map:
if len(new) > 0:
for i in range(len(names)):
if re.search(old, names[i]) is not None:
ret[names[i]] = new
ret_list.append(names[i])
names.pop(i)
break
for old, new in [(t, t) for t in names]:
ret[old] = new
return ret
ret_list.append(old)
return ret, ret_list


class Grapher(object):
Expand Down

0 comments on commit 461fb6d

Please sign in to comment.