diff options
Diffstat (limited to 'benchmarks/util/result_parser.py')
-rwxr-xr-x | benchmarks/util/result_parser.py | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/benchmarks/util/result_parser.py b/benchmarks/util/result_parser.py index a843923a..32f35a97 100755 --- a/benchmarks/util/result_parser.py +++ b/benchmarks/util/result_parser.py @@ -45,9 +45,10 @@ __results = [] # "benchmarks": [ # { # "bytes_per_second": int, -# "cpu_time": int, +# "cpu_time_ns": double, +# "iterations": int, # "name: string, -# "time_unit: string, +# "real_time_ns: double, # ... # }, # ... @@ -75,6 +76,36 @@ def __parse_cpp_result(filename): }) +# Synthetic benchmark results example: +# [ +# "benchmarks": [ +# { +# "cpu_time_ns": double, +# "iterations": int, +# "name: string, +# "real_time_ns: double, +# ... +# }, +# ... +# ], +# ... +# ] +def __parse_synthetic_result(filename): + if filename == "": + return + if filename[0] != "/": + filename = os.path.dirname(os.path.abspath(__file__)) + "/" + filename + with open(filename) as f: + results = json.loads(f.read()) + for benchmark in results["benchmarks"]: + __results.append({ + "language": "cpp", + "dataFilename": "", + "behavior": "synthetic", + "throughput": 10.0**9 / benchmark["cpu_time_ns"] + }) + + # Python results example: # [ # [ @@ -204,7 +235,12 @@ def __parse_go_result(filename): "language": "go" }) -def get_result_from_file(cpp_file="", java_file="", python_file="", go_file=""): + +def get_result_from_file(cpp_file="", + java_file="", + python_file="", + go_file="", + synthetic_file=""): results = {} if cpp_file != "": __parse_cpp_result(cpp_file) @@ -214,5 +250,7 @@ def get_result_from_file(cpp_file="", java_file="", python_file="", go_file=""): __parse_python_result(python_file) if go_file != "": __parse_go_result(go_file) + if synthetic_file != "": + __parse_synthetic_result(synthetic_file) - return __results
\ No newline at end of file + return __results |