Add request-level timestamp for when prefill finishes (#14860)

This commit is contained in:
Scott Lee
2025-12-17 13:34:46 -08:00
committed by GitHub
parent 4128d4f5cb
commit 169a75dfb8
7 changed files with 42 additions and 6 deletions
+12
View File
@@ -64,6 +64,13 @@ class TimeStats:
prefill_start_time_host: float = 0.0
prefill_end_time_host: float = 0.0
# Timestamp when prefill phase finishes, obtained from `time.time()`.
# Note that this differs from the other `_time` fields tracked by the
# `TimeStats` class, which are obtained from `time.perf_counter()`.
# We use `time.time()` instead of `time.perf_counter()` here in order to
# maintain unit consistency with other timestamp fields tracked by the `ReqState` class.
prefill_finished_ts: float = 0.0
def get_queueing_time(self) -> float:
return self.forward_entry_time - self.wait_queue_entry_time
@@ -77,6 +84,11 @@ class TimeStats:
return self.prefill_end_time_host - self.prefill_start_time_host
return None
def get_prefill_finished_ts(self) -> Optional[float]:
if self.prefill_finished_ts > 0.0:
return self.prefill_finished_ts
return None
def convert_to_duration(self) -> str:
if self.disagg_mode == DisaggregationMode.NULL:
queue_duration = self.forward_entry_time - self.wait_queue_entry_time