Skip to content
Snippets Groups Projects
Commit 9d5dfbff authored by Mattia Mancini's avatar Mattia Mancini
Browse files

Create summary plot and metrics

parent 356f1eb6
No related branches found
No related tags found
1 merge request!3Add test for matrix
Pipeline #81468 passed
.vscode
build
tmp
......@@ -88,10 +88,11 @@ performance-generic:
collect-performance:
stage: summarize
image: "$CI_REGISTRY_IMAGE:latest"
dependencies:
- performance
artifacts:
paths:
- ./results*.json
script:
- ls results*.json
\ No newline at end of file
- python3 ci/summarize-results.py --filter MatrixMultiplication results*.json result-summary
\ No newline at end of file
import json
import os
from argparse import ArgumentParser
import seaborn
import pandas
import matplotlib.pyplot as plt
seaborn.set_theme(palette="flare", style="whitegrid")
def parse_args():
parser = ArgumentParser(description="Combine benchmark metrics from Google Benchmarks Framework")
parser.add_argument("files", nargs="+", help="Metrics")
parser.add_argument("output", help="Combined metrics json")
parser.add_argument("--filter", help="Filter tests by name")
return parser.parse_args()
def read_and_combine_json(files, filter):
results = []
for f_name in files:
basename = os.path.basename(f_name)
with open(f_name, 'r') as f_stream:
result_obj = json.load(f_stream)
results_normalized = result_obj["benchmarks"]
for result_normalized in results_normalized:
if filter and filter not in result_normalized["name"]:
continue
result_normalized["context"] = result_obj["context"]
result_normalized["compiler_version"], result_normalized["architecture"] = basename.replace("results-", "").replace(".json", "").split("-")
results.append(result_normalized)
return results
def store_combined(outfile, obj):
with open(outfile + ".json", "w") as f_stream:
json.dump(obj, f_stream, indent=4)
def create_summary_plot(metrics, outplot_name):
time_unit = metrics.time_unit[0]
grid = seaborn.FacetGrid(metrics, col="architecture")
grid.map(seaborn.barplot, "compiler_version", "cpu_time", "name")
grid.set_ylabels(f"CPU time({time_unit})")
grid.add_legend()
grid.savefig(outplot_name + ".png")
def main():
args = parse_args()
metrics_results = read_and_combine_json(args.files, args.filter)
metrics_dataframe= pandas.DataFrame(metrics_results)
create_summary_plot(metrics_dataframe, args.output)
store_combined(args.output, metrics_results)
if __name__ == '__main__':
main()
\ No newline at end of file
......@@ -20,4 +20,6 @@ RUN apt-get update -qq &&\
pkg-config \
python3-dev python3-numpy \
python3-sphinx \
python3-pip
python3-pip \
python3-seaborn \
python3-pandas
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment