diff options
author | Andre Vieira <andre.simoesdiasvieira@arm.com> | 2020-07-13 11:52:58 +0100 |
---|---|---|
committer | Andre Vieira <andre.simoesdiasvieira@arm.com> | 2020-07-13 12:09:14 +0100 |
commit | c051312eb24dedc119a917ea23e6a5810f5758ff (patch) | |
tree | b88131a0dd9aa7ce883aa3a584dd74afc16cc06e /libc/benchmarks | |
parent | 6bda276f93023ae91937cb8a1f45bf27e5a3ced7 (diff) | |
download | llvm-c051312eb24dedc119a917ea23e6a5810f5758ff.zip llvm-c051312eb24dedc119a917ea23e6a5810f5758ff.tar.gz llvm-c051312eb24dedc119a917ea23e6a5810f5758ff.tar.bz2 |
[libc][benchmark] Add display option to render.py3
Differential Revision: https://reviews.llvm.org/D83380
Diffstat (limited to 'libc/benchmarks')
-rw-r--r-- | libc/benchmarks/render.py3 | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/libc/benchmarks/render.py3 b/libc/benchmarks/render.py3 index e790d18..f8c321f 100644 --- a/libc/benchmarks/render.py3 +++ b/libc/benchmarks/render.py3 @@ -112,7 +112,7 @@ def get_configuration(jsons): return config -def setup_graphs(files): +def setup_graphs(files, display): """Setups the graphs to render from the json files.""" jsons = [] for file in files: @@ -122,6 +122,7 @@ def setup_graphs(files): sys.exit("Nothing to process") for root in jsons: + frequency = root["Host"]["CpuFrequency"] for function in root["Functions"]: function_name = function["Name"] sizes = function["Sizes"] @@ -129,7 +130,13 @@ def setup_graphs(files): assert len(sizes) == len(runtimes) values = collections.defaultdict(lambda: []) for i in range(len(sizes)): - values[sizes[i]].append(runtimes[i]) + value = runtimes[i] + if display == "cycles": + value = value * frequency + if display == "bytespercycle": + value = value * frequency + value = sizes[i] / value + values[sizes[i]].append(value) add_plot(function_name, values) config = get_configuration(jsons) @@ -148,9 +155,15 @@ def setup_graphs(files): axes.set_title(get_title(get_host(jsons))) axes.set_ylim(bottom=0) axes.set_xlabel("Size") - axes.set_ylabel("Time") axes.xaxis.set_major_formatter(EngFormatter(unit="B")) - axes.yaxis.set_major_formatter(EngFormatter(unit="s")) + if display == "cycles": + axes.set_ylabel("Cycles") + if display == "time": + axes.set_ylabel("Time") + axes.yaxis.set_major_formatter(EngFormatter(unit="s")) + if display == "bytespercycle": + axes.set_ylabel("bytes/cycle") + plt.legend() plt.grid() @@ -164,8 +177,14 @@ def main(): "--headless", help="If set do not display the graph.", action="store_true") + parser.add_argument( + "--display", + choices= ["time", "cycles", "bytespercycle"], + default="time", + help="Use to display either 'time', 'cycles' or 'bytes/cycle'.") + args = parser.parse_args() - setup_graphs(args.files) + setup_graphs(args.files, args.display) if args.output: plt.savefig(args.output) if not args.headless: |