Skip to content

Commit d682d02

Browse files
committed
Added FCU and NP duration time column
1 parent 4e79479 commit d682d02

File tree

5 files changed

+65
-12
lines changed

5 files changed

+65
-12
lines changed

fill_postgres_db.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ def load_aggregated_stats(output_csv_path: str) -> Dict[str, Dict[str, Any]]:
286286
'start_time': row.get('Start Time') if row.get('Start Time') else None,
287287
'end_time': row.get('End Time') if row.get('End Time') else None,
288288
'test_duration': float(row['Duration (ms)']) if row.get('Duration (ms)') and row['Duration (ms)'].strip() else None,
289+
'fcu_duration': float(row['FCU time (ms)']) if row.get('FCU time (ms)') and row['FCU time (ms)'].strip() else None,
290+
'np_duration': float(row['NP time (ms)']) if row.get('NP time (ms)') and row['NP time (ms)'].strip() else None,
289291
'test_description': row.get('Description')
290292
}
291293
except ValueError as ve:
@@ -480,6 +482,8 @@ def populate_data_for_client(
480482
end_time = None
481483

482484
test_duration = agg_stats.get('test_duration')
485+
fcu_duration = agg_stats.get('fcu_duration')
486+
np_duration = agg_stats.get('np_duration')
483487

484488
record: Dict[str, Any] = {
485489
'client_name': client_name,
@@ -499,6 +503,8 @@ def populate_data_for_client(
499503
'start_time': start_time,
500504
'end_time': end_time,
501505
'test_duration': test_duration,
506+
'fcu_duration': fcu_duration,
507+
'np_duration': np_duration,
502508
**computer_specs
503509
}
504510
records_to_insert.append(record)

generate_postgres_schema.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ def get_sql_for_benchmark_table(table_name: str) -> str:
3737
raw_run_duration_ms REAL NULL, -- Execution duration in milliseconds for this specific run
3838
raw_run_description TEXT NULL, -- Description from the raw_*.csv row, potentially more specific
3939
40-
-- Test execution timestamps
40+
-- Test execution timestamps and durations
4141
start_time TIMESTAMP WITH TIME ZONE NULL, -- Test start timestamp
4242
end_time TIMESTAMP WITH TIME ZONE NULL, -- Test end timestamp
4343
test_duration REAL NULL, -- Test duration in milliseconds
44+
fcu_duration REAL NULL, -- FCU (engine_forkchoiceUpdatedV3) duration in milliseconds
45+
np_duration REAL NULL, -- NP (engine_newPayloadV4) duration in milliseconds
4446
4547
-- Computer Specifications (parsed from system info, repeated per row, all nullable)
4648
spec_processor_type TEXT NULL,
@@ -94,6 +96,8 @@ def execute_sql_on_db(db_params: Dict[str, Any], table_name: str) -> None:
9496
("raw_run_duration_ms", "REAL NULL"),
9597
("end_time", "TIMESTAMP WITH TIME ZONE NULL"),
9698
("test_duration", "REAL NULL"),
99+
("fcu_duration", "REAL NULL"),
100+
("np_duration", "REAL NULL"),
97101
# Add other columns here in the future for schema evolution
98102
# e.g., ("new_feature_flag", "BOOLEAN DEFAULT FALSE")
99103
]

report_html.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ def get_html_report(client_results, clients, results_paths, test_cases, methods,
7676
'<th>Start Time</th>\n'
7777
'<th>End Time</th>\n'
7878
f'<th onclick="sortTable(10, \'table_{client}\', true)" style="cursor: pointer;">Duration (ms) &uarr; &darr;</th>\n'
79+
f'<th onclick="sortTable(11, \'table_{client}\', true)" style="cursor: pointer;">FCU time (ms) &uarr; &darr;</th>\n'
80+
f'<th onclick="sortTable(12, \'table_{client}\', true)" style="cursor: pointer;">NP time (ms) &uarr; &darr;</th>\n'
7981
'</tr>\n'
8082
'</thread>\n'
8183
'<tbody>\n')
@@ -92,7 +94,9 @@ def get_html_report(client_results, clients, results_paths, test_cases, methods,
9294
f'<td style="text-align:left;" >{data[7]}</td>\n'
9395
f'<td>{data[8]}</td>\n'
9496
f'<td>{data[9]}</td>\n'
95-
f'<td>{data[10]}</td>\n</tr>\n')
97+
f'<td>{data[10]}</td>\n'
98+
f'<td>{data[11]}</td>\n'
99+
f'<td>{data[12]}</td>\n</tr>\n')
96100
results_to_print += '\n'
97101
results_to_print += ('</table>\n'
98102
'</tbody>\n')
@@ -166,9 +170,9 @@ def get_html_report(client_results, clients, results_paths, test_cases, methods,
166170
csvwriter = csv.writer(csvfile)
167171
csvwriter.writerow(
168172
['Title', 'Max (MGas/s)', 'p50 (MGas/s)', 'p95 (MGas/s)', 'p99 (MGas/s)', 'Min (MGas/s)', 'N',
169-
'Description', "Start Time", "End Time", "Duration (ms)"])
173+
'Description', "Start Time", "End Time", "Duration (ms)", "FCU time (ms)", "NP time (ms)"])
170174
for test_case, data in gas_table.items():
171-
csvwriter.writerow([data[0], data[2], data[3], data[4], data[5], data[1], data[6], data[7], data[8], data[9], data[10]])
175+
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]])
172176

