intel-acr.txt 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. Intel Auto Counter Reload Support
  2. ---------------------------------
  3. Support for Intel Auto Counter Reload in perf tools
  4. Auto counter reload provides a means for software to specify to hardware
  5. that certain counters, if supported, should be automatically reloaded
  6. upon overflow of chosen counters. By taking a sample only if the rate of
  7. one event exceeds some threshold relative to the rate of another event,
  8. this feature enables software to sample based on the relative rate of
  9. two or more events. To enable this, the user must provide a sample period
  10. term and a bitmask ("acr_mask") for each relevant event specifying the
  11. counters in an event group to reload if the event's specified sample
  12. period is exceeded.
  13. For example, if the user desires to measure a scenario when IPC > 2,
  14. the event group might look like the one below:
  15. perf record -e {cpu_atom/instructions,period=200000,acr_mask=0x2/, \
  16. cpu_atom/cycles,period=100000,acr_mask=0x3/} -- true
  17. In this case, if the "instructions" counter exceeds the sample period of
  18. 200000, the second counter, "cycles", will be reset and a sample will be
  19. taken. If "cycles" is exceeded first, both counters in the group will be
  20. reset. In this way, samples will only be taken for cases where IPC > 2.
  21. The acr_mask term is a hexadecimal value representing a bitmask of the
  22. events in the group to be reset when the period is exceeded. In the
  23. example above, "instructions" is assigned an acr_mask of 0x2, meaning
  24. only the second event in the group is reloaded and a sample is taken
  25. for the first event. "cycles" is assigned an acr_mask of 0x3, meaning
  26. that both event counters will be reset if the sample period is exceeded
  27. first.
  28. ratio-to-prev Event Term
  29. ------------------------
  30. To simplify this, an event term "ratio-to-prev" is provided which is used
  31. alongside the sample period term n or the -c/--count option. This would
  32. allow users to specify the desired relative rate between events as a
  33. ratio. Note: Both events compared must belong to the same PMU.
  34. The command above would then become
  35. perf record -e {cpu_atom/instructions/, \
  36. cpu_atom/cycles,period=100000,ratio-to-prev=0.5/} -- true
  37. ratio-to-prev is the ratio of the event using the term relative
  38. to the previous event in the group, which will always be 1,
  39. for a 1:0.5 or 2:1 ratio.
  40. To sample for IPC < 2 for example, the events need to be reordered:
  41. perf record -e {cpu_atom/cycles/, \
  42. cpu_atom/instructions,period=200000,ratio-to-prev=2.0/} -- true