Counters

Represents a collection of Counters.

Element Hierarchy

Syntax

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

Attributes and Elements

Attributes

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

Child Elements

Element Description Requirement
Counter Describes the hardware counter to 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 TotalCycles and InstructionRetired counter events on the CSwitch kernel event. The name of counters are based on CPU. Use wpr -pmcsources to enumerate available values. Refer to Event for available Event values.

<HardwareCounter Id="PerfWorkloads">
    <Counters>
        <Counter Value="TotalCycles"/>
        <Counter Value="InstructionRetired" />
    </Counters>
    <Events>
       <Event Value="CSwitch"/>
    </Events>
</HardwareCounter>

Elements

Events

HardwareCounter