diff --git a/quisby/benchmarks/speccpu/comparison.py b/quisby/benchmarks/speccpu/comparison.py index eb7bb00..46c39d1 100644 --- a/quisby/benchmarks/speccpu/comparison.py +++ b/quisby/benchmarks/speccpu/comparison.py @@ -9,11 +9,35 @@ create_sheet, clear_sheet_data, clear_sheet_charts, ) from quisby.util import combine_two_array_alternating +from quisby.util import combine_two_array_alternating, merge_lists_alternately, read_config +from quisby.benchmarks.coremark.graph import graph_coremark_data +import re +def extract_prefix_and_number(input_string): + match = re.search(r'^(.*?)(\d+)(.*?)$', input_string) + if match: + prefix = match.group(1) + suffix = match.group(3) # Extracts the suffix after the number + return prefix, suffix + return None, None + + +def compare_inst(item1, item2): + cloud_type = read_config("cloud", "cloud_type") + if cloud_type == "local": + return True + elif cloud_type == "aws": + return item1.split(".")[0] == item2.split(".")[0] + elif cloud_type == "gcp": + + return item1.split("-")[0] == item2.split("-")[0] + elif cloud_type == "azure": + return extract_prefix_and_number(item1) == extract_prefix_and_number(item2) def compare_speccpu_results(spreadsheets, spreadsheetId, test_name): spreadsheet_name = [] values = [] + table_name = ["System name", "Price-perf"] results = [] test_name = "speccpu" @@ -28,11 +52,33 @@ def compare_speccpu_results(spreadsheets, spreadsheetId, test_name): list_2 = list(values[1]) for value in list_1: - results.append([""]) for ele in list_2: - if value[0][0] == ele[0][0] and value[0][1] == ele[0][1]: - results.append(value[0]) - results = combine_two_array_alternating(results, value, ele) + # Check max throughput + if value[0][0] in table_name and ele[0][0] in table_name and value[0][0] == ele[0][0]: + if compare_inst(value[1][0], ele[1][0]): + results.append([""]) + for item1 in value: + for item2 in ele: + if item1[0] == item2[0]: + results = merge_lists_alternately(results, item1, item2) + break + + elif value[0][0] == "Cost/Hr" and ele[0][0] == "Cost/Hr": + if compare_inst(value[1][0], ele[1][0]): + results.append([""]) + for item1 in value: + for item2 in ele: + if item1[0] == item2[0]: + results.append(item1) + break + + elif value[1][0] == ele[1][0]: + if value[0][0] == ele[0][0]: + results.append([""]) + results.append(value[0]) + for item1, item2 in zip(value[1:], ele[1:]): + results = merge_lists_alternately(results, item1, item2) + break try: create_sheet(spreadsheetId, test_name) custom_logger.info("Deleting existing charts and data from the sheet...") diff --git a/quisby/benchmarks/speccpu/graph.py b/quisby/benchmarks/speccpu/graph.py index 8aa275a..abc7a0f 100644 --- a/quisby/benchmarks/speccpu/graph.py +++ b/quisby/benchmarks/speccpu/graph.py @@ -40,7 +40,7 @@ def create_series_range_speccpu_compare(column_count, sheetId, start_index, end_ "sources": [ { "sheetId": sheetId, - "startRowIndex": start_index + 1, + "startRowIndex": start_index , "endRowIndex": end_index, "startColumnIndex": 1, "endColumnIndex": 2, @@ -57,7 +57,7 @@ def create_series_range_speccpu_compare(column_count, sheetId, start_index, end_ "sources": [ { "sheetId": sheetId, - "startRowIndex": start_index + 1, + "startRowIndex": start_index , "endRowIndex": end_index, "startColumnIndex": 2, "endColumnIndex": 3, @@ -74,7 +74,7 @@ def create_series_range_speccpu_compare(column_count, sheetId, start_index, end_ "sources": [ { "sheetId": sheetId, - "startRowIndex": start_index + 1, + "startRowIndex": start_index , "endRowIndex": end_index, "startColumnIndex": 3, "endColumnIndex": 4, @@ -112,7 +112,7 @@ def graph_speccpu_data(spreadsheetId, test_name, action): start_index = index test = data[start_index][0] title = "%s : %s" % (test_name, "Price-Performance") - subtitle = "%s : %s" % ("Geomean/$", test) + subtitle = "%s :" % (row[1].split("-")[0]) left_title = row[1].lower() if start_index: