Path: blob/master/tools/perf/Documentation/intel-acr.txt
30363 views
Intel Auto Counter Reload Support1---------------------------------2Support for Intel Auto Counter Reload in perf tools34Auto counter reload provides a means for software to specify to hardware5that certain counters, if supported, should be automatically reloaded6upon overflow of chosen counters. By taking a sample only if the rate of7one event exceeds some threshold relative to the rate of another event,8this feature enables software to sample based on the relative rate of9two or more events. To enable this, the user must provide a sample period10term and a bitmask ("acr_mask") for each relevant event specifying the11counters in an event group to reload if the event's specified sample12period is exceeded.1314For example, if the user desires to measure a scenario when IPC > 2,15the event group might look like the one below:1617perf record -e {cpu_atom/instructions,period=200000,acr_mask=0x2/, \18cpu_atom/cycles,period=100000,acr_mask=0x3/} -- true1920In this case, if the "instructions" counter exceeds the sample period of21200000, the second counter, "cycles", will be reset and a sample will be22taken. If "cycles" is exceeded first, both counters in the group will be23reset. In this way, samples will only be taken for cases where IPC > 2.2425The acr_mask term is a hexadecimal value representing a bitmask of the26events in the group to be reset when the period is exceeded. In the27example above, "instructions" is assigned an acr_mask of 0x2, meaning28only the second event in the group is reloaded and a sample is taken29for the first event. "cycles" is assigned an acr_mask of 0x3, meaning30that both event counters will be reset if the sample period is exceeded31first.3233ratio-to-prev Event Term34------------------------35To simplify this, an event term "ratio-to-prev" is provided which is used36alongside the sample period term n or the -c/--count option. This would37allow users to specify the desired relative rate between events as a38ratio. Note: Both events compared must belong to the same PMU.3940The command above would then become4142perf record -e {cpu_atom/instructions/, \43cpu_atom/cycles,period=100000,ratio-to-prev=0.5/} -- true4445ratio-to-prev is the ratio of the event using the term relative46to the previous event in the group, which will always be 1,47for a 1:0.5 or 2:1 ratio.4849To sample for IPC < 2 for example, the events need to be reordered:5051perf record -e {cpu_atom/cycles/, \52cpu_atom/instructions,period=200000,ratio-to-prev=2.0/} -- true535455