Export (0) Print
Expand All

perf_counter

Visual Studio .NET 2003

Apply this attribute to a data member in a perf_object class to expose it as a performance counter.

[ perf_counter(
   namestring,
   helpstring,
   name_res,
   help_res,
   countertype,
   defscale,
   default_counter,
   detail,
   countertype,
   max_counter_size,
   countertype_string
) ]

Parameters

namestring
A string containing the name of the performance counter. This name will be visible to users in the Performance Monitoring Console. Alternately, the name can be provided in the form of a resource ID using the name_res argument. A performance counter name must be specified using one of these two arguments.
helpstring
A string containing a description of the performance counter. This help string will be visible to users in the Performance Monitoring Console. Alternately, the name can be provided in the form of a resource ID using the help_res argument. A help string must be specified using one of these two arguments.
name_res
An integer that specifies the resource ID of the name to for this performance counter. This name will be visible to users in the Performance Monitoring Console. If this argument is provided, the namestring argument must be omitted.
help_res
An integer that specifies the resource ID of a description for this performance counter. This help string will be visible to users in the Performance Monitoring Console. If this argument is provided, the helpstring argument must be omitted.
countertype
An integer that specifies the counter type. See Performance Data Types for more information. Alternately, the countertype_string argument can be used.
defscale
An exponential value that modifies the actual counter value. Default is zero.
default_counter
A Boolean value that specifies that this is the default counter for the object. An object can have only one default counter. Default is false.
detail
An integer that specifies the desired detail level of the counter, and is PERF_DETAIL_NOVICE by default. Can be any one of these values:
Detail level Description
PERF_DETAIL_NOVICE Indicates that this counter may be meaningful to most users. This is the most common counter detail level.
PERF_DETAIL_ADVANCED Indicates that this counter is likely to be useful only to advanced users.
PERF_DETAIL_EXPERT Indicates that this counter is likely to be useful only to the most advanced users.
PERF_DETAIL_WIZARD Indicates that this counter is not likely to be useful to any users.
max_counter_size
An integer that specifies the maximum amount of space to reserve for the data of a string counter. By default this value is zero, which indicates no maximum value. Numeric counters, those whose counter type includes the flags PERF_SIZE_DWORD or PERF_SIZE_LARGE, are fixed size and may not specify this parameter.
countertype_string
Specifies the counter type as a string. If this argument is provided, the countertype argument must be omitted. This argument can be any one of the following strings:
countertype_string Performance data types
"counter" PERF_COUNTER_COUNTER
"timer" PERF_COUNTER_TIMER
"bulk_count" PERF_COUNTER_BULK_COUNT
"text" PERF_COUNTER_TEXT
"rawcount" PERF_COUNTER_RAWCOUNT
"value" PERF_COUNTER_VALUE
"rate" PERF_COUNTER_RATE
"fraction" PERF_COUNTER_FRACTION
"base" PERF_COUNTER_BASE
"elapsed" PERF_COUNTER_ELAPSED
"queuelen" PERF_COUNTER_QUEUELEN
"histogram" PERF_COUNTER_HISTOGRAM
"precision" PERF_COUNTER_PRECISION

See Performance Data Types for more information.

Attribute Context

Applies to Data member
Repeatable No
Required attributes None
Invalid attributes None

For more information about the attribute contexts, see Attribute Contexts.

Requirements

Header atlperf.h
Project EXE, DLL
Compiler /D "_ATL_ATTRIBUTES"

For more information about the meaning of the requirements, see Attribute Requirements.

Remarks

This attribute is applied to a data member that will serve as a performance counter. The class containing the new counter must be defined using the perf_object attribute.

The counter name and help string are required arguments but can be provided in either string or resource form. Both arguments must, however, be provided in the same form. The counter type is also a required argument, and can be specified in either string or integer form.

Example

#include <atlperf.h> 
[ perf_object( namestring = "MyPerfObject", helpstring = "Object Help") ]
class CMyPerfObject
{
   [ perf_counter(namestring="MyCounter", helpstring="Counter Help",
     countertype_string="rawcount") ]
   ULONG m_nCounter;
};

Example

See the PerfPersist Sample.

See Also

Performance Monitoring | PerformanceScribble Sample | PerformanceCounter Sample | perf_object | perfmon | ATL Server Attributes | COM Attributes | Data Member Attributes | Performance Monitoring Reference | Attributes Samples

Show:
© 2014 Microsoft