jithinpt
jithinpt

Reputation: 1244

Using linux perf and PEBS to sample memory accesses in a program

I've been trying to use the linux perf tool to sample the memory accesses in my program. Specifically, I'm using the perf mem command to instrument the loads in the program:

perf mem -t load rec myprogram
perf mem -t load rep

However, I would like to increase the sampling frequency and collect more samples. But I did not find any option for the perf mem command that controls the sampling frequency.

Questions

  1. Is there an option that would let me control the sampling frequency when running perf mem?
  2. What's the default sampling frequency?
  3. Is there a better option that perf mem to instrument the memory accesses in the program? I'm specifically looking for the following bits of data for each of the sampled load operations - (i) Target data address (ii) And whether the load resulted in an L1/L2/LLC cache hit or not.

Upvotes: 3

Views: 2611

Answers (1)

Manuel Selva
Manuel Selva

Reputation: 19050

1- have you tried the -F option used to specify the average sampling rate in samples per sec (https://perf.wiki.kernel.org/index.php/Tutorial#Sampling_with_perf_record) ?

2- According to the wiki (link above) "The perf tool defaults to the average rate. It is set to 1000Hz, or 1000 samples/sec."

3- I think perf mem provides all the information you need.

Upvotes: 1

Related Questions