pub trait Counter {
// Required methods
fn start(&mut self);
fn stop(&mut self);
fn phase_change(&mut self, old_phase: usize);
fn print_count(&self, phase: usize);
fn get_total(&self, other: Option<bool>) -> u64;
fn print_total(&self, other: Option<bool>);
fn print_min(&self, other: bool);
fn print_max(&self, other: bool);
fn print_last(&self);
fn merge_phases(&self) -> bool;
fn implicitly_start(&self) -> bool;
fn name(&self) -> &String;
}
Expand description
An abstraction over how a specific Diffable value is counted
For example, we can just collect the values, and store the cummulative sum, or we can derive some kind of histogram, etc.
Required Methods§
sourcefn phase_change(&mut self, old_phase: usize)
fn phase_change(&mut self, old_phase: usize)
Signal a change in GC phase.
The phase number starts from 0 and is strictly increasing.
Even numbers mean mutators are running (other
) while odd numbers mean
stop-the-world pauses (stw
).
Take action with respect to the last phase if necessary.
sourcefn print_count(&self, phase: usize)
fn print_count(&self, phase: usize)
Print the counter value for a particular phase
If the counter merges the phases, the printing value will include the specified phase and the next phase
sourcefn get_total(&self, other: Option<bool>) -> u64
fn get_total(&self, other: Option<bool>) -> u64
Get the total count over past phases
If the argument is None, count all phases.
Otherwise, count only other
phases if true, or stw
phases if false
sourcefn print_total(&self, other: Option<bool>)
fn print_total(&self, other: Option<bool>)
Print the total count over past phases
If the argument is None, count all phases.
Otherwise, count only other
phases if true, or stw
phases if false
sourcefn print_min(&self, other: bool)
fn print_min(&self, other: bool)
Print the minimum count of the past phases
Consider only other
phases if true, or stw
phases if false
sourcefn print_max(&self, other: bool)
fn print_max(&self, other: bool)
Print the maximum count of the past phases
Consider only other
phases if true, or stw
phases if false
sourcefn print_last(&self)
fn print_last(&self)
Print the count of the last phases
sourcefn merge_phases(&self) -> bool
fn merge_phases(&self) -> bool
Whether the counter merges other and stw phases.
sourcefn implicitly_start(&self) -> bool
fn implicitly_start(&self) -> bool
Whether the counter starts implicitly after creation
FIXME currently unused