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 struct LogMatch<'logs> {
|
||||||
pub result: Option<MatchResult>,
|
pub result: Option<MatchResult>,
|
||||||
pub count: usize,
|
pub count: usize,
|
||||||
pub histogram: OnceCell<TimeGraph>,
|
|
||||||
pub sparkline: OnceCell<SparkLine>,
|
|
||||||
pub all: LineSet<'logs>,
|
pub all: LineSet<'logs>,
|
||||||
pub grouped: Vec<LineSet<'logs>>,
|
pub grouped: Vec<LineSet<'logs>>,
|
||||||
}
|
}
|
||||||
|
|
@ -70,28 +68,17 @@ impl<'logs> LogMatch<'logs> {
|
||||||
LogMatch {
|
LogMatch {
|
||||||
result,
|
result,
|
||||||
count,
|
count,
|
||||||
histogram: OnceCell::new(),
|
|
||||||
sparkline: OnceCell::new(),
|
|
||||||
grouped,
|
grouped,
|
||||||
all,
|
all,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sparkline(&self, app: &App) -> &SparkLine {
|
pub fn sparkline(&self, app: &App) -> &SparkLine {
|
||||||
self.sparkline
|
self.all.sparkline(app)
|
||||||
.get_or_init(|| self.histogram(app).sparkline())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn histogram(&self, app: &App) -> &TimeGraph {
|
pub fn histogram(&self, app: &App) -> &TimeGraph {
|
||||||
self.histogram.get_or_init(|| {
|
self.all.histogram(app)
|
||||||
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
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn row_count(&self) -> usize {
|
pub fn row_count(&self) -> usize {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue