Add node and php to benchmark dashboard
diff --git a/benchmarks/util/result_parser.py b/benchmarks/util/result_parser.py index 32f35a9..0b8fc49 100755 --- a/benchmarks/util/result_parser.py +++ b/benchmarks/util/result_parser.py
@@ -115,7 +115,6 @@ # behavior: results, # ... # }, -# "message_name": STRING # }, # ... # ], #pure-python @@ -136,8 +135,7 @@ "language": "python", "dataFilename": __extract_file_name(result["filename"]), "behavior": behavior, - "throughput": avg_size / - result["benchmarks"][behavior] * 1e9 / 2 ** 20 + "throughput": result["benchmarks"][behavior] }) @@ -220,7 +218,7 @@ continue first_slash_index = result_list[0].find('/') last_slash_index = result_list[0].rfind('/') - full_filename = result_list[0][first_slash_index+4:last_slash_index] # delete ../ prefix + full_filename = result_list[0][first_slash_index+1:last_slash_index] total_bytes, _ = __get_data_size(full_filename) behavior_with_suffix = result_list[0][last_slash_index+1:] last_dash = behavior_with_suffix.rfind("-") @@ -236,11 +234,45 @@ }) +# Node/Php results example: +# +# [ +# { +# "filename": string, +# "benchmarks": { +# behavior: results, +# ... +# }, +# }, +# ... +# ] +def __parse_js_php_result(filename, language): + 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 result in results: + _, avg_size = __get_data_size(result["filename"]) + for behavior in result["benchmarks"]: + __results.append({ + "language": language, + "dataFilename": __extract_file_name(result["filename"]), + "behavior": behavior, + "throughput": result["benchmarks"][behavior] + }) + + + def get_result_from_file(cpp_file="", java_file="", python_file="", go_file="", - synthetic_file=""): + synthetic_file="", + node_file="", + php_c_file="", + php_file=""): results = {} if cpp_file != "": __parse_cpp_result(cpp_file) @@ -252,5 +284,11 @@ __parse_go_result(go_file) if synthetic_file != "": __parse_synthetic_result(synthetic_file) + if node_file != "": + __parse_js_php_result(node_file, "node") + if php_file != "": + __parse_js_php_result(php_file, "php") + if php_c_file != "": + __parse_js_php_result(php_c_file, "php") return __results
diff --git a/benchmarks/util/result_uploader.py b/benchmarks/util/result_uploader.py index a667da0..9167caf 100755 --- a/benchmarks/util/result_uploader.py +++ b/benchmarks/util/result_uploader.py
@@ -59,13 +59,14 @@ labels_string += ",|%s:%s|" % (key, result[key]) new_result["labels"] = labels_string[1:] new_result["timestamp"] = _INITIAL_TIME - - bq = big_query_utils.create_big_query() - row = big_query_utils.make_row(str(uuid.uuid4()), new_result) - if not big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET, - _TABLE + "$" + _NOW, - [row]): - print('Error when uploading result', new_result) + print(labels_string) +# +# bq = big_query_utils.create_big_query() +# row = big_query_utils.make_row(str(uuid.uuid4()), new_result) +# if not big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET, +# _TABLE + "$" + _NOW, +# [row]): +# print('Error when uploading result', new_result) if __name__ == "__main__": @@ -82,6 +83,15 @@ parser.add_argument("-go", "--go_input_file", help="The golang benchmark result file's name", default="") + parser.add_argument("-node", "--node_input_file", + help="The node.js benchmark result file's name", + default="") + parser.add_argument("-php", "--php_input_file", + help="The pure php benchmark result file's name", + default="") + parser.add_argument("-php_c", "--php_c_input_file", + help="The php with c ext benchmark result file's name", + default="") args = parser.parse_args() metadata = get_metadata() @@ -90,5 +100,8 @@ cpp_file=args.cpp_input_file, java_file=args.java_input_file, python_file=args.python_input_file, - go_file=args.go_input_file + go_file=args.go_input_file, + node_file=args.node_input_file, + php_file=args.php_input_file, + php_c_file=args.php_c_input_file, ), metadata) \ No newline at end of file