mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 18:14:11 +02:00
remove reduntant histogram
This commit is contained in:
parent
36bdc23080
commit
4f9e5df792
1 changed files with 2 additions and 15 deletions
17
src/app.rs
17
src/app.rs
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue