Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion fill_postgres_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,12 @@ def load_aggregated_stats(output_csv_path: str) -> Dict[str, Dict[str, Any]]:
'p99_mgas_s': float(row['p99 (MGas/s)']) if row.get('p99 (MGas/s)') and row['p99 (MGas/s)'].strip() else None,
'min_mgas_s': float(row['Min (MGas/s)']) if row.get('Min (MGas/s)') and row['Min (MGas/s)'].strip() else None,
'n_samples': int(row['N']) if row.get('N') and row['N'].strip() else None,
# Add timestamp fields if they exist
# Add timestamp and duration fields if they exist
'start_time': row.get('Start Time') if row.get('Start Time') else None,
'end_time': row.get('End Time') if row.get('End Time') else None,
'test_duration': float(row['Duration (ms)']) if row.get('Duration (ms)') and row['Duration (ms)'].strip() else None,
'fcu_duration': float(row['FCU time (ms)']) if row.get('FCU time (ms)') and row['FCU time (ms)'].strip() else None,
'np_duration': float(row['NP time (ms)']) if row.get('NP time (ms)') and row['NP time (ms)'].strip() else None,
'test_description': row.get('Description')
}
except ValueError as ve:
Expand Down Expand Up @@ -472,6 +476,15 @@ def populate_data_for_client(
start_time = agg_stats.get('start_time')
if start_time in (0, "0", "", None):
start_time = None

end_time = agg_stats.get('end_time')
if end_time in (0, "0", "", None):
end_time = None

test_duration = agg_stats.get('test_duration')
fcu_duration = agg_stats.get('fcu_duration')
np_duration = agg_stats.get('np_duration')

record: Dict[str, Any] = {
'client_name': client_name,
'client_version': client_version,
Expand All @@ -488,6 +501,10 @@ def populate_data_for_client(
'raw_run_mgas_s': raw_run_mgas_s,
'raw_run_description': raw_run_description, # This is from the raw data row
'start_time': start_time,
'end_time': end_time,
'test_duration': test_duration,
'fcu_duration': fcu_duration,
'np_duration': np_duration,
**computer_specs
}
records_to_insert.append(record)
Expand Down
10 changes: 9 additions & 1 deletion generate_postgres_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ def get_sql_for_benchmark_table(table_name: str) -> str:
raw_run_duration_ms REAL NULL, -- Execution duration in milliseconds for this specific run
raw_run_description TEXT NULL, -- Description from the raw_*.csv row, potentially more specific

-- Test execution timestamps
-- Test execution timestamps and durations
start_time TIMESTAMP WITH TIME ZONE NULL, -- Test start timestamp
end_time TIMESTAMP WITH TIME ZONE NULL, -- Test end timestamp
test_duration REAL NULL, -- Test duration in milliseconds
fcu_duration REAL NULL, -- FCU (engine_forkchoiceUpdatedV3) duration in milliseconds
np_duration REAL NULL, -- NP (engine_newPayloadV4) duration in milliseconds

-- Computer Specifications (parsed from system info, repeated per row, all nullable)
spec_processor_type TEXT NULL,
Expand Down Expand Up @@ -90,6 +94,10 @@ def execute_sql_on_db(db_params: Dict[str, Any], table_name: str) -> None:
("client_version", "TEXT NULL"),
("start_time", "TIMESTAMP WITH TIME ZONE NULL"),
("raw_run_duration_ms", "REAL NULL"),
("end_time", "TIMESTAMP WITH TIME ZONE NULL"),
("test_duration", "REAL NULL"),
("fcu_duration", "REAL NULL"),
("np_duration", "REAL NULL"),
# Add other columns here in the future for schema evolution
# e.g., ("new_feature_flag", "BOOLEAN DEFAULT FALSE")
]
Expand Down
39 changes: 31 additions & 8 deletions report_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ def get_html_report(client_results, clients, results_paths, test_cases, methods,
'<th>N</th>\n'
'<th class=\"title\">Description</th>\n'
'<th>Start Time</th>\n'
'<th>End Time</th>\n'
f'<th onclick="sortTable(10, \'table_{client}\', true)" style="cursor: pointer;">Duration (ms) &uarr; &darr;</th>\n'
f'<th onclick="sortTable(11, \'table_{client}\', true)" style="cursor: pointer;">FCU time (ms) &uarr; &darr;</th>\n'
f'<th onclick="sortTable(12, \'table_{client}\', true)" style="cursor: pointer;">NP time (ms) &uarr; &darr;</th>\n'
'</tr>\n'
'</thread>\n'
'<tbody>\n')
Expand All @@ -88,7 +92,11 @@ def get_html_report(client_results, clients, results_paths, test_cases, methods,
f'<td>{data[1]}</td>\n'
f'<td>{data[6]}</td>\n'
f'<td style="text-align:left;" >{data[7]}</td>\n'
f'<td>{data[8]}</td>\n</tr>\n')
f'<td>{data[8]}</td>\n'
f'<td>{data[9]}</td>\n'
f'<td>{data[10]}</td>\n'
f'<td>{data[11]}</td>\n'
f'<td>{data[12]}</td>\n</tr>\n')
results_to_print += '\n'
results_to_print += ('</table>\n'
'</tbody>\n')
Expand Down Expand Up @@ -153,7 +161,7 @@ def get_html_report(client_results, clients, results_paths, test_cases, methods,
print(formatted_html)
if not os.path.exists('reports'):
os.mkdir('reports')
with open(f'reports/index.html', 'w') as file:
with open('reports/index.html', 'w') as file:
file.write(formatted_html)

for client, gas_table in csv_table.items():
Expand All @@ -162,9 +170,9 @@ def get_html_report(client_results, clients, results_paths, test_cases, methods,
csvwriter = csv.writer(csvfile)
csvwriter.writerow(
['Title', 'Max (MGas/s)', 'p50 (MGas/s)', 'p95 (MGas/s)', 'p99 (MGas/s)', 'Min (MGas/s)', 'N',
'Description', "Start Time"])
'Description', "Start Time", "End Time", "Duration (ms)", "FCU time (ms)", "NP time (ms)"])
for test_case, data in gas_table.items():
csvwriter.writerow([data[0], data[2], data[3], data[4], data[5], data[1], data[6], data[7], data[8]])
csvwriter.writerow([data[0], data[2], data[3], data[4], data[5], data[1], data[6], data[7], data[8], data[9], data[10], data[11], data[12]])


