Struct jemalloc_ctl::Epoch [−][src]
pub struct Epoch(_);
A type providing access to the jemalloc epoch.
Many of the statistics tracked by jemalloc are cached. The epoch controls when they are refreshed.
Example
Advancing the epoch:
extern crate jemallocator; extern crate jemalloc_ctl; use jemalloc_ctl::Epoch; #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; fn main() { let epoch = Epoch::new().unwrap(); let a = epoch.advance().unwrap(); let b = epoch.advance().unwrap(); assert_eq!(a + 1, b); }
Methods
impl Epoch
[src]
impl Epoch
pub fn new() -> Result<Epoch>
[src]
pub fn new() -> Result<Epoch>
Returns a new Epoch
.
pub fn advance(&self) -> Result<u64>
[src]
pub fn advance(&self) -> Result<u64>
Advances the epoch, returning it.
The epoch advances by 1 every time it is advanced, so the value can be used to determine if another thread triggered a referesh.