Sample After Value

The Sample After value is the frequency or the number of events after which the VTune(TM) Performance Analyzer interrupts the processor to collect a sample during EBS.

By default, the Calibrate Sample After value option in the General panel (or -cal option in the command line interface) 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 the selected 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.

Size of the Sample After Value

A Sample After value that is too small causes the sampling interrupts to occur too frequently. In this case, the sampling collector incurs high overhead that can cause performance degradation. The recommendation (and the target of event calibration) is 1000 samples per second per processor.

For example, running at one GHz, a Sample After value of 2,000 for Clockticks means 500,000 samples per second, and only 2,000 CPU clocks between samples. If the sampling interrupt consumes 1000 clocks, it means that the processor is spending 50% of its time responding to the interrupts. At the end of the Activity duration, the sampling collector may have recorded 300 instruction addresses (or samples). However, 900 additional events may have occurred after the last sample was collected. The 301st sample is not collected since the Sample After value dictates that a sample is collected only after every 1000 events. Hence, the last 900 events are not accounted for. The actual number of events that occurred is therefore 300,900 and not 300,000 as stated in the calculation.

The guidelines for the Sample After value, in order of preference, are as follows:

  1. Accept the Clockticks value that is set by the analyzer. The analyzer calculates the processor speed and sets the Sample After value to 1000 samples per second.

  2. Use Calibrate Sample After value to set the analyzer to execute a preliminary run of the Activity to determine the appropriate Sample After value and then run the Activity again to generate Activity results. This option should generate the same results as the first guideline.

  3. If you set the Sample After value, specify a number that is sufficiently large. A value that is too low increases the sample rate causing unpredictable results.

To change the Sample After value:

  1. From the Configure Sampling dialog box, select the Events panel.

  2. Double-click the Sample After value of the event in the selected events field.

  3. Type in new value.

To change the Sample After value from the command line:

 use :sa | sample-after=<sample after value>.

Command-line example:

>vtl activity -c sampling -o "-event-config en='Bogus Branches'
:sa=200000 -calibration no" run

This example creates an Activity with the sampling collector for a Pentium(R) 4 processor machine. The sampling collector uses the event-based sampling and collects samples after the Bogus Branches event occurs 200000 times. The VTune analyzer will not try to calibrate the Sample After value.

note

Other Sampling Configuration Options