def main():
Expand Down Expand Up @@ -213,16 +221,31 @@ def main():
client_results[client][test_case_name][gas][method] = []
failed_tests[client][test_case_name][gas][method] = []
for run in range(1, runs + 1):
responses, results, timestamp = utils.extract_response_and_result(results_paths, client, test_case_name,
responses, results, timestamp, duration, fcu_duration, np_duration = utils.extract_response_and_result(results_paths, client, test_case_name,
gas, run, method, fields)
client_results[client][test_case_name][gas][method].append(results)
failed_tests[client][test_case_name][gas][method].append(not responses)
# print(test_case_name + " : " + str(timestamp))
if str(timestamp) != "0":
client_results[client][test_case_name]["timestamp"] = utils.convert_dotnet_ticks_to_utc(timestamp)
# Store raw timestamp in ticks for calculation, not converted string
client_results[client][test_case_name]["timestamp_ticks"] = timestamp
# Only store duration if non-zero to avoid overwriting valid values
if duration != 0:
client_results[client][test_case_name]["duration"] = duration
if fcu_duration != 0:
client_results[client][test_case_name]["fcu_duration"] = fcu_duration
if np_duration != 0:
client_results[client][test_case_name]["np_duration"] = np_duration
else:
if "timestamp" not in str(client_results[client][test_case_name]):
client_results[client][test_case_name]["timestamp"] = 0
if "timestamp_ticks" not in client_results[client][test_case_name]:
client_results[client][test_case_name]["timestamp_ticks"] = 0
# Initialize duration to 0 only if not set yet
if "duration" not in client_results[client][test_case_name]:
client_results[client][test_case_name]["duration"] = 0
if "fcu_duration" not in client_results[client][test_case_name]:
client_results[client][test_case_name]["fcu_duration"] = 0
if "np_duration" not in client_results[client][test_case_name]:
client_results[client][test_case_name]["np_duration"] = 0

gas_set = set()
for test_case_name, test_case_gas in test_cases.items():
Expand Down
33 changes: 26 additions & 7 deletions report_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_table_report(client_results, clients, results_paths, test_cases, methods
image_to_print = el_images[client_without_tag]
results_to_print += f'{client.capitalize()} - {image_to_print} - Benchmarking Report' + '\n'
results_to_print += (center_string('Title',
68) + '| Min (MGas/s) | Max (MGas/s) | p50 (MGas/s) | p95 (MGas/s) | p99 (MGas/s) | N | Description | Start time\n')
68) + '| Min (MGas/s) | Max (MGas/s) | p50 (MGas/s) | p95 (MGas/s) | p99 (MGas/s) | N | Description | Start time | End time | Duration (ms) | FCU time (ms) | NP time (ms)\n')
gas_table_norm = utils.get_gas_table(client_results, client, test_cases, gas_set, methods[0], metadata)
for test_case, data in gas_table_norm.items():
results_to_print += (f'{align_left_string(data[0], 68)}|'
Expand All @@ -34,13 +34,17 @@ def get_table_report(client_results, clients, results_paths, test_cases, methods
f'{center_string(data[5], 14)}|'
f'{center_string(data[6], 7)}|'
f'{align_left_string(data[7], 50)}|'
f'{data[8]}\n')
f'{data[8]}|'
f'{data[9]}|'
f'{center_string(data[10], 14)}|'
f'{center_string(data[11], 15)}|'
f'{center_string(data[12], 14)}\n')
results_to_print += '\n'

