Skip to content

Commit

Permalink
Add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fornwall committed Sep 21, 2023
1 parent 8236aee commit 222e808
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,31 @@ pub(crate) mod allocator;
pub struct AllocationInfo {
num_allocations: u64,
total_bytes_allocated: u64,
max_bytes_allocated: u64,
current_bytes_allocated: i64,
max_bytes_allocated: u64,
}

impl AllocationInfo {
/// The number of allocations made during a [measure()] call.
pub const fn num_allocations(&self) -> u64 {
self.num_allocations
}

/// The total amount of bytes allocated during a [measure()] call.
pub const fn total_bytes_allocated(&self) -> u64 {
self.total_bytes_allocated
}

/// The current (net result) amount of bytes allocated during a [measure()] call.
///
/// This means that the function did not deallocate all memory.
///
/// TODO: Add example
pub const fn current_bytes_allocated(&self) -> i64 {
self.current_bytes_allocated
}

/// The max amount of bytes allocated at one time during a [measure()] call.
pub const fn max_bytes_allocated(&self) -> u64 {
self.max_bytes_allocated
}
Expand Down

0 comments on commit 222e808

Please sign in to comment.