remove reduntant histogram

This commit is contained in:
Robin Appelman 2025-08-09 17:27:25 +02:00
commit 4f9e5df792

View file

@ -55,8 +55,6 @@ impl<'logs> App<'logs> {
pub struct LogMatch<'logs> {
pub result: Option<MatchResult>,
pub count: usize,
pub histogram: OnceCell<TimeGraph>,
pub sparkline: OnceCell<SparkLine>,
pub all: LineSet<'logs>,
pub grouped: Vec<LineSet<'logs>>,
}
@ -70,28 +68,17 @@ impl<'logs> LogMatch<'logs> {
LogMatch {
result,
count,
histogram: OnceCell::new(),
sparkline: OnceCell::new(),
grouped,
all,
}
}
pub fn sparkline(&self, app: &App) -> &SparkLine {
self.sparkline
.get_or_init(|| self.histogram(app).sparkline())
self.all.sparkline(app)
}
pub fn histogram(&self, app: &App) -> &TimeGraph {
self.histogram.get_or_init(|| {
let min_time = app.lines.first().time;
let max_time = app.lines.last().time;
let mut histogram = TimeGraph::new(min_time, max_time);
for line in &self.all.lines {
histogram.add(line.time);
}
histogram
})
self.all.histogram(app)
}
pub fn row_count(&self) -> usize {