add some usage stats output on the mutex maps

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-07-09 21:22:44 +00:00
parent 271f720286
commit 2a304c2b6c
3 changed files with 26 additions and 0 deletions

View file

@ -3,6 +3,7 @@ mod signing_keys;
use std::{
collections::{hash_map, BTreeMap, HashMap, HashSet},
fmt::Write,
pin::Pin,
sync::{Arc, RwLock as StdRwLock},
time::Instant,
@ -61,6 +62,20 @@ impl crate::Service for Service {
}))
}
fn memory_usage(&self, out: &mut dyn Write) -> Result<()> {
let mutex_federation = self.mutex_federation.len();
writeln!(out, "federation_mutex: {mutex_federation}")?;
let federation_handletime = self
.federation_handletime
.read()
.expect("locked for reading")
.len();
writeln!(out, "federation_handletime: {federation_handletime}")?;
Ok(())
}
fn name(&self) -> &str { crate::service::make_name(std::module_path!()) }
}