From 56e2309ca6623e17efe3d11ee2e918ceff3ed2cc Mon Sep 17 00:00:00 2001 From: namibj Date: Tue, 9 Feb 2021 04:57:44 +0000 Subject: [PATCH] Fix arrangement profiling's --output-interval (documentation and support for sub-second intervals). --- tdiag/src/commands/arrangements.rs | 14 +++++--------- tdiag/src/main.rs | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/tdiag/src/commands/arrangements.rs b/tdiag/src/commands/arrangements.rs index 7d9cc81..a2ebb3a 100644 --- a/tdiag/src/commands/arrangements.rs +++ b/tdiag/src/commands/arrangements.rs @@ -3,6 +3,7 @@ use std::sync::{Arc, Mutex}; use std::time::Duration; +use std::convert::TryFrom; use crate::DiagError; @@ -60,8 +61,6 @@ pub fn listen( ) .expect("failed to open differential tcp readers"); - let window_size = Duration::from_millis(output_interval_ms); - worker.dataflow::(|scope| { let operates = timely_replayer .replay_with_shutdown_into(scope, is_running_w.clone()) @@ -109,15 +108,12 @@ pub fn listen( }) .as_collection() .delay(move |t| { - let w_secs = window_size.as_secs(); + let timestamp: u64 = u64::try_from(t.as_millis()) + .expect("Why are the timestamps larger than humans are old?"); - let secs_coarsened = if w_secs == 0 { - t.as_secs() - } else { - (t.as_secs() / w_secs + 1) * w_secs - }; + let window_idx = (timestamp / output_interval_ms) + 1; - Duration::new(secs_coarsened, 0) + Duration::from_millis(window_idx * output_interval_ms) }) .count() .inner diff --git a/tdiag/src/main.rs b/tdiag/src/main.rs index 6eb870a..e4260e6 100644 --- a/tdiag/src/main.rs +++ b/tdiag/src/main.rs @@ -70,7 +70,7 @@ You can customize the interface and port for the receiver (this program) with -- .value_name("MS") .help("Interval (in ms) at which to print arrangement sizes; defaults to 1000ms") .default_value("1000")) - .help(" + .after_help(" Add the following snippet to your Differential computation: ```