Skip to content

Commit

Permalink
Better agg log filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberto Sonnino committed May 10, 2021
1 parent 53e1dc8 commit 9ed8e38
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
9 changes: 5 additions & 4 deletions benchmark/benchmark/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def print(self):
results = [
self._print_latency(), self._print_tps(), self._print_robustness()
]
for records in results:
for name, records in results:
for setup, values in records.items():
data = '\n'.join(
f' Variable value: X={x}\n{y}' for x, y in values
Expand All @@ -114,6 +114,7 @@ def print(self):
'-----------------------------------------\n'
)
filename = PathMaker.agg_file(
name,
setup.nodes,
setup.rate,
setup.tx_size,
Expand All @@ -135,7 +136,7 @@ def _print_latency(self):
results.sort(key=lambda x: x[2])
organized[setup] = [(x, y) for x, y, _ in results]

return organized
return 'latency', organized

def _print_tps(self):
records = deepcopy(self.records)
Expand All @@ -159,7 +160,7 @@ def _print_tps(self):
organized[setup] += [(nodes, result)]

[v.sort(key=lambda x: x[0]) for v in organized.values()]
return organized
return 'tps', organized

def _print_robustness(self):
records = deepcopy(self.records)
Expand All @@ -170,4 +171,4 @@ def _print_robustness(self):
organized[setup] += [(rate, result)]

[v.sort(key=lambda x: x[0]) for v in organized.values()]
return organized
return 'robustness', organized
7 changes: 4 additions & 3 deletions benchmark/benchmark/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def _plot(self, x_label, y_label, y_axis, z_axis, type):
plt.ylim(bottom=0)
plt.xlabel(x_label)
plt.ylabel(y_label[0])
plt.grid()
ax = plt.gca()
ax.xaxis.set_major_formatter(StrMethodFormatter('{x:,.0f}'))
ax.yaxis.set_major_formatter(StrMethodFormatter('{x:,.0f}'))
Expand Down Expand Up @@ -147,14 +148,14 @@ def plot(cls, params_dict):
for f in params.faults:
for n in params.nodes:
robustness_files += glob(
PathMaker.agg_file(n, 'x', tx_size, f, 'any')
PathMaker.agg_file('robustness', n, 'x', tx_size, f, 'any')
)
latency_files += glob(
PathMaker.agg_file(n, 'any', tx_size, f, 'any')
PathMaker.agg_file('latency', n, 'any', tx_size, f, 'any')
)
for l in params.max_latency:
tps_files += glob(
PathMaker.agg_file('x', 'any', tx_size, f, l)
PathMaker.agg_file('tps', 'x', 'any', tx_size, f, l)
)

# Make the plots.
Expand Down
4 changes: 2 additions & 2 deletions benchmark/benchmark/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ def plots_path():
return 'plots'

@staticmethod
def agg_file(nodes, rate, tx_size, faults, max_latency):
def agg_file(type, nodes, rate, tx_size, faults, max_latency):
return join(
PathMaker.plots_path(),
f'agg-{nodes}-{rate}-{tx_size}-{faults}-{max_latency}.txt'
f'{type}-{nodes}-{rate}-{tx_size}-{faults}-{max_latency}.txt'
)

@staticmethod
Expand Down

0 comments on commit 9ed8e38

Please sign in to comment.