网站首页  词典首页

请输入您要查询的函数:

 

术语 pdhgetformattedcountervalue
释义 PdhGetFormattedCounterValue
语法:
C++
PDH_STATUS PdhGetFormattedCounterValue(
__in PDH_HCOUNTER hCounter,
__in DWORD dwFormat,
__out LPDWORD lpdwType,
__out PPDH_FMT_COUNTERVALUE pValue
);
PdhGetFormattedCounterValue功能
计算一个指定的计数器显示的值。
参数
hCounter [in]
处理的柜台您要计算出一个可显示的值。该PdhAddCounter函数返回此句柄。
dwFormat [in]
决定了格式化值的数据类型。指定下列值之一。
ValueMeaning
作为一个双精度浮点真正PDH_FMT_DOUBLEReturn数据。
作为一个64位整数PDH_FMT_LARGEReturn数据。
作为一个长整型PDH_FMT_LONGReturn数据。
您可以使用按位包容性的OR运算符(|)来组合与下列因素之一缩放的数据类型。
ValueMeaning
PDH_FMT_NOSCALEDo不适用于计数器的默认缩放因子。
PDH_FMT_NOCAP100Counter值大于100(例如,计数器值衡量处理器的多处理器计算机上的负载)将不会被重置为100。默认行为是计数器的值是在100值上限。
PDH_FMT_1000Multiply由1000的实际价值。
lpdwType [out]
接收计数器类型。对于反类型的列表,请参阅在Windows Server 2003部署工具包计数器类型部分。此参数是可选的。
pValue [out]
阿PDH_FMT_COUNTERVALUE结构,接收计数器的值。
返回值
如果函数成功,它返回ERROR_SUCCESS。
如果函数失败,返回值是一个系统错误代码或一种PDH错误代码。以下是可能的值。
返回codeDescription
PDH_INVALID_ARGUMENTA参数无效或格式不正确。
PDH_INVALID_DATAThe指定的计数器不包含有效数据或一个成功的状态代码。
PDH_INVALID_HANDLEThe计数器句柄无效。
备注
该计数器的数据被锁定(保护的通话时间),以PdhGetFormattedCounterValue,以防止在呼叫处理的任何变化。读数据(调用这个函数成功)清除数据改变了反旗。
费率电表等一些计数器,需要两个计数器的值,以便计算出一个可显示的值。在这种情况下,您必须调用两次调用PdhGetFormattedCounterValue PdhCollectQueryData。有关更多信息,请参阅收集性能数据。
如果指定的计数器实例不存在,该方法将返回PDH_INVALID_DATA和设置PDH_FMT_COUNTERVALUE结构CStatus成员PDH_CSTATUS_NO_INSTANCE。
在此之前的Windows Server 2003:格式调用可能失败的计数器,只需要一个值时,该实例没有找到。尝试调用查询和格式,再次要求。如果格式调用失败,第二次,实例找不到。作为替代方案,您可以调用PdhEnumObjects功能设置为TRUE的刷新选项,刷新前查询和格式化数据的计数器计数器实例。
实例
有关示例,请浏览性能计数器或读取日志文件的性能数据。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderPdh.h
LibraryPdh.lib
DLLPdh.dll
参见
PdhCollectQueryData
PdhGetRawCounterValue
PdhSetCounterScaleFactor
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月23日
==英文原文==PdhGetFormattedCounterValue Function
Computes a displayable value for the specified counter.
Syntax
C++
PDH_STATUS PdhGetFormattedCounterValue(
__in PDH_HCOUNTER hCounter,
__in DWORD dwFormat,
__out LPDWORD lpdwType,
__out PPDH_FMT_COUNTERVALUE pValue
);
Parameters
hCounter [in]
Handle of the counter for which you want to compute a displayable value. The PdhAddCounter function returns this handle.
dwFormat [in]
Determines the data type of the formatted value. Specify one of the following values.
ValueMeaning
PDH_FMT_DOUBLEReturn data as a double-precision floating point real.
PDH_FMT_LARGEReturn data as a 64-bit integer.
PDH_FMT_LONGReturn data as a long integer.

You can use the bitwise inclusive OR operator (|) to combine the data type with one of the following scaling factors.
ValueMeaning
PDH_FMT_NOSCALEDo not apply the counter's default scaling factor.
PDH_FMT_NOCAP100Counter values greater than 100 (for example, counter values measuring the processor load on multiprocessor computers) will not be reset to 100. The default behavior is that counter values are capped at a value of 100.
PDH_FMT_1000Multiply the actual value by 1,000.

lpdwType [out]
Receives the counter type. For a list of counter types, see the Counter Types section of the Windows Server 2003 Deployment Kit . This parameter is optional.
pValue [out]
A PDH_FMT_COUNTERVALUE structure that receives the counter value.
Return Value
If the function succeeds, it returns ERROR_SUCCESS.
If the function fails, the return value is a system error code or a PDH error code . The following are possible values.
Return codeDescription
PDH_INVALID_ARGUMENTA parameter is not valid or is incorrectly formatted.
PDH_INVALID_DATAThe specified counter does not contain valid data or a successful status code.
PDH_INVALID_HANDLEThe counter handle is not valid.

Remarks
The data for the counter is locked (protected) for the duration of the call to PdhGetFormattedCounterValue to prevent any changes during the processing of the call. Reading the data (calling this function successfully) clears the data-changed flag for the counter.
Some counters, such as rate counters, require two counter values in order to compute a displayable value. In this case you must call PdhCollectQueryData twice before calling PdhGetFormattedCounterValue. For more information, see Collecting Performance Data .
If the specified counter instance does not exist, the method will return PDH_INVALID_DATA and set the CStatus member of the PDH_FMT_COUNTERVALUE structure to PDH_CSTATUS_NO_INSTANCE.
Prior to Windows Server 2003: The format call may fail for counters that require only a single value when the instance is not found. Try calling the query and format calls again. If the format call fails the second time, the instance is not found. As an alternative, you can call the PdhEnumObjects function with the refresh option set to TRUE to refresh the counter instances before querying and formatting the counter data.
Examples
For an example, see Browsing Performance Counters or Reading Performance Data from a Log File .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderPdh.h
LibraryPdh.lib
DLLPdh.dll
See Also
PdhCollectQueryData
PdhGetRawCounterValue
PdhSetCounterScaleFactor
Send comments about this topic to Microsoft
Build date: 7/23/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa372637(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:23:08