//! optional template features //! //! *(`Sternum`)* is currently broken which is not letting me put doc comments //! on the [`Feature`]. //! //! [`Feature::SystemStats`] fill variables used for including system statistics //! obtained from gatherer (see [`GathererConnector`]) use bempline::Document; use gny::sternum::Sternum; use crate::state::SplormState; #[derive(Sternum, Debug, PartialEq)] pub enum Feature { SystemStats, } /// apply system stat template variables pub async fn apply_system_stats(doc: &mut Document, state: &SplormState) { let bounds = { let mut lock = state.gatherer_thread().await; match lock.regular_graphs().await { Err(_) => return, Ok(graphs) => graphs.bounds, } }; doc.set("stats.mem.total", bounds.mem_upper / 1000); doc.set("stats.mem.usage", bounds.mem_current / 1000); doc.set("stats.net.max_bound", bounds.net_upper); doc.set("stats.cpu.max_bound", bounds.cpu_upper); }