pub struct Profiler { /* private fields */ }Expand description
Counts what a run executes, by the instruction that executed.
Implementations§
Source§impl Profiler
impl Profiler
Sourcepub fn hottest(&self) -> Vec<((FunctionId, u32), Cost)>
pub fn hottest(&self) -> Vec<((FunctionId, u32), Cost)>
Every instruction that ran, and how often, hottest first.
Ties are broken by the instruction’s own identity, so two runs of one program report the same order: a profile that reordered its own ties would make an unchanged program look changed.
Sourcepub fn by_function(&self) -> Vec<(FunctionId, Cost)>
pub fn by_function(&self) -> Vec<(FunctionId, Cost)>
Every function that ran, and what the instructions of it cost, hottest first.
Sourcepub fn rows(&self) -> Vec<((FunctionId, u32), Cost)>
pub fn rows(&self) -> Vec<((FunctionId, u32), Cost)>
Every instruction that ran and what it cost, in no particular order.
For a reader that wants to group by something only the program knows —
the opcode an instruction is, the callee a call names — which this
crate deliberately does not: a profiler that read the program would
have to be given one, and the two things that want these groupings
already hold it.
Trait Implementations§
Source§impl Debugger for Profiler
impl Debugger for Profiler
Source§fn at(&self, stop: &Stop<'_>) -> Resume
fn at(&self, stop: &Stop<'_>) -> Resume
Closes the instruction that just ran and opens the one about to.
The count belongs to the instruction this stop is before; the time and the heap belong to the one the previous stop was before, because those are what moved in between.
The clock is read twice, first thing and last thing, and the bookkeeping
sits between the two reads. So the interval a number is measured over
holds the instruction, the dispatch that reached it and two clock
reads — and not this hook’s mutex and map, which is the expensive
part and which would otherwise swamp what it is trying to measure. An
add.int is a nanosecond or two and the map is a hundred.