Measure heap usage while processing the ledger

This commit is contained in:
Michael Vines
2020-01-01 12:19:20 -07:00
parent a0fb9de515
commit 4fe0b116ae
5 changed files with 31 additions and 6 deletions

View File

@ -28,6 +28,7 @@ impl Allocatedp {
Self {}
}
/// Return current thread heap usage
pub fn get(&self) -> u64 {
#[cfg(unix)]
{
@ -36,4 +37,9 @@ impl Allocatedp {
#[cfg(not(unix))]
0
}
/// Return the difference in thread heap usage since a previous `get()`
pub fn since(&self, previous: u64) -> i64 {
self.get() as i64 - previous as i64
}
}