大网数据广告活动
性能与资源

counter Complex Type

· 52CE 我爱测

To provide backwards-compatibility, each counter in the counter set should specify the same perfFreqID and perfTimeID values.

Defines a counter.

<xs:complexType name="counter">
    <xs:choice
        minOccurs="0"
        maxOccurs="1"
    >
        <xs:element name="counterAttributes"
            type="man:counterAttributes"
        >
            <xs:key name="uniqueCounterAttributeName">
                <xs:selector
                    xpath="./man:counterAttribute"
                 />
                <xs:field
                    xpath="@name"
                 />
            </xs:key>
        </xs:element>
    </xs:choice>
    <xs:attribute name="symbol"
        type="man:CSymbolType"
        use="optional"
     />
    <xs:attribute name="id"
        type="man:UInt32Type"
        use="required"
     />
    <xs:attribute name="uri"
        type="xs:anyURI"
        use="required"
     />
    <xs:attribute name="name"
        use="optional"
    >
        <xs:simpleType>
            <xs:restriction
                base="xs:string"
            >
                <xs:maxLength
                    value="1023"
                 />
            </xs:restriction>
        </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="description"
        type="xs:string"
        use="optional"
     />
    <xs:attribute name="type"
        use="required"
    >
        <xs:simpleType>
            <xs:restriction
                base="xs:string"
            >
                <xs:enumeration
                    value="perf_counter_counter"
                 />
                <xs:enumeration
                    value="perf_counter_timer"
                 />
                <xs:enumeration
                    value="perf_counter_queuelen_type"
                 />
                <xs:enumeration
                    value="perf_counter_large_queuelen_type"
                 />
                <xs:enumeration
                    value="perf_counter_100ns_queuelen_type"
                 />
                <xs:enumeration
                    value="perf_counter_obj_time_queuelen_type"
                 />
                <xs:enumeration
                    value="perf_counter_bulk_count"
                 />
                <xs:enumeration
                    value="perf_counter_text"
                 />
                <xs:enumeration
                    value="perf_counter_rawcount"
                 />
                <xs:enumeration
                    value="perf_counter_large_rawcount"
                 />
                <xs:enumeration
                    value="perf_counter_rawcount_hex"
                 />
                <xs:enumeration
                    value="perf_counter_large_rawcount_hex"
                 />
                <xs:enumeration
                    value="perf_sample_fraction"
                 />
                <xs:enumeration
                    value="perf_sample_counter"
                 />
                <xs:enumeration
                    value="perf_counter_timer_inv"
                 />
                <xs:enumeration
                    value="perf_sample_base"
                 />
                <xs:enumeration
                    value="perf_average_timer"
                 />
                <xs:enumeration
                    value="perf_average_base"
                 />
                <xs:enumeration
                    value="perf_average_bulk"
                 />
                <xs:enumeration
                    value="perf_obj_time_timer"
                 />
                <xs:enumeration
                    value="perf_100nsec_timer"
                 />
                <xs:enumeration
                    value="perf_100nsec_timer_inv"
                 />
                <xs:enumeration
                    value="perf_counter_multi_timer"
                 />
                <xs:enumeration
                    value="perf_counter_multi_timer_inv"
                 />
                <xs:enumeration
                    value="perf_counter_multi_base"
                 />
                <xs:enumeration
                    value="perf_100nsec_multi_timer"
                 />
                <xs:enumeration
                    value="perf_100nsec_multi_timer_inv"
                 />
                <xs:enumeration
                    value="perf_raw_fraction"
                 />
                <xs:enumeration
                    value="perf_large_raw_fraction"
                 />
                <xs:enumeration
                    value="perf_raw_base"
                 />
                <xs:enumeration
                    value="perf_large_raw_base"
                 />
                <xs:enumeration
                    value="perf_elapsed_time"
                 />
                <xs:enumeration
                    value="perf_counter_delta"
                 />
                <xs:enumeration
                    value="perf_counter_large_delta"
                 />
                <xs:enumeration
                    value="perf_precision_system_timer"
                 />
                <xs:enumeration
                    value="perf_precision_100ns_timer"
                 />
                <xs:enumeration
                    value="perf_precision_object_timer"
                 />
                <xs:enumeration
                    value="perf_counter_composite"
                 />
            </xs:restriction>
        </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="baseID"
        type="man:UInt32Type"
        use="optional"
     />
    <xs:attribute name="detailLevel"
        use="required"
    >
        <xs:simpleType>
            <xs:restriction
                base="xs:string"
            >
                <xs:enumeration
                    value="standard"
                 />
                <xs:enumeration
                    value="advanced"
                 />
            </xs:restriction>
        </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="defaultScale"
        use="optional"
        default="0"
    >
        <xs:simpleType>
            <xs:restriction
                base="xs:integer"
            >
                <xs:minInclusive
                    value="-10"
                 />
                <xs:maxInclusive
                    value="10"
                 />
            </xs:restriction>
        </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="aggregate"
        use="optional"
    >
        <xs:simpleType>
            <xs:restriction
                base="xs:string"
            >
                <xs:enumeration
                    value="sum"
                 />
                <xs:enumeration
                    value="avg"
                 />
                <xs:enumeration
                    value="max"
                 />
                <xs:enumeration
                    value="min"
                 />
                <xs:enumeration
                    value="undefined"
                 />
            </xs:restriction>
        </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="perfTimeID"
        type="man:UInt32Type"
        use="optional"
     />
    <xs:attribute name="perfFreqID"
        type="man:UInt32Type"
        use="optional"
     />
    <xs:attribute name="multiCounterID"
        type="man:UInt32Type"
        use="optional"
     />
    <xs:attribute name="struct"
        type="man:CSymbolType"
        use="optional"
     />
    <xs:attribute name="field"
        type="man:CSymbolType"
        use="optional"
     />
