[benchmark] Fix benchmark duration calculation logic (#4446)

* Fix benchmark duration calculation logic

Calculate benchmark duration using filtered outputs.

* Fix benchmark duration calculation using benchmark_outputs
This commit is contained in:
Zhang Yulong
2025-10-16 14:36:29 +08:00
committed by GitHub
parent a5063b96c8
commit 9dc3968c13

View File

@@ -474,8 +474,8 @@ async def benchmark(
benchmark_outputs = outputs[half : n - half] benchmark_outputs = outputs[half : n - half]
# 根据收到最后一个chunk的时间戳计算总时长 # 根据收到最后一个chunk的时间戳计算总时长
if len(outputs) >= 2: if len(benchmark_outputs) >= 2:
benchmark_duration = outputs[-1].end_timestamp - outputs[0].end_timestamp benchmark_duration = benchmark_outputs[-1].end_timestamp - benchmark_outputs[0].end_timestamp
else: else:
benchmark_duration = 0.0 benchmark_duration = 0.0