SampledCounters

Represents a collection of SampledCounters.

Element Hierarchy

Syntax

<SampledCounters Operation = OperationEnumeration = "Set" | "Add" | “Remove”>
  <!-- Child elements -->
  SampledCounter
</SampledCounters>

Attributes and Elements

Attributes

Attribute Description Data type Required Default
Operation Indicates whether SampledCounter should be set or added. This attribute can have one of the following values:
  • Set
  • Add
  • Remove
No Set

Child Elements

Element Description Requirement
SampledCounter Describes the Sampled hardware counter that can be enabled for the kernel-mode session. Required, 1 or more.

Parent Elements

Element Description
HardwareCounter Represents a hardware counter provider.

Example

The following code example is to collect InstructionRetired counter event on PMU sampled profiling. PmcProfile keyword in SystemProvider is required for SampledCounter. The name of counters are based on CPU. Use wpr -pmcsources to enumerate available values.

<SystemProvider Id="SystemProvider_forSampling">
    <Keywords>
        <Keyword Value="ProcessThread" />
        <Keyword Value="Loader" />
        <Keyword Value="PmcProfile" />
    </Keywords>
</SystemProvider>
<HardwareCounter Id="PerfWorkloads">
    <SampledCounters>
        <SampledCounter Value="InstructionRetired" Interval="100000" />
    </SampledCounters>
</HardwareCounter>

Elements

HardwareCounter