pub struct AccArray<const S: bool, T: TraceValue, C: TraceCount, const N: usize>{ /* private fields */ }Expand description
An AccArray can be used to accumulate the times taken to execute different branches of code, from a common start point. Each branch is allocated a different index into the AccArray. It can also count the entries.
The AccArray is generic on whether to use the CPU-specific architcture timer implementation, the value to accumulate times in (e.g. u64), the value to use to count occurrences (e.g. u32), and the number of trace points in the vec
The ‘start’ method is called first; when a branch completed it invokes the ‘acc_n’ method with its index, and the delta time since the start is added to that start’s accumulator.
Invoking the ‘acc_n’ method does not update the ‘start’ time, and it is quite sensible to issue multiple ‘acc’ invocations (with different index values) for a given ‘start’ invocation.
The ‘acc_n_restart’ method, though, performs the same accumulation and it does update the ‘start’ time; this can be used to accumulate elapsed time between stages.
An AccArray can be generated for any N, for an accumulator value of (), u8, u16, u32, u64, u128 and usize, and for a counter value of (), u8, u16, u32, u64, usize. If a value of () is used then the count or delta accumulator are effectively always 0.