Track compaction time in turn profiles (#34835)

## What changed

- Add `compaction_ms` to turn profile facts and turn analytics events.
- Measure manual and automatic compaction as an exclusive profile phase instead of including it in surrounding idle time.
- Complete the profile and total turn duration from the same instant so their elapsed times remain consistent.

## Testing

- Cover compaction phase accounting and profile-duration consistency.
- Update turn event serialization coverage for `compaction_ms`.

GitOrigin-RevId: 50f0e1cf19789a807f9f56c2ef763c620a5d641c
This commit is contained in:
Ben Romano authored and copyberry committed 2026-07-22 22:13:02 +00:00
1 parent 88f1cd9664
commit bd5b55e403
9 files changed
+114 -18

No files matched your search

+1
View File
@@ -108,6 +108,7 @@ pub struct TurnTokenUsageFact {
pub struct TurnProfile {
pub before_first_sampling_ms: u64,
pub sampling_ms: u64,
pub compaction_ms: u64,
pub between_sampling_overhead_ms: u64,
pub tool_blocking_ms: u64,
pub after_last_sampling_ms: u64,