title: How does perf associate events to functions?
body: <p>More precisely how does the perf tool associate PMU events to functions
  i already realized that when the kernel perf subsystem records the event counters it also records the Program Counter (PC) so it can associate the count to a function.</p>
  
  <p>However to really get fine grain result, you need to sample the counters in a very high rate, otherwise you may associate counters to a group of functions.
  But reading the counters and writing the sampled data (counters, PC, call-stack) to the perf mmap space is very intrusive.</p>
  
  <p>I read in some sources that this sampling only happens when the PMU counters overflow, but this is can be very coarse unless i am setting the counters to overflow very quickly </p>
  
  <p>what am i missing here ? </p>