print(results_to_print)
if not os.path.exists('reports'):
os.mkdir('reports')
with open(f'reports/tables_norm.txt', 'w') as file:
with open('reports/tables_norm.txt', 'w') as file:
file.write(results_to_print)


Expand Down Expand Up @@ -105,16 +109,31 @@ def main():
client_results[client][test_case_name][gas][method] = []
failed_tests[client][test_case_name][gas][method] = []
for run in range(1, runs + 1):
responses, results, timestamp = utils.extract_response_and_result(results_paths, client, test_case_name,
responses, results, timestamp, duration, fcu_duration, np_duration = utils.extract_response_and_result(results_paths, client, test_case_name,
gas, run, method, fields)
client_results[client][test_case_name][gas][method].append(results)
failed_tests[client][test_case_name][gas][method].append(not responses)
# print(test_case_name + " : " + str(timestamp))
if str(timestamp) != "0":
client_results[client][test_case_name]["timestamp"] = utils.convert_dotnet_ticks_to_utc(timestamp)
# Store raw timestamp in ticks for calculation, not converted string
client_results[client][test_case_name]["timestamp_ticks"] = timestamp
# Only store duration if non-zero to avoid overwriting valid values
if duration != 0:
client_results[client][test_case_name]["duration"] = duration
if fcu_duration != 0:
client_results[client][test_case_name]["fcu_duration"] = fcu_duration
if np_duration != 0:
client_results[client][test_case_name]["np_duration"] = np_duration
else:
if "timestamp" not in client_results[client][test_case_name]:
client_results[client][test_case_name]["timestamp"] = 0
if "timestamp_ticks" not in client_results[client][test_case_name]:
client_results[client][test_case_name]["timestamp_ticks"] = 0
# Initialize duration to 0 only if not set yet
if "duration" not in client_results[client][test_case_name]:
client_results[client][test_case_name]["duration"] = 0
if "fcu_duration" not in client_results[client][test_case_name]:
client_results[client][test_case_name]["fcu_duration"] = 0
if "np_duration" not in client_results[client][test_case_name]:
client_results[client][test_case_name]["np_duration"] = 0


gas_set = set()
Expand Down
Loading
Loading