diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4fe747..81f4a6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,6 +63,38 @@ jobs: --locked \ -- -D warnings + - name: Run clippy without default features + run: | + cargo clippy \ + --workspace \ + --all-targets \ + --no-default-features \ + --locked \ + -- -D warnings + + check: + name: cargo check + runs-on: ubuntu-latest + timeout-minutes: 20 + + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + persist-credentials: false + + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1 + with: + cache-key: check + + - name: Run check without default features + run: | + cargo check \ + --workspace \ + --no-default-features \ + --locked + test: name: cargo test runs-on: ubuntu-latest @@ -87,6 +119,13 @@ jobs: --all-features \ --locked + - name: Run tests without default features + run: | + cargo test \ + --workspace \ + --no-default-features \ + --locked + docs: name: cargo doc runs-on: ubuntu-latest diff --git a/README.md b/README.md index 443b6d2..3878e87 100644 --- a/README.md +++ b/README.md @@ -84,10 +84,16 @@ irtt-cli --duration 0 --interval 250ms --output machine Each line represents one client event and starts with an `event` field, for example: ```text -event=echo_reply seq=4 logical_seq=4 remote=203.0.113.10:2112 raw_rtt_us=12400 effective_rtt_us=12100 adjusted_rtt_us=12100 server_processing_us=300 dscp=0 ecn=0 kernel_rx_ns=none +event=echo_reply seq=4 remote=203.0.113.10:2112 client_send_wall_ns=1760000000000000000 client_receive_wall_ns=1760000000012400000 raw_rtt_us=12400 effective_rtt_us=12100 adjusted_rtt_us=12100 server_receive_wall_ns=1760000000006100000 server_receive_mono_ns=5000006100000 server_send_wall_ns=1760000000006400000 server_send_mono_ns=5000006400000 server_processing_us=300 client_to_server_us=6100 server_to_client_us=6000 server_received_count=5 server_received_window=0x1f dscp=0 ecn=0 kernel_rx_ns=none ``` Consumers should match on `event=...` and read the fields they need. Unknown fields should be ignored. +RTT fields are reported in microseconds. `raw_rtt_us` is the measured client +send-to-receive RTT. `effective_rtt_us` and `adjusted_rtt_us` are signed and may +be negative when server processing exceeds the raw RTT or timing correction +produces a negative adjusted value. When one-way delay fields are present, +`client_to_server_us` and `server_to_client_us` are also signed microseconds and +may be negative due to wall-clock skew. For consumers that only need RTT values, use: diff --git a/crates/irtt-cli/src/lib.rs b/crates/irtt-cli/src/lib.rs index 4ee268b..953f05e 100644 --- a/crates/irtt-cli/src/lib.rs +++ b/crates/irtt-cli/src/lib.rs @@ -894,7 +894,6 @@ mod tests { } } - #[cfg(feature = "stats")] fn negative_adjusted_reply_event() -> ClientEvent { ClientEvent::EchoReply { seq: 8, @@ -1233,6 +1232,22 @@ mod tests { ); } + #[test] + fn human_and_simple_print_negative_effective_rtt() { + let event = negative_adjusted_reply_event(); + + assert!(format_event(&event, OutputMode::Human) + .unwrap() + .contains("rtt=-1.5ms")); + assert_eq!( + format_event(&event, OutputMode::Simple), + Some( + "reply seq=8 remote=127.0.0.1:2112 rtt_us=-1500 raw_rtt_us=500 server_processing_us=2000" + .to_owned() + ) + ); + } + #[test] #[cfg(feature = "stats")] fn streamed_and_summary_rtt_use_signed_effective_policy() {