Prove the steady cost by count, redraw the bootstrap once a minute, tidy

A test fills a history with a row a minute for thirty days (43,199 rows,
4,319 build observations) in one transaction, runs two polls and asserts
the second hands out fewer than 3,000 rows; it measures 1,567 (the first
reads every observation once). History::fill saves a run of readings as
the polls would have.

While a build keeps adding observations, they are stored at once but the
bootstrap and the histogram are redrawn at most once a minute.

A saving is never negative or a negative zero.

History::rows and History::build_observations are gone, with the tests
that only used them. History::first_row stays: without it the chart of
the reset range, on a database that never saw a zeroing, would start at
the live reading instead of at the first row.

The timing line is logged for the first two polls.
This commit is contained in:
swaits committed 2026-11-28 12:07:56 -07:00
1 parent 7ab1543315
commit 693dca6cdf
4 files changed
+270 -96

No files matched your search

+11 -7
View File
@@ -80,8 +80,10 @@ pub struct State {
/// handed out for it: a count of the work, which does not depend on how busy the machine is. /// handed out for it: a count of the work, which does not depend on how busy the machine is.
pub views_took: Duration, pub views_took: Duration,
pub views_rows: usize, pub views_rows: usize,
/// Whether a failure to save, and the first timing, have already been reported. /// Whether a failure to save has already been reported.
pub reported: bool, pub warned: bool,
/// How many polls have had their timing reported: the first two.
pub reported: u8,
} }
/// Whether an sccache server is listening. /// Whether an sccache server is listening.
@@ -258,8 +260,8 @@ impl Task {
if let Some(counters) = state.live.as_ref().map(|l| l.snapshot.counters.clone()) { if let Some(counters) = state.live.as_ref().map(|l| l.snapshot.counters.clone()) {
match self.history.record(&mut state.tracker, &counters, now) { match self.history.record(&mut state.tracker, &counters, now) {
Ok(()) => {} Ok(()) => {}
Err(e) if !state.reported => { Err(e) if !state.warned => {
state.reported = true; state.warned = true;
eprintln!( eprintln!(
"sccache-dash: cannot save history to {}: {e}", "sccache-dash: cannot save history to {}: {e}",
app.cfg.history.display() app.cfg.history.display()
@@ -270,12 +272,14 @@ impl Task {
} }
let started = Instant::now(); let started = Instant::now();
self.history.take_fetched(); self.history.take_fetched();
self.builds.refresh(&self.history); self.builds.refresh(&self.history, now);
state.views = view::all(&self.history, &self.builds, &state, now); state.views = view::all(&self.history, &self.builds, &state, now);
state.views_took = started.elapsed(); state.views_took = started.elapsed();
state.views_rows = self.history.take_fetched(); state.views_rows = self.history.take_fetched();
if !state.reported { // Reported for the first two polls: the first reads the build observations and draws the
state.reported = true; // bootstrap, the second shows what every later poll costs.
if state.reported < 2 {
state.reported += 1;
eprintln!( eprintln!(
"sccache-dash: {} rows of history in {}; the five views take {:.2} ms and {} rows per poll", "sccache-dash: {} rows of history in {}; the five views take {:.2} ms and {} rows per poll",
self.history.row_count().unwrap_or(0), self.history.row_count().unwrap_or(0),
+12 -64
View File
@@ -3,7 +3,6 @@
//! at most one a minute and only when sccache's counters changed; a stretch without rows is a gap. //! at most one a minute and only when sccache's counters changed; a stretch without rows is a gap.
use std::cell::Cell; use std::cell::Cell;
use std::collections::BTreeMap;
use std::path::Path; use std::path::Path;
use std::time::Duration; use std::time::Duration;
@@ -57,16 +56,6 @@ CREATE TABLE IF NOT EXISTS build_obs (t INTEGER NOT NULL, language TEXT NOT NULL
CREATE INDEX IF NOT EXISTS build_obs_language ON build_obs (language); CREATE INDEX IF NOT EXISTS build_obs_language ON build_obs (language);
CREATE TABLE IF NOT EXISTS state (key TEXT PRIMARY KEY, value TEXT NOT NULL) WITHOUT ROWID;"; CREATE TABLE IF NOT EXISTS state (key TEXT PRIMARY KEY, value TEXT NOT NULL) WITHOUT ROWID;";
/// One point of the histogram of build times: the builds of one language that finished between
/// two polls ten seconds apart.
#[derive(Clone, Debug, PartialEq)]
pub struct BuildObs {
pub t: i64,
pub language: String,
pub compiles: u64,
pub seconds: f64,
}
/// What is remembered between polls, so that differences survive a restart of sccache-dash. /// What is remembered between polls, so that differences survive a restart of sccache-dash.
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct Tracker { pub struct Tracker {
@@ -187,6 +176,17 @@ impl History {
Ok(()) Ok(())
} }
/// Saves a run of readings exactly as the polls would have, in one transaction.
pub fn fill(&self, readings: &[(i64, Counters)]) -> rusqlite::Result<()> {
self.conn.execute_batch("BEGIN")?;
let mut tracker = self.tracker();
let result = readings
.iter()
.try_for_each(|(t, c)| self.record(&mut tracker, c, *t));
self.conn.execute_batch("COMMIT")?;
result
}
/// What the previous run of sccache-dash remembered, so that it carries on where it stopped. /// What the previous run of sccache-dash remembered, so that it carries on where it stopped.
pub fn tracker(&self) -> Tracker { pub fn tracker(&self) -> Tracker {
self.state("tracker").unwrap_or_default() self.state("tracker").unwrap_or_default()
@@ -279,33 +279,6 @@ impl History {
}) })
} }
/// The rows from `from` (inclusive) to `to` (exclusive), oldest first, each with what had
/// changed since the row before.
pub fn rows(&self, from: i64, to: i64) -> rusqlite::Result<Vec<Row>> {
let sql = format!(
"SELECT t, reset{NAMES}, compilations, hit_read, cache_write, compile FROM readings WHERE t >= ?1 AND t < ?2 ORDER BY t"
);
let mut stmt = self.conn.prepare(&sql)?;
let rows = stmt.query_map(params![from, to], |row| {
let nanos = |name: &str| -> rusqlite::Result<u64> {
Ok((row.get::<_, f64>(name)? * NANOS).round().max(0.0) as u64)
};
Ok(Row {
t: row.get("t")?,
reset: row.get::<_, i64>("reset")? != 0,
delta: Counters {
totals: each!(totals_of!(row)),
compilations: row.get::<_, i64>("compilations")?.max(0) as u64,
ns: [nanos("hit_read")?, nanos("cache_write")?, nanos("compile")?],
..Counters::default()
},
})
})?;
let rows = rows.collect::<rusqlite::Result<Vec<_>>>()?;
self.count(rows.len());
Ok(rows)
}
/// The chart's counts, one row per bucket: bucket `b` holds the rows dated from /// The chart's counts, one row per bucket: bucket `b` holds the rows dated from
/// `from + b * len` on, for `t` below `to`. /// `from + b * len` on, for `t` below `to`.
pub fn bucket_rows(&self, from: i64, len: i64, to: i64) -> rusqlite::Result<Vec<BucketRow>> { pub fn bucket_rows(&self, from: i64, len: i64, to: i64) -> rusqlite::Result<Vec<BucketRow>> {
@@ -398,7 +371,7 @@ impl History {
}) })
} }
/// The oldest row there is. /// The oldest row there is: where the `reset` chart starts when no zeroing was ever seen.
pub fn first_row(&self) -> rusqlite::Result<Option<i64>> { pub fn first_row(&self) -> rusqlite::Result<Option<i64>> {
self.count(1); self.count(1);
self.conn self.conn
@@ -454,29 +427,4 @@ impl History {
self.count(out.len()); self.count(out.len());
Ok(out) Ok(out)
} }
/// The build-time observations, per language and oldest first: the raw data of the histogram.
pub fn build_observations(&self) -> rusqlite::Result<BTreeMap<String, Vec<BuildObs>>> {
let mut stmt = self
.conn
.prepare("SELECT t, language, compiles, seconds FROM build_obs ORDER BY language, t")?;
let out = stmt.query_map([], |row| {
Ok(BuildObs {
t: row.get(0)?,
language: row.get(1)?,
compiles: row.get::<_, i64>(2)?.max(0) as u64,
seconds: row.get(3)?,
})
})?;
let mut by_language: BTreeMap<String, Vec<BuildObs>> = BTreeMap::new();
for obs in out {
let obs = obs?;
by_language
.entry(obs.language.clone())
.or_default()
.push(obs);
}
self.count(by_language.values().map(Vec::len).sum());
Ok(by_language)
}
} }
+91 -6
View File
@@ -28,6 +28,9 @@ pub mod levels {
pub const RUNNING_WINDOW: Duration = Duration::from_secs(5 * 60); pub const RUNNING_WINDOW: Duration = Duration::from_secs(5 * 60);
/// The chart has at most this many buckets. /// The chart has at most this many buckets.
pub const BUCKETS: i64 = 120; pub const BUCKETS: i64 = 120;
/// The build-time bootstrap is drawn again at most this often, however many observations
/// a build in flight keeps adding.
pub const BOOTSTRAP_EVERY_SECS: i64 = 60;
/// While anything changes a row comes at least this often, so a bucket with no row between /// While anything changes a row comes at least this often, so a bucket with no row between
/// two rows further apart than this is a gap. /// two rows further apart than this is a gap.
pub const GAP_SECS: i64 = 120; pub const GAP_SECS: i64 = 120;
@@ -67,6 +70,8 @@ pub struct Builds {
draws: Resampled, draws: Resampled,
/// (how many observations there are, when the newest is dated) this was made from. /// (how many observations there are, when the newest is dated) this was made from.
stamp: Option<(i64, i64)>, stamp: Option<(i64, i64)>,
/// When the bootstrap was last drawn.
drawn_at: Option<i64>,
} }
impl Default for Builds { impl Default for Builds {
@@ -85,16 +90,25 @@ impl Builds {
means: Vec::new(), means: Vec::new(),
draws: Resampled::new(&[]), draws: Resampled::new(&[]),
stamp: None, stamp: None,
drawn_at: None,
} }
} }
/// Takes in any observations added since the last look, and when there are some works out /// Takes in any observations added since the last look, and when there are some works out
/// the histograms and draws the bootstrap again: once per change, not once per range. /// the histograms and draws the bootstrap again: once per change, not once per range.
pub fn refresh(&mut self, h: &History) { pub fn refresh(&mut self, h: &History, now: i64) {
let stamp = soft(h.build_obs_stamp()); let stamp = soft(h.build_obs_stamp());
if self.stamp == Some(stamp) { if self.stamp == Some(stamp) {
return; return;
} }
// Observations were added, but the bootstrap was drawn less than a minute ago: they wait
// for that beat, so that a build in flight does not have it redrawn on every poll.
if self
.drawn_at
.is_some_and(|at| now - at < levels::BOOTSTRAP_EVERY_SECS)
{
return;
}
let added = match self.stamp { let added = match self.stamp {
// Rows were only added: read just those. // Rows were only added: read just those.
Some((count, newest)) if stamp.0 > count && stamp.1 >= newest => { Some((count, newest)) if stamp.0 > count && stamp.1 >= newest => {
@@ -133,6 +147,7 @@ impl Builds {
self.draws = Resampled::new(&obs); self.draws = Resampled::new(&obs);
self.times = times; self.times = times;
self.stamp = Some(stamp); self.stamp = Some(stamp);
self.drawn_at = Some(now);
} }
/// Time saved for one range's hits, from the draws already made. /// Time saved for one range's hits, from the draws already made.
@@ -165,7 +180,9 @@ impl Builds {
/// What one hit of this language saves on average, for the chart; `None` when the language /// What one hit of this language saves on average, for the chart; `None` when the language
/// is left out. /// is left out.
fn saving(&self, language: &str, hit_read: f64) -> Option<f64> { fn saving(&self, language: &str, hit_read: f64) -> Option<f64> {
Some((self.means[self.languages.iter().position(|l| l == language)?]? - hit_read).max(0.0)) Some(positive(
self.means[self.languages.iter().position(|l| l == language)?]? - hit_read,
))
} }
/// How the figure was reached, in plain words with the numbers used. /// How the figure was reached, in plain words with the numbers used.
@@ -235,6 +252,15 @@ impl Builds {
} }
} }
/// A saving is never negative, and never a negative zero (which JSON would print as `-0.0`).
fn positive(value: f64) -> f64 {
if value > 0.0 {
value
} else {
0.0
}
}
/// Whether a language has seen enough usable observations for its saving to be counted. /// Whether a language has seen enough usable observations for its saving to be counted.
fn counted(obs: &[Observation]) -> bool { fn counted(obs: &[Observation]) -> bool {
obs.iter() obs.iter()
@@ -626,9 +652,11 @@ fn compute(
let hit_read = per(counters.ns[HIT_READ], t.hits).unwrap_or(0.0) / 1e3; let hit_read = per(counters.ns[HIT_READ], t.hits).unwrap_or(0.0) / 1e3;
let saved = builds.saved(&counters.langs, hit_read); let saved = builds.saved(&counters.langs, hit_read);
let time_saved = TimeSaved { let time_saved = TimeSaved {
seconds: saved.seconds, seconds: positive(saved.seconds),
hits_left_out: saved.hits_left_out, hits_left_out: saved.hits_left_out,
interval_90: saved.interval_90, interval_90: saved
.interval_90
.map(|(lo, hi)| (positive(lo), positive(hi))),
note: builds.note(&counters.langs, hit_read, &saved), note: builds.note(&counters.langs, hit_read, &saved),
}; };
let mut languages: Vec<Language> = counters let mut languages: Vec<Language> = counters
@@ -706,6 +734,7 @@ mod tests {
} }
const LIVE: &str = include_str!("../../../fixtures/live-0.18.0.json"); const LIVE: &str = include_str!("../../../fixtures/live-0.18.0.json");
const NOW: i64 = 100_000;
/// A reading with these totals, all of it Rust, taking 1 s per hit read, 1 s per cache /// A reading with these totals, all of it Rust, taking 1 s per hit read, 1 s per cache
/// write and 60 s per compile. /// write and 60 s per compile.
@@ -766,7 +795,7 @@ mod tests {
}); });
} }
let mut builds = Builds::new(); let mut builds = Builds::new();
builds.refresh(&history); builds.refresh(&history, NOW);
Scene { Scene {
history, history,
builds, builds,
@@ -1121,7 +1150,7 @@ mod tests {
..State::default() ..State::default()
}; };
let mut builds = Builds::new(); let mut builds = Builds::new();
builds.refresh(&history); builds.refresh(&history, NOW);
let mut scene = Scene { let mut scene = Scene {
history, history,
builds, builds,
@@ -1160,6 +1189,62 @@ mod tests {
); );
} }
#[test]
fn an_empty_range_saves_exactly_zero_never_a_negative_zero() {
let c = |misses: u64| Counters {
totals: Totals {
requests: misses,
misses,
cache_writes: misses,
..Totals::default()
},
compilations: misses,
ns: [0, 0, misses * 60_000_000_000],
langs: vec![("Rust".to_owned(), [0, misses, 0])],
..Counters::default()
};
// Twelve polls after each of which one Rust build finished: enough to count Rust. Then a
// live reading with no hit anywhere.
let history = History::memory().unwrap();
let mut tracker = Tracker::default();
for step in 0..12u64 {
history
.record(&mut tracker, &c(step), (step * 10) as i64)
.unwrap();
}
let live = Live {
at: 130,
snapshot: stats::Snapshot {
counters: c(11),
..Default::default()
},
raw_text: String::new(),
};
let state = State {
tracker: history.tracker(),
live: Some(live),
..State::default()
};
let mut builds = Builds::new();
builds.refresh(&history, 130);
assert_eq!(builds.times[0].compiles, 11, "Rust is counted");
let views = all(&history, &builds, &state, 130);
for (range, v) in Range::ALL.iter().zip(&views) {
let ts = &v.time_saved;
assert_eq!((ts.seconds, ts.hits_left_out), (0.0, 0), "{range:?}");
assert!(!ts.seconds.is_sign_negative(), "{range:?}: {}", ts.seconds);
let json = serde_json::to_string(ts).unwrap();
assert!(!json.contains('-'), "{range:?}: no minus sign in {json}");
assert!(
v.buckets
.iter()
.all(|b| b.saved_seconds == 0.0 && !b.saved_seconds.is_sign_negative()),
"{range:?}"
);
}
}
#[test] #[test]
fn time_saved_is_zero_and_explained_when_nothing_is_learned() { fn time_saved_is_zero_and_explained_when_nothing_is_learned() {
let assembler = |hits: u64| Counters { let assembler = |hits: u64| Counters {
+156 -19
View File
@@ -217,14 +217,15 @@ fn zero_from_the_dashboard_zeroes_sccache_and_keeps_the_history() {
1, 1,
"the history stays, and the zeroing is one more row" "the history stays, and the zeroing is one more row"
); );
let row = &task.history.rows(0, i64::MAX).unwrap()[0]; assert!(
assert!(row.reset, "the zeroing shows in the history as a reset"); task.history.last_reset().unwrap().is_some(),
"the zeroing shows in the history as a reset"
);
assert_eq!( assert_eq!(
row.delta, task.history.sums(0, i64::MAX).unwrap(),
stats::Counters::default(), Some(stats::Counters::default()),
"nothing has been compiled since" "nothing has been compiled since"
); );
assert_eq!(task.history.last_reset().unwrap(), Some(row.t));
let v = app.view(Range::SinceReset); let v = app.view(Range::SinceReset);
assert_eq!( assert_eq!(
@@ -331,10 +332,19 @@ fn rows_are_saved_when_counters_change_and_at_most_once_a_minute() {
1, 1,
"a minute on, the change is saved" "a minute on, the change is saved"
); );
let row = &task.history.rows(0, i64::MAX).unwrap()[0];
assert_eq!( assert_eq!(
(row.t, row.delta.totals.requests, row.reset), task.history
(NOW + 60, 1, false) .sums(0, i64::MAX)
.unwrap()
.unwrap()
.totals
.requests,
1
);
assert_eq!(
task.history.last_reset().unwrap(),
None,
"a change is not a reset"
); );
task.poll(&app, NOW + 700); task.poll(&app, NOW + 700);
@@ -344,7 +354,7 @@ fn rows_are_saved_when_counters_change_and_at_most_once_a_minute() {
"unchanged: nothing more is saved, however long the quiet lasts" "unchanged: nothing more is saved, however long the quiet lasts"
); );
assert!( assert!(
task.history.build_observations().unwrap().is_empty(), task.history.build_obs_stamp().unwrap() == (0, 0),
"and with no misses there is no build observation" "and with no misses there is no build observation"
); );
assert_eq!(app.lock().views.len(), 5, "every poll makes the five views"); assert_eq!(app.lock().views.len(), 5, "every poll makes the five views");
@@ -380,9 +390,11 @@ fn the_history_survives_a_restart_in_its_file() {
let mut c = b.clone(); let mut c = b.clone();
c.totals.requests += 5; c.totals.requests += 5;
history.record(&mut tracker, &c, NOW + 70).unwrap(); history.record(&mut tracker, &c, NOW + 70).unwrap();
let rows = history.rows(0, i64::MAX).unwrap(); assert_eq!(history.row_count().unwrap(), 1);
assert_eq!(rows.len(), 1); assert_eq!(
assert_eq!((rows[0].t, rows[0].delta.totals.requests), (NOW + 70, 5)); history.sums(0, i64::MAX).unwrap().unwrap().totals.requests,
5
);
assert_eq!( assert_eq!(
app.view(Range::Day).range, app.view(Range::Day).range,
Some(Range::Day), Some(Range::Day),
@@ -418,13 +430,12 @@ fn old_rows_are_deleted_at_startup() {
1, 1,
"the one row older than 30 days" "the one row older than 30 days"
); );
let left: Vec<i64> = history assert_eq!(history.row_count().unwrap(), 3);
.rows(0, i64::MAX) assert_eq!(
.unwrap() history.first_row().unwrap(),
.iter() Some(NOW - 30 * day + 3600),
.map(|r| r.t) "the oldest row left"
.collect(); );
assert_eq!(left, vec![NOW - 30 * day + 3600, NOW - 3600, NOW]);
assert_eq!(history.prune(NOW).unwrap(), 0, "nothing more to delete"); assert_eq!(history.prune(NOW).unwrap(), 0, "nothing more to delete");
assert!( assert!(
fake.history.with_extension("db-wal").exists() fake.history.with_extension("db-wal").exists()
@@ -525,3 +536,129 @@ fn a_server_that_will_not_start_is_reported_and_not_retried_for_a_minute() {
assert_eq!(app.view(Range::Day).server.status, Status::Running); assert_eq!(app.view(Range::Day).server.status, Status::Running);
assert_eq!(app.view(Range::Day).server.error, None); assert_eq!(app.view(Range::Day).server.error, None);
} }
/// The real output with `more` more Rust builds in it: that many more requests, misses and compiles.
fn with_more_rust_builds(more: u64) -> String {
let text = LIVE.replace(
"\"compile_requests\":7351",
&format!("\"compile_requests\":{}", 7351 + more),
);
let text = text.replace("\"Rust\":3256", &format!("\"Rust\":{}", 3256 + more));
let text = text.replace("\"rust\":3256", &format!("\"rust\":{}", 3256 + more));
let text = text.replace(
"\"compilations\":3256",
&format!("\"compilations\":{}", 3256 + more),
);
let text = text.replace(
"\"cache_writes\":3256",
&format!("\"cache_writes\":{}", 3256 + more),
);
text.replace(
"\"compiler_write_duration\":{\"secs\":25343",
&format!(
"\"compiler_write_duration\":{{\"secs\":{}",
25343 + 8 * more
),
)
}
#[test]
fn the_bootstrap_is_not_redrawn_on_every_poll_of_a_build_in_flight() {
let fake = Fake::new();
let app = App::with_probe(fake.config(), fake.probe());
let mut task = Task::memory();
let rust_builds = |app: &App| {
app.view(Range::Day)
.build_times
.first()
.map_or(0, |t| t.compiles)
};
task.poll(&app, NOW);
assert_eq!(rust_builds(&app), 0, "nothing seen yet");
// A build adds one Rust build between every pair of polls. Each is stored at once, but the
// histogram (and with it the bootstrap) waits for the one-minute beat.
for step in 1..6u64 {
fake.answers(&with_more_rust_builds(step));
task.poll(&app, NOW + (step as i64) * 10);
assert_eq!(
task.history.build_obs_stamp().unwrap().0,
step as i64,
"observation {step} is stored at once"
);
assert_eq!(
rust_builds(&app),
0,
"but the bootstrap drawn at the first poll stands (step {step})"
);
}
fake.answers(&with_more_rust_builds(6));
task.poll(&app, NOW + 60);
assert_eq!(
rust_builds(&app),
6,
"a minute after the last draw, everything seen so far is drawn in"
);
fake.answers(&with_more_rust_builds(7));
task.poll(&app, NOW + 70);
assert_eq!(
rust_builds(&app),
6,
"and it stands again until the next beat"
);
}
#[test]
fn a_full_history_costs_few_rows_on_the_second_poll() {
// Thirty days with a row every minute: the most there can ever be. Two languages miss most
// minutes, so only one minute in ten gives a build observation.
let fake = Fake::new();
let app = App::with_probe(fake.config(), fake.probe());
let mut task = Task::memory();
let day = 86_400;
let mut c = stats::Counters::default();
let mut readings = Vec::new();
for step in 0..43_200i64 {
let (rust, cxx) = if step % 10 == 0 { (2, 0) } else { (1, 1) };
c.totals.requests += 10;
c.totals.executed += 8;
c.totals.hits += 6;
c.totals.misses += rust + cxx;
c.totals.not_cacheable += 2;
c.totals.cache_writes += rust + cxx;
c.compilations += rust + cxx;
c.ns = [
c.ns[0] + 6 * 10_000_000,
c.ns[1] + (rust + cxx) * 1_000_000_000,
c.ns[2] + (rust + cxx) * 8_000_000_000,
];
c.langs = vec![
("Assembler".to_owned(), [2, 0, 0]),
("C/C++".to_owned(), [4, cxx, 0]),
("Rust".to_owned(), [0, rust, 0]),
];
readings.push((NOW - 30 * day + step * 60, c.clone()));
}
task.history.fill(&readings).unwrap();
assert_eq!(
task.history.row_count().unwrap(),
43_199,
"the first reading is the baseline"
);
let observations = task.history.build_obs_stamp().unwrap().0;
assert_eq!(observations, 4_319, "one for every tenth minute after the baseline");
task.poll(&app, NOW);
let first = app.lock().views_rows;
task.poll(&app, NOW + 10);
let second = app.lock().views_rows;
eprintln!("rows handed out: first poll {first} (reading {observations} build observations once), second poll {second}");
assert!(
first >= observations as usize,
"the first poll reads every observation once"
);
assert!(second < 3_000, "the second poll handed out {second} rows");
let v = app.view(Range::Day);
assert_eq!(v.buckets.len(), 120);
}