fix prefill tps log accuracy (#22497)

This commit is contained in:
Zhai Feiyue
2026-04-11 23:07:30 -07:00
committed by GitHub
parent c6fd9a00c7
commit 52750129ef
@@ -97,7 +97,6 @@ class SchedulerMetricsMixin:
self.num_generated_tokens = 0
self.last_decode_stats_tic = time.perf_counter()
self.last_prefill_stats_tic = time.perf_counter()
self.last_prefill_tokens = 0
self.last_gen_throughput: float = 0.0
self.last_input_throughput: float = 0.0
self.step_time_dict = defaultdict(list) # Dict[batch size -> step time]
@@ -337,10 +336,12 @@ class SchedulerMetricsMixin:
):
return
gap_latency = time.perf_counter() - self.last_prefill_stats_tic
self.last_prefill_stats_tic = time.perf_counter()
self.last_input_throughput = self.last_prefill_tokens / gap_latency
self.last_prefill_tokens = prefill_stats.log_input_tokens
now = time.perf_counter()
gap_latency = now - self.last_prefill_stats_tic
self.last_prefill_stats_tic = now
self.last_input_throughput = (
prefill_stats.log_input_tokens / gap_latency if gap_latency > 0 else 0.0
)
pool_stats = self.get_pool_stats()
token_usage_msg = ", ".join(pool_stats.get_prefill_usage_msg_parts()) + ", "