use crate::view::syntax::HighlightStats;
use std::time::Instant;
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub struct RenderStats {
pub frames: u64,
pub item_rebuilds: u64,
pub markdown_bytes_parsed: u64,
pub max_live_rows: usize,
pub history_rows_inserted: u64,
pub highlight: HighlightStats,
pub ns_layout: u64,
pub ns_live: u64,
pub ns_draw: u64,
pub ns_item_rebuild: u64,
}
pub(super) struct Lap {
#[cfg(feature = "testing")]
start: Instant,
}
impl Lap {
pub(super) fn start() -> Self {
#[cfg(feature = "testing")]
return Self { start: Instant::now() };
#[cfg(not(feature = "testing"))]
Self {}
}
#[cfg_attr(not(feature = "testing"), expect(clippy::unused_self))]
pub(super) fn ns(self) -> u64 {
#[cfg(feature = "testing")]
return u64::try_from(self.start.elapsed().as_nanos()).unwrap_or(u64::MAX);
#[cfg(not(feature = "testing"))]
0
}
}