Skip to content

Commit d3f62d4

Browse files
committed
Results graph labels now rotated and aligned
1 parent 7883c95 commit d3f62d4

File tree

9 files changed

+239
-262
lines changed

9 files changed

+239
-262
lines changed

PIDTool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def _find_main_pid(self, pid=None):
7676
:return: PID object of the main process for the target application
7777
"""
7878
if pid is None:
79+
7980
res = self.adb_device.command("ps | grep " + self.name)
8081
else:
8182
res = self.adb_device.command("ps | grep " + pid)

ProcessBranch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def add_event(self, event, event_type=JobType.UNKNOWN, subgraph=False):
259259
)
260260

261261
toi = self.tasks[-1]
262-
toi.add_event(event, subgraph=subgraph) ##
262+
toi.add_event(event, subgraph=subgraph) ##HERE
263263
toi.finish()
264264
utils_g = ("{}% ".format(round(k[1], 2))
265265
for k in enumerate(toi.util))

SystemMetrics.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ def get_temp(self, ts, core):
393393
sys.exit(1)
394394

395395
def _get_core_count(self):
396-
return int(self.adb.command("nproc"))
396+
return 8
397+
# return int(self.adb.command("nproc")) #TODO
397398

398399
def _get_core_freqs(self):
399400
frequencies = []

TraceProcessor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ def process_trace(
7070

7171
process_tree = ProcessTree(self.pidt, metrics)
7272
trace_start_time = tracecmd.processed_events[0].time
73+
if len(tracecmd.idle_events) == 0:
74+
raise Exception("No idle events to process")
75+
7376
if tracecmd.idle_events[0].time < trace_start_time:
7477
trace_start_time = tracecmd.idle_events[0].time
7578
if tracecmd.temp_events[0].time < trace_start_time:

scripts/compile_optimizations.py

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,9 @@
88

99
parser = argparse.ArgumentParser()
1010

11-
parser.add_argument("-f",
12-
"--folder",
13-
required=True,
14-
type=str,
15-
help="Specify folder where results can be found")
16-
parser.add_argument("-a",
17-
"--application",
18-
required=True,
19-
type=str,
20-
help="Spcifies the applications name")
21-
parser.add_argument("-g",
22-
"--governor",
23-
required=True,
24-
type=str,
25-
help="Specifies the governor used in the test")
11+
parser.add_argument("-f", "--folder", required=True, type=str, help="Specify folder where results can be found")
12+
parser.add_argument("-a", "--application", required=True, type=str, help="Spcifies the applications name")
13+
parser.add_argument("-g", "--governor", required=True, type=str, help="Specifies the governor used in the test")
2614

2715
args = parser.parse_args()
2816

@@ -38,14 +26,9 @@ def writerEmptyRow(writer):
3826

3927

4028
def writeResultsHeader(writer, governor, application):
41-
writer.writerow([
42-
"Governor: {}".format(governor), "Application: {}".format(application)
43-
])
29+
writer.writerow(["Governor: {}".format(governor), "Application: {}".format(application)])
4430
writerEmptyRow(writer)
45-
writer.writerow([
46-
"B2L Reallocations", "DVFS", "Realloc in cluster",
47-
"DVFS after realloc", "Total"
48-
])
31+
writer.writerow(["B2L Reallocations", "DVFS", "Realloc in cluster", "DVFS after realloc", "Total"])
4932

5033

5134
def findOptimizationsRow(filepath):
@@ -66,23 +49,25 @@ def findOptimizationsRow(filepath):
6649
pass
6750

6851

52+
tests = []
53+
54+
6955
def getResults():
56+
global tests
7057
res_count = 0
7158
results = [0, 0, 0, 0]
7259
for directory, subdirectory, files in os.walk(input_dir):
7360
for sd in subdirectory:
7461
for d, s, f in os.walk(os.path.join(directory, sd)):
7562
for r_file in f:
7663
if "results" in r_file:
77-
print("{} : {}".format(sd, d))
7864
test = os.path.join(d, r_file)
7965
res = findOptimizationsRow(test)
8066
res_count += 1
8167
if (len(res) != 4):
82-
raise Exception(
83-
"File {} failed to process".format(test))
68+
raise Exception("File {} failed to process".format(test))
8469
else:
85-
print("{}".format(res))
70+
tests.append(res)
8671
for i in range(len(res)):
8772
results[i] += int(res[i])
8873

@@ -92,9 +77,7 @@ def getResults():
9277
total += results[i]
9378

9479
results.append(total)
95-
print("Total: {}, {}, {}, {} : {}".format(results[0], results[1],
96-
results[2], results[3],
97-
results[4]))
80+
print("Total: {}, {}, {}, {} : {}".format(results[0], results[1], results[2], results[3], results[4]))
9881
return results
9982

10083

@@ -107,3 +90,8 @@ def getResults():
10790

10891
writeResultsHeader(fw, governor, application)
10992
fw.writerow(r)
93+
fw.writerow([])
94+
fw.writerow(["Individual tests"])
95+
96+
for i, test in enumerate(tests):
97+
fw.writerow([i + 1, test[0], test[1], test[2], test[3]])

scripts/create_results.py

Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@
1414

1515
parser = argparse.ArgumentParser()
1616

17-
parser.add_argument(
18-
"-f",
19-
"--folder",
20-
required=True,
21-
type=str,
22-
help="Relative location to the folder where results can be found")
17+
parser.add_argument("-f", "--folder", required=True, type=str, help="Relative location to the folder where results can be found")
2318

2419
args = parser.parse_args()
2520

@@ -55,16 +50,14 @@
5550
current_governor = gov_dir
5651
apps[current_app][current_governor] = []
5752
# find compiled file
58-
for dxx, sdxx, fx in os.walk(
59-
os.path.join(dx, current_governor)):
53+
for dxx, sdxx, fx in os.walk(os.path.join(dx, current_governor)):
6054
for f in fx:
6155
if "compiled" in f:
6256
with open(os.path.join(dxx, f)) as fl:
6357
reader = csv.reader(fl, delimiter=",")
6458
for i, row in enumerate(reader):
6559
if i == 3:
66-
apps[current_app][
67-
current_governor] = row[0:5]
60+
apps[current_app][current_governor] = row[0:5]
6861

6962
for name in app_names:
7063
writer.writerow([name])
@@ -84,16 +77,11 @@
8477
bar_width = 0.15
8578
opacity = 0.8
8679

87-
titles = [
88-
'Big To Little Reallocations', 'DVFS Misdecisions',
89-
'Intra-Cluster Reallocations', 'DVFS After Reallocations'
90-
]
80+
titles = ['Big To Little Reallocations', 'DVFS Misdecisions', 'Intra-Cluster Reallocations', 'DVFS After Reallocations']
9181

9282
y_top_margin = 0.2
9383
colors = ['0', '0.25', '0.5', '0.75']
9484

95-
plots = []
96-
9785
matplotlib.rcParams['font.serif'] = 'Times New Roman'
9886

9987
fig, ax = plt.subplots(2, 2, sharex='col')
@@ -119,23 +107,18 @@
119107
y_max = dvfs_val
120108
bars.append(dvfs_val)
121109

122-
ax[i, j].bar(x_coords[x],
123-
bars,
124-
bar_width,
125-
alpha=opacity,
126-
color=colors[x],
127-
label=gov)
128-
ax[i, j].set(title=titles[count],
129-
xticks=index + 1.5 * bar_width,
130-
xticklabels=app_names)
110+
ax[i, j].bar(x_coords[x], bars, bar_width, alpha=opacity, color=colors[x], label=gov)
111+
ax[i, j].tick_params('x', labelrotation=30)
112+
ax[i, j].set(
113+
title=titles[count],
114+
xticks=index + 1.5 * bar_width,
115+
)
116+
# xticklabels=app_names,
117+
ax[i, j].set_xticklabels(labels=app_names, horizontalalignment='right')
131118

132119
count += 1
133120

134-
fig.legend(labels=governors,
135-
ncol=len(governors),
136-
loc="lower center",
137-
borderaxespad=0.5,
138-
frameon=False)
121+
fig.legend(labels=governors, ncol=len(governors), loc="lower center", borderaxespad=0.5, frameon=False)
139122
fig.savefig('result_fig.png', dpi=300, format='png')
140123

141124
fig2, ax2 = plt.subplots()
@@ -157,14 +140,9 @@
157140
y_max = dvfs_val
158141
bars.append(dvfs_val)
159142

160-
ax2.bar(x_coords[x],
161-
bars,
162-
bar_width,
163-
alpha=opacity,
164-
color=colors[x],
165-
label=gov)
166-
ax2.set(title='Total Misdecisions',
167-
xticks=index + 1.5 * bar_width,
168-
xticklabels=app_names)
143+
ax2.bar(x_coords[x], bars, bar_width, alpha=opacity, color=colors[x], label=gov)
144+
ax2.set(title='Total Misdecisions', xticks=index + 1.5 * bar_width, xticklabels=app_names)
145+
146+
fig2.savefig('totals_fig.png', dpi=300, format='png')
169147

170148
plt.show()

0 commit comments

Comments
 (0)