Sample After value is the frequency or the number of events after which the VTuneTM Performance Analyzer interrupts the processor to collect a sample during EBS.
By default, the calibration option is enabled and the VTune analyzer adjusts the Sample After value automatically. The first time the Activity runs, the VTune analyzer records every occurrence of an event, calculates the total number of events and calibrates the Sample After value. The second time the Activity runs, the VTune analyzer collects samples based on the calibrated Sample After value.
However, if the calibration is not enabled, then the VTune analyzer interrupts the processor after the specified Sample After value of the event and collects a sample. This process is repeated till the target number of samples is collected.
Too small of a Sample After value causes the sampling interrupts to occur too frequently. In this case, the processor spends a lot of time in the analyzer sampling interrupt handler instead of doing what it is supposed to do. Once you get to extremely small Sample After values, you may run into different problems even if you can keep the analyzer running. The recommendation (and the target of event calibration) is 1000 samples per second.
For example, running at one GHz, a Sample After value of 2,000 means 500,000 samples per second, a number that is considered too large and would mean only 2,000 CPU clocks between samples. If the analyzer sampling interrupt consumes 1000 clocks (for example), that means that the CPU is spending 50% of its time responding to analyzer interrupts and not responding to OS interrupts, disk I/O, etc.
In fact, the analyzer calculates the default Sample After value for Clockticks to produce 1000 samples per second. You should not change that value unless there is some compelling reason.
So, the recommendations for the Clockticks event Sample After value, in order of preference, are:
Don't change the Clockticks Sample After value that is set by the analyzer. The analyzer calculates the CPU's speed and sets the Sample After value so that there will be 1000 samples per second
Use calibration to let the analyzer run a few experiments to determine what Sample After value is appropriate (although it should get the same answer as recommendation 1 above).
Don't manually set the Sample After value to a number so small that sample rate increases by several orders of magnitude. This will cause unpredictable results.
use :sa | sample-after=<sample after value>.
Example:
>vtl activity -c sampling -o "-event-config en='Instructions Decoded':sa=200000 -calibration no" run
This example creates an Activity with the sampling collector for a Pentium(R) III processor machine. The sampling collector uses the event-based sampling and collects samples after the Instructions Decoded event occurs 200000 times. The VTune analyzer will not try to calibrate the Sample After value.
Changing the sampling interval parameter changes the Sample After value and vice versa.
The optimum Sample-After values for other EBS events are different than for Clockticks because the other EBS events occur at different frequencies (usually less frequently). The goal is to produce about 1000 samples per second for any EBS event.
The VTune analyzer is meant to be a statistical sampling tool and is not meant to sample after every instruction. If you would like to accomplish more accurate results, you can invest in a hardware analysis tool that plugs on top of the CPU or you can run a module many times with a lower sampling rate to find an accurate average.