pub enum Interval {
Frequency(u64),
Period(u64),
PollPeriodMs(u32),
}
Expand description
How often to snapshot the counter, along with any follower events and any additional sampled data such as callstacks.
This choice also controls how the readings are taken:
- With |frequency| or |period|, samples are taken by the kernel
into a ring buffer. Analogous to
perf record
. - With |poll_period_ms|, the userspace periodically snapshots
the counters using the read syscall. Analogous to
perf stat -I
. Prefer the sampling options unless you’re recording PMUs whose perf drivers only support the reading mode.
If unset, an implementation-defined sampling default is used.
Variants§
Frequency(u64)
Per-cpu sampling frequency in Hz, as requested from the kernel. Not the same as 1/period. Details: the actual sampling will still be based on a period, but the kernel will dynamically adjust it based on the observed event rate, to approximate this frequency. Works best with steady-rate events like timers. Not guaranteed to be honored as the kernel can throttle the sampling rate if it’s too high.
Period(u64)
Per-cpu sampling will occur every |period| counts of |event|. Prefer |frequency| by default, as it’s easier to oversample with a fixed period. Not guaranteed to be honored as the kernel can throttle the sampling rate if it’s too high.
PollPeriodMs(u32)
Per-cpu values are read by the userspace every interval. If using this mode, only follower events are supported. Options such as |PerfEventConfig.CallstackSampling| are incompatible. The period can’t be guaranteed to be exact since the readings are taken by userspace.
Implementations§
Source§impl Interval
impl Interval
Sourcepub fn merge<B>(
field: &mut Option<Interval>,
tag: u32,
wire_type: WireType,
buf: &mut B,
ctx: DecodeContext,
) -> Result<(), DecodeError>where
B: Buf,
pub fn merge<B>(
field: &mut Option<Interval>,
tag: u32,
wire_type: WireType,
buf: &mut B,
ctx: DecodeContext,
) -> Result<(), DecodeError>where
B: Buf,
Decodes an instance of the message from a buffer, and merges it into self.
Sourcepub fn encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.