Commit 2bbcd52
authored
Fix/streaming timestamps (#105)
* fix: Fix streaming output timestamps showing same second for all messages
Pass send timestamp to MessageLatencyRecord instead of capturing it when
the record is created. This makes the timestamp represent when the message
was sent, so gaps between timestamps now match the actual latency.
Changes:
- MessageLatencyRecord::new() and new_combined() now require send_timestamp_ns
parameter instead of capturing SystemTime::now() internally
- Added MessageLatencyRecord::current_timestamp_ns() helper for call sites
that need to capture the current wall-clock time
- Updated all streaming record creation sites in benchmark.rs and
benchmark_blocking.rs to capture and pass send timestamps
Cherry-picked from container-to-container-ipc branch (6cb8f9b).
Host-container-specific changes excluded (host_container.rs not present).
AI-assisted-by: Claude claude-4.6-opus-high-thinking (Anthropic)
Made-with: Cursor
* test/docs: Add streaming timestamp tests and sequential test execution documentation
- Add 3 new unit tests for MessageLatencyRecord timestamp handling:
test_new_uses_provided_send_timestamp, test_new_combined_uses_provided_send_timestamp,
test_current_timestamp_ns_returns_recent_value
- Add 2 end-to-end streaming tests in benchmark.rs:
test_one_way_streaming_captures_send_timestamp,
test_round_trip_streaming_captures_send_timestamp
- Document sequential one-way/round-trip test execution in README.md
(new "Test Execution Order" section), CONFIG.md, dashboard README,
and run() doc comments in benchmark.rs and benchmark_blocking.rs
- All 332 tests pass (331 passed, 1 ignored), zero clippy warnings
AI-assisted-by: Claude claude-4.6-opus-high-thinking
Made-with: Cursor
* fix: Capture streaming timestamps at message-send time for all code paths
The previous commit (68afe07) added a send_timestamp_ns parameter to
MessageLatencyRecord but only the blocking round-trip path was actually
capturing timestamps at send time. The async round-trip, async combined,
and all one-way paths were still using current_timestamp_ns() at
record-creation time (post-test), causing all timestamps within a run
to cluster into the same second.
Changes:
- Async round-trip: capture wall-clock timestamp inside the spawned
client future before each send(), return Vec<(Duration, u64)>
- Async combined: same pattern for one-way latency vector
- One-way (async + blocking): server now writes "wall_send_ns,latency_ns"
per line (wall_send_ns = wall_clock_now - latency); client readers
parse and use the server-computed send timestamp
- Add parse_latency_file_line() with 7 unit tests covering valid input,
missing commas, empty lines, non-numeric values, and extra commas
- Enhance existing end-to-end streaming tests to validate timestamps
fall within the test execution window and are not all identical
- Document streaming output column definitions in README.md including
timestamp_ns semantics and accuracy note for one-way clock mixing
All 265+ unit tests pass, clippy clean, no scope creep.
AI-assisted-by: Claude claude-4.6-opus-high-thinking (Anthropic)
Made-with: Cursor
* fix: Capture wall-clock timestamp immediately and trim latency lines
- Move SystemTime::now() capture to immediately after
get_monotonic_time_ns() in both blocking and async server paths,
eliminating minor drift from the should_buffer_latency branch
- Add .trim() to parse_latency_file_line() input for cross-platform
robustness against Windows \r\n line endings
- All tests passing
AI-assisted-by: Claude claude-4.6-opus-high-thinking
Made-with: Cursor1 parent ad0979e commit 2bbcd52
7 files changed
Lines changed: 500 additions & 69 deletions
File tree
- src
- utils/dashboard
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
36 | 44 | | |
37 | 45 | | |
38 | 46 | | |
| |||
166 | 174 | | |
167 | 175 | | |
168 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
169 | 195 | | |
170 | 196 | | |
171 | 197 | | |
| |||
179 | 205 | | |
180 | 206 | | |
181 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
182 | 230 | | |
183 | 231 | | |
184 | 232 | | |
| |||
390 | 438 | | |
391 | 439 | | |
392 | 440 | | |
393 | | - | |
| 441 | + | |
| 442 | + | |
394 | 443 | | |
395 | 444 | | |
396 | 445 | | |
| |||
0 commit comments