173177

174178
def main():
@@ -217,7 +221,7 @@ def main():
217221
client_results[client][test_case_name][gas][method] = []
218222
failed_tests[client][test_case_name][gas][method] = []
219223
for run in range(1, runs + 1):
220-
responses, results, timestamp, duration = utils.extract_response_and_result(results_paths, client, test_case_name,
224+
responses, results, timestamp, duration, fcu_duration, np_duration = utils.extract_response_and_result(results_paths, client, test_case_name,
221225
gas, run, method, fields)
222226
client_results[client][test_case_name][gas][method].append(results)
223227
failed_tests[client][test_case_name][gas][method].append(not responses)
@@ -228,12 +232,20 @@ def main():
228232
# Only store duration if non-zero to avoid overwriting valid values
229233
if duration != 0:
230234
client_results[client][test_case_name]["duration"] = duration
235+
if fcu_duration != 0:
236+
client_results[client][test_case_name]["fcu_duration"] = fcu_duration
237+
if np_duration != 0:
238+
client_results[client][test_case_name]["np_duration"] = np_duration
231239
else:
232240
if "timestamp_ticks" not in client_results[client][test_case_name]:
233241
client_results[client][test_case_name]["timestamp_ticks"] = 0
234242
# Initialize duration to 0 only if not set yet
235243
if "duration" not in client_results[client][test_case_name]:
236244
client_results[client][test_case_name]["duration"] = 0
245+
if "fcu_duration" not in client_results[client][test_case_name]:
246+
client_results[client][test_case_name]["fcu_duration"] = 0
247+
if "np_duration" not in client_results[client][test_case_name]:
248+
client_results[client][test_case_name]["np_duration"] = 0
237249

238250
gas_set = set()
239251
for test_case_name, test_case_gas in test_cases.items():

report_tables.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def get_table_report(client_results, clients, results_paths, test_cases, methods
2323
image_to_print = el_images[client_without_tag]
2424
results_to_print += f'{client.capitalize()} - {image_to_print} - Benchmarking Report' + '\n'
2525
results_to_print += (center_string('Title',
26-
68) + '| Min (MGas/s) | Max (MGas/s) | p50 (MGas/s) | p95 (MGas/s) | p99 (MGas/s) | N | Description | Start time | End time | Duration (ms)\n')
26+
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')
2727
gas_table_norm = utils.get_gas_table(client_results, client, test_cases, gas_set, methods[0], metadata)
2828
for test_case, data in gas_table_norm.items():
2929
results_to_print += (f'{align_left_string(data[0], 68)}|'
@@ -36,7 +36,9 @@ def get_table_report(client_results, clients, results_paths, test_cases, methods
3636
f'{align_left_string(data[7], 50)}|'
3737
f'{data[8]}|'
3838
f'{data[9]}|'
39-
f'{center_string(data[10], 14)}\n')
39+
f'{center_string(data[10], 14)}|'
40+
f'{center_string(data[11], 15)}|'
41+
f'{center_string(data[12], 14)}\n')
4042
results_to_print += '\n'
4143

4244
print(results_to_print)
@@ -107,7 +109,7 @@ def main():
107109
client_results[client][test_case_name][gas][method] = []
108110
failed_tests[client][test_case_name][gas][method] = []
109111
for run in range(1, runs + 1):
110-
responses, results, timestamp, duration = utils.extract_response_and_result(results_paths, client, test_case_name,
112+
responses, results, timestamp, duration, fcu_duration, np_duration = utils.extract_response_and_result(results_paths, client, test_case_name,
111113
gas, run, method, fields)
112114
client_results[client][test_case_name][gas][method].append(results)
113115
failed_tests[client][test_case_name][gas][method].append(not responses)
@@ -118,12 +120,20 @@ def main():
118120
# Only store duration if non-zero to avoid overwriting valid values
119121
if duration != 0:
120122
client_results[client][test_case_name]["duration"] = duration
123+
if fcu_duration != 0:
124+
client_results[client][test_case_name]["fcu_duration"] = fcu_duration
125+
if np_duration != 0:
126+
client_results[client][test_case_name]["np_duration"] = np_duration
121127
else:
122128
if "timestamp_ticks" not in client_results[client][test_case_name]:
123129
client_results[client][test_case_name]["timestamp_ticks"] = 0
124130
# Initialize duration to 0 only if not set yet
125131
if "duration" not in client_results[client][test_case_name]:
126132
client_results[client][test_case_name]["duration"] = 0
133+
if "fcu_duration" not in client_results[client][test_case_name]:
134+
client_results[client][test_case_name]["fcu_duration"] = 0
135+
if "np_duration" not in client_results[client][test_case_name]:
136+
client_results[client][test_case_name]["np_duration"] = 0
127137

128138

129139
gas_set = set()

utils.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def extract_response_and_result(results_path, client, test_case_name, gas_used,
8484
print(f"Method '{method_key}' not found in sections for file {result_file}. Available methods: {list(sections.keys())}")
8585
# Get timestamp from first available section, or 0 if no sections exist
8686
timestamp = getattr(next(iter(sections.values())), 'timestamp', 0) if sections else 0
87-
return False, 0, timestamp, 0
87+
return False, 0, timestamp, 0, 0, 0
8888
result = sections[method_key].fields[field]
8989
timestamp = getattr(sections[method_key], 'timestamp', 0)
9090
# Extract total running time if available (in milliseconds)
@@ -93,7 +93,22 @@ def extract_response_and_result(results_path, client, test_case_name, gas_used,
9393
total_running_time_section = sections['[Application] Total Running Time']
9494
if 'sum' in total_running_time_section.fields:
9595
total_running_time_ms = float(total_running_time_section.fields['sum'])
96-
return response, float(result), timestamp, total_running_time_ms
96+
97+
# Extract FCU (engine_forkchoiceUpdatedV3) duration
98+
fcu_duration_ms = 0
99+
if '[Application] engine_forkchoiceUpdatedV3' in sections:
100+
fcu_section = sections['[Application] engine_forkchoiceUpdatedV3']
101+
if 'sum' in fcu_section.fields:
102+
fcu_duration_ms = float(fcu_section.fields['sum'])
103+
104+
# Extract NP (engine_newPayloadV4) duration
105+
np_duration_ms = 0
106+
if '[Application] engine_newPayloadV4' in sections:
107+
np_section = sections['[Application] engine_newPayloadV4']
108+
if 'sum' in np_section.fields:
109+
np_duration_ms = float(np_section.fields['sum'])
110+
111+
return response, float(result), timestamp, total_running_time_ms, fcu_duration_ms, np_duration_ms
97112

98113

99114
def get_gas_table(client_results, client, test_cases, gas_set, method, metadata):
@@ -113,11 +128,13 @@ def get_gas_table(client_results, client, test_cases, gas_set, method, metadata)
113128

114129
for test_case, _ in test_cases.items():
115130
results_norm = results_per_test_case[test_case]
116-
gas_table_norm[test_case] = ['' for _ in range(11)]
131+
gas_table_norm[test_case] = ['' for _ in range(13)]
117132
# test_case_name, description, N, MGgas/s, mean, max, min. std, p50, p95, p99
118-
# (norm) title, description, N , max, min, p50, p95, p99, start_time, end_time, duration_ms
133+
# (norm) title, description, N , max, min, p50, p95, p99, start_time, end_time, duration_ms, fcu_duration_ms, np_duration_ms
119134
timestamp_ticks = client_results[client][test_case]["timestamp_ticks"] if client_results[client][test_case] and "timestamp_ticks" in client_results[client][test_case] else 0
120135
duration_ms = client_results[client][test_case]["duration"] if client_results[client][test_case] and "duration" in client_results[client][test_case] else 0
136+
fcu_duration_ms = client_results[client][test_case]["fcu_duration"] if client_results[client][test_case] and "fcu_duration" in client_results[client][test_case] else 0
137+
np_duration_ms = client_results[client][test_case]["np_duration"] if client_results[client][test_case] and "np_duration" in client_results[client][test_case] else 0
121138

122139
# Convert start timestamp to formatted string
123140
start_time_str = convert_dotnet_ticks_to_utc(timestamp_ticks) if timestamp_ticks != 0 else 0
@@ -135,6 +152,10 @@ def get_gas_table(client_results, client, test_cases, gas_set, method, metadata)
135152

136153
# Store duration in milliseconds
137154
gas_table_norm[test_case][10] = f'{duration_ms:.2f}' if duration_ms != 0 else '0'
155+
156+
# Store FCU and NP durations
157+
gas_table_norm[test_case][11] = f'{fcu_duration_ms:.2f}' if fcu_duration_ms != 0 else '0'
158+
gas_table_norm[test_case][12] = f'{np_duration_ms:.2f}' if np_duration_ms != 0 else '0'
138159

139160
if test_case in metadata:
140161
gas_table_norm[test_case][0] = metadata[test_case]['Title']

0 commit comments

Comments
 (0)