</xs:complexType>

Child elements

Element Type Description
counterAttributes man:counterAttributes Lists the unique attributes that specify how the counter data is displayed in a consumer application.

Attributes

Name Type Description
aggregate The aggregation function to apply if the instances attribute of <a href="performance-counters-counterset-complex-type.md">counterSet</a> is globalAggregate, multipleAggregate, or globalAggregateHistory. The following are the possible aggregation functions that you can apply:max The maximum counter value is returned.min The minimum counter value is returned.avg The average counter value is returned.sum The sum of the counter values is returned.undefined Do not aggregate this counter.
baseID <a href="performance-counters-uint32type-simple-type.md">man:UInt32Type</a> The identifier of another counter within the same counter set, whose value is used to calculate this counter's value. The following counter types require a base counter:PERF_AVERAGE_TIMER Requires the PERF_AVERAGE_BASE base counter.PERF_AVERAGE_BULK Requires the PERF_AVERAGE_BASE base counter.PERF_COUNTER_MULTI_TIMER_INV Requires the PERF_COUNTER_MULTI_BASE base counter.PERF_LARGE_RAW_FRACTION Requires the PERF_LARGE_RAW_BASE base counter.PERF_PRECISION_100NS_TIMER Requires the PERF_LARGE_RAW_BASE base counter.PERF_RAW_FRACTION Requires the PERF_RAW_BASE base counter.PERF_SAMPLE_FRACTION Requires the PERF_SAMPLE_BASE base counter.
defaultScale The scale factor to apply to the counter value (factor * counter value). The default is zero if no scale is applied. Valid values range from 10 to 10 (0.0000000001 to 1000000000). If this value is zero, the scale value is 1; if this value is 1, the scale value is 10; if this value is 1, the scale value is .10; and so on.
description xs:string A short description of the counter. You do not have to specify this attribute if the counter includes the <a href="performance-counters-counterattribute-complex-type.md">noDisplay</a> attribute.
detailLevel Specifies the target audience for the counter details. The following are the possible values:standard Display details about the counter that a typical user would understand.advanced Display details about the counter that only an advanced user would understand.
field <a href="performance-counters-csymboltype-simple-type.md">man:CSymbolType</a> The name of a field within the struct that contains the counter value. This attribute is not allowed for user-mode providers.
id <a href="performance-counters-uint32type-simple-type.md">man:UInt32Type</a> A unique number that identifies the counter within the counter set.
multiCounterID <a href="performance-counters-uint32type-simple-type.md">man:UInt32Type</a> The identifier of another counter within the same counter set, whose multiplier value is used to calculate this counter's value. The following counter types require a multiplier value. The referenced counter must be of type PERF_COUNTER_RAWCOUNT.<ul><li>PERF_COUNTER_MULTI_TIMER</li><li>PERF_COUNTER_MULTI_TIMER_INV</li><li>PERF_100NSEC_MULTI_TIMER</li><li>PERF_100NSEC_MULTI_TIMER_INV</li></ul>
name The name of the counter. The name must be unique and less than 1,024 characters. The name is case-sensitive. You do not have to specify this attribute if the counter includes the <a href="performance-counters-counterattribute-complex-type.md">noDisplay</a> attribute.
perfFreqID <a href="performance-counters-uint32type-simple-type.md">man:UInt32Type</a> The identifier of another counter within the same counter set, whose frequency value is used to calculate this counter's value. The following counter types require a frequency. The PERF_COUNTER_LARGE_RAWCOUNT counter type contains the time stamp value.<ul><li>PERF_COUNTER_OBJECT_TIME_QUEUELEN_TYPE</li><li>PERF_ELAPSED_TIME</li><li>PERF_OBJ_TIME_TIMER</li><li>PERF_PRECISION_OBJECT_TIMER</li></ul>
perfTimeID <a href="performance-counters-uint32type-simple-type.md">man:UInt32Type</a> The identifier of another counter within the same counter set, whose time stamp value is used to calculate this counter's value. The following counter types require a time stamp. The PERF_COUNTER_LARGE_RAWCOUNT counter type contains the time stamp value.<ul><li>PERF_COUNTER_OBJECT_TIME_QUEUELEN_TYPE</li><li>PERF_ELAPSED_TIME</li><li>PERF_OBJ_TIME_TIMER</li><li>PERF_PRECISION_OBJECT_TIMER</li></ul>
struct <a href="performance-counters-csymboltype-simple-type.md">man:CSymbolType</a> The name of a struct element that contains this counter value. This attribute is not allowed for user-mode providers.
symbol <a href="performance-counters-csymboltype-simple-type.md">man:CSymbolType</a> A symbolic name that identifies the counter. The <a href="ctrpp.md">CTRPP</a> tool creates a constant that you can use when calling functions that require a counter identifier (for example, <a href="/windows/desktop/api/Perflib/nf-perflib-perfincrementulongcountervalue">PerfIncrementULongCounterValue</a>). The name of the constant is the symbolic name.
type The name of the counter type. For possible values, see the above syntax block. For details of each type, see <a href="/previous-versions/windows/it-pro/windows-server-2003/cc776490(v=ws.10)">Counter Types</a> in the Windows 2003 Deployment Guide. The name is case-sensitive use lowercase.
uri xs:anyURI A unique uniform resource identifier that lets users retrieve counter values from any location.

Remarks

To provide backwards-compatibility, each counter in the counter set should specify the same perfFreqID and perfTimeID values.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 07/14/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。