Skip to contentSkip to conversation

Is sampling in perf spread across the program ?

DISCUSSION Joy Arulraj 1 participant 1 message May 30, 2012

lore
Share & tools
lore
#0 lore raw

Hi all,

I understand that sampling in perf is done by raising interrupts based on user
specified sampling rate. Also, though the sampling rate can change dynamically over the execution, the overall sampling rate is maintained to closely match the user specified sampling rate.

But, will the samples collected by repeatedly sampling the same program differ
across runs ?

Like, if the sampling rate is "collect 1 sample every 500 events". And say in
run 1 of a program, perf collects the 500th, 1000th, 1500th .. events. And say in run 2 of the same program with same sampling rate, perf collects the 499th, 1002th, 1501th .. events. Will Perf ever sample some midway events like 250th or 750th events in the program with the same sampling rate ?

ie. Is the sampling *spread* over the entire program across multiple runs ? If
not, how can we achieve something like that - maybe some initial offset after which perf starts collecting events ?

Thanks,
Joy