Package com.sun.jna.platform.win32
Interface Pdh
- All Superinterfaces:
- AltCallingConvention,- Library,- StdCall,- StdCallLibrary
Windows Performance Data Helper (a.k.a. PDH).
- Author:
- Lyor Goldstein
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic classComponents of a counter pathstatic classThe data as it was collected from the counter provider.static classInformation on time intervals as applied to the sampling of performance data.Nested classes/interfaces inherited from interface com.sun.jna.LibraryLibrary.HandlerNested classes/interfaces inherited from interface com.sun.jna.win32.StdCallLibraryStdCallLibrary.StdCallCallback
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Pdhstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intMaximum counter name length.static final intMaximum full counter path length.static final intMaximum full counter log name length.static final intMaximum counter instance name length.static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from interface com.sun.jna.LibraryOPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_CLASSLOADER, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRING_ENCODING, OPTION_STRUCTURE_ALIGNMENT, OPTION_SYMBOL_PROVIDER, OPTION_TYPE_MAPPERFields inherited from interface com.sun.jna.win32.StdCallLibraryFUNCTION_MAPPER, STDCALL_CONVENTION
- 
Method SummaryModifier and TypeMethodDescriptionintPdhAddCounter(WinNT.HANDLE hQuery, String szFullCounterPath, BaseTSD.DWORD_PTR dwUserData, WinNT.HANDLEByReference phCounter) Adds the specified counter to the query.intPdhAddEnglishCounter(WinNT.HANDLE hQuery, String szFullCounterPath, BaseTSD.DWORD_PTR dwUserData, WinNT.HANDLEByReference phCounter) intPdhCloseQuery(WinNT.HANDLE hQuery) Closes all counters contained in the specified query, closes all handles related to the query, and frees all memory associated with the query.intPdhCollectQueryData(WinNT.HANDLE hQuery) Collects the current raw data value for all counters in the specified query and updates the status code of each counter.intPdhCollectQueryDataEx(WinNT.HANDLE hQuery, int dwIntervalTime, WinNT.HANDLE hNewDataEvent) Uses a separate thread to collect the current raw data value for all counters in the specified query.intPdhCollectQueryDataWithTime(WinNT.HANDLE hQuery, WinDef.LONGLONGByReference pllTimeStamp) Collects the current raw data value for all counters in the specified query and updates the status code of each counter.intPdhConnectMachine(String szMachineName) Connects to the specified computer.intPdhEnumObjectItems(String szDataSource, String szMachineName, String szObjectName, Pointer mszCounterList, WinDef.DWORDByReference pcchCounterListLength, Pointer mszInstanceList, WinDef.DWORDByReference pcchInstanceListLength, int dwDetailLevel, int dwFlags) Returns the specified object's counter and instance names that exist on the specified computer or in the specified log file.intPdhGetDllVersion(WinDef.DWORDByReference lpdwVersion) Returns the version of the currently installed Pdh.dll file.intPdhGetRawCounterValue(WinNT.HANDLE hCounter, WinDef.DWORDByReference lpdwType, Pdh.PDH_RAW_COUNTER pValue) intPdhLookupPerfIndexByName(String szMachineName, String szNameBuffer, WinDef.DWORDByReference pdwIndex) Returns the counter index corresponding to the specified counter name.intPdhLookupPerfNameByIndex(String szMachineName, int dwNameIndex, Pointer szNameBuffer, WinDef.DWORDByReference pcchNameBufferSize) Returns the performance object name or counter name corresponding to the specified index.intPdhMakeCounterPath(Pdh.PDH_COUNTER_PATH_ELEMENTS pCounterPathElements, char[] szFullPathBuffer, WinDef.DWORDByReference pcchBufferSize, int dwFlags) Creates a full counter path using the members specified in thePdh.PDH_COUNTER_PATH_ELEMENTSstructure.intPdhOpenQuery(String szDataSource, BaseTSD.DWORD_PTR dwUserData, WinNT.HANDLEByReference phQuery) Creates a new query that is used to manage the collection of performance data.intPdhRemoveCounter(WinNT.HANDLE hCounter) Removes a counter from a query.intPdhSetQueryTimeRange(WinNT.HANDLE hQuery, Pdh.PDH_TIME_INFO pInfo) intPdhValidatePath(String szFullCounterPath) Validates that the counter is present on the computer specified in the counter path.
- 
Field Details- 
INSTANCE
- 
PDH_MAX_COUNTER_NAMEstatic final int PDH_MAX_COUNTER_NAMEMaximum counter name length.- See Also:
 
- 
PDH_MAX_INSTANCE_NAMEstatic final int PDH_MAX_INSTANCE_NAMEMaximum counter instance name length.- See Also:
 
- 
PDH_MAX_COUNTER_PATHstatic final int PDH_MAX_COUNTER_PATHMaximum full counter path length.- See Also:
 
- 
PDH_MAX_DATASOURCE_PATHstatic final int PDH_MAX_DATASOURCE_PATHMaximum full counter log name length.- See Also:
 
- 
PDH_MORE_DATAstatic final int PDH_MORE_DATA- See Also:
 
- 
PDH_INSUFFICIENT_BUFFERstatic final int PDH_INSUFFICIENT_BUFFER- See Also:
 
- 
PDH_INVALID_ARGUMENTstatic final int PDH_INVALID_ARGUMENT- See Also:
 
- 
PDH_MEMORY_ALLOCATION_FAILUREstatic final int PDH_MEMORY_ALLOCATION_FAILURE- See Also:
 
- 
PDH_CSTATUS_NO_MACHINEstatic final int PDH_CSTATUS_NO_MACHINE- See Also:
 
- 
PDH_CSTATUS_NO_OBJECTstatic final int PDH_CSTATUS_NO_OBJECT- See Also:
 
- 
PDH_CVERSION_WIN40static final int PDH_CVERSION_WIN40- See Also:
 
- 
PDH_CVERSION_WIN50static final int PDH_CVERSION_WIN50- See Also:
 
- 
PDH_VERSIONstatic final int PDH_VERSION- See Also:
 
- 
PDH_PATH_WBEM_RESULTstatic final int PDH_PATH_WBEM_RESULT- See Also:
 
- 
PDH_PATH_WBEM_INPUTstatic final int PDH_PATH_WBEM_INPUT- See Also:
 
- 
PDH_FMT_RAWstatic final int PDH_FMT_RAW- See Also:
 
- 
PDH_FMT_ANSIstatic final int PDH_FMT_ANSI- See Also:
 
- 
PDH_FMT_UNICODEstatic final int PDH_FMT_UNICODE- See Also:
 
- 
PDH_FMT_LONGstatic final int PDH_FMT_LONG- See Also:
 
- 
PDH_FMT_DOUBLEstatic final int PDH_FMT_DOUBLE- See Also:
 
- 
PDH_FMT_LARGEstatic final int PDH_FMT_LARGE- See Also:
 
- 
PDH_FMT_NOSCALEstatic final int PDH_FMT_NOSCALE- See Also:
 
- 
PDH_FMT_1000static final int PDH_FMT_1000- See Also:
 
- 
PDH_FMT_NODATAstatic final int PDH_FMT_NODATA- See Also:
 
- 
PDH_FMT_NOCAP100static final int PDH_FMT_NOCAP100- See Also:
 
- 
PERF_DETAIL_COSTLYstatic final int PERF_DETAIL_COSTLY- See Also:
 
- 
PERF_DETAIL_STANDARDstatic final int PERF_DETAIL_STANDARD- See Also:
 
 
- 
- 
Method Details- 
PdhConnectMachineConnects to the specified computer.- Parameters:
- szMachineName- The name of the computer to connect to. If- null, PDH connects to the local computer.
- Returns:
- ERROR_SUCCESS if successful
- See Also:
 
- 
PdhGetDllVersionReturns the version of the currently installed Pdh.dll file.- Parameters:
- lpdwVersion- A variable that receives the version of Pdh.dll.
- Returns:
- ERROR_SUCCESS if successful
- See Also:
 
- 
PdhOpenQueryint PdhOpenQuery(String szDataSource, BaseTSD.DWORD_PTR dwUserData, WinNT.HANDLEByReference phQuery) Creates a new query that is used to manage the collection of performance data.- Parameters:
- szDataSource- The name of the log file from which to retrieve performance data. If- null, performance data is collected from a real-time data source.
- dwUserData- User-defined value to associate with this query.
- phQuery- (Out) Handle to the query. You use this handle in subsequent calls.
- Returns:
- ERROR_SUCCESS if successful
- See Also:
 
- 
PdhCloseQueryCloses all counters contained in the specified query, closes all handles related to the query, and frees all memory associated with the query.- Parameters:
- hQuery- Handle to the query to close.
- Returns:
- ERROR_SUCCESS if successful
- See Also:
 
- 
PdhMakeCounterPathint PdhMakeCounterPath(Pdh.PDH_COUNTER_PATH_ELEMENTS pCounterPathElements, char[] szFullPathBuffer, WinDef.DWORDByReference pcchBufferSize, int dwFlags) Creates a full counter path using the members specified in thePdh.PDH_COUNTER_PATH_ELEMENTSstructure.- Parameters:
- pCounterPathElements- Structure that contains the members used to make up the path
- szFullPathBuffer- Caller-allocated buffer that receives a null-terminated counter path. The maximum length of a counter path is PDH_MAX_COUNTER_PATH. Set to- nullif pcchBufferSize is zero.
- pcchBufferSize- Size of the szFullPathBuffer buffer. If zero on input, the function returns PDH_MORE_DATA and sets this parameter to the required buffer size. If the buffer is larger than the required size, the function sets this parameter to the actual size of the buffer that was used.
- dwFlags- Format of the input and output counter values.
- Returns:
- ERROR_SUCCESS (or PDH_MORE_DATA)
- See Also:
 
- 
PdhAddCounterint PdhAddCounter(WinNT.HANDLE hQuery, String szFullCounterPath, BaseTSD.DWORD_PTR dwUserData, WinNT.HANDLEByReference phCounter) Adds the specified counter to the query.- Parameters:
- hQuery- Handle to the query to which you want to add the counter.
- szFullCounterPath- String that contains the counter path. The maximum length of a counter path is- PDH_MAX_COUNTER_PATH.
- dwUserData- User-defined value.
- phCounter- (Out) Handle to the counter that was added to the query.
- Returns:
- ERROR_SUCCESS if successful
- See Also:
 
- 
PdhAddEnglishCounterint PdhAddEnglishCounter(WinNT.HANDLE hQuery, String szFullCounterPath, BaseTSD.DWORD_PTR dwUserData, WinNT.HANDLEByReference phCounter) 
- 
PdhRemoveCounterRemoves a counter from a query.- Parameters:
- hCounter- Handle of the counter to remove from its query.
- Returns:
- ERROR_SUCCESS if successful
- See Also:
 
- 
PdhGetRawCounterValueint PdhGetRawCounterValue(WinNT.HANDLE hCounter, WinDef.DWORDByReference lpdwType, Pdh.PDH_RAW_COUNTER pValue) - Parameters:
- hCounter- Handle of the counter from which to retrieve the current raw value.
- lpdwType- Receives the counter type - this parameter is optional
- pValue- The- Pdh.PDH_RAW_COUNTERstructure to receive the data
- Returns:
- ERROR_SUCCESS if successful
- See Also:
 
- 
PdhValidatePathValidates that the counter is present on the computer specified in the counter path.- Parameters:
- szFullCounterPath- The counter path to validate
- Returns:
- ERROR_SUCCESS if successful
- See Also:
 
- 
PdhCollectQueryDataCollects the current raw data value for all counters in the specified query and updates the status code of each counter.- Parameters:
- hQuery- Handle to the query
- Returns:
- ERROR_SUCCESS if successful
- See Also:
 
- 
PdhCollectQueryDataExUses a separate thread to collect the current raw data value for all counters in the specified query. The function then signals the application-defined event and waits the specified time interval before returning.- Parameters:
- hQuery- Handle to the query
- dwIntervalTime- Time interval to wait, in seconds.
- hNewDataEvent- Handle to the event that you want PDH to signal after the time interval expires. To create an event object, call the- Kernel32.CreateEvent(com.sun.jna.platform.win32.WinBase.SECURITY_ATTRIBUTES, boolean, boolean, String)function
- Returns:
- ERROR_SUCCESS if successful
- See Also:
 
- 
PdhCollectQueryDataWithTimeCollects the current raw data value for all counters in the specified query and updates the status code of each counter.- Parameters:
- hQuery- Handle to the query
- pllTimeStamp- Time stamp when the first counter value in the query was retrieved. The time is specified as- WinBase.FILETIME.
- Returns:
- ERROR_SUCCESS if successful
- See Also:
 
- 
PdhSetQueryTimeRange- Parameters:
- hQuery- Handle to the query.
- pInfo- A- Pdh.PDH_TIME_INFOstructure that specifies the time range.
- Returns:
- ERROR_SUCCESS if successful
- See Also:
 
- 
PdhEnumObjectItemsint PdhEnumObjectItems(String szDataSource, String szMachineName, String szObjectName, Pointer mszCounterList, WinDef.DWORDByReference pcchCounterListLength, Pointer mszInstanceList, WinDef.DWORDByReference pcchInstanceListLength, int dwDetailLevel, int dwFlags) Returns the specified object's counter and instance names that exist on the specified computer or in the specified log file.- Parameters:
- szDataSource- String that specifies the name of the log file used to enumerate the counter and instance names. If NULL, the function uses the computer specified in the szMachineName parameter to enumerate the names.
- szMachineName- String that specifies the name of the computer that contains the counter and instance names that you want to enumerate. Include the leading slashes in the computer name, for example, \\computername. If the szDataSource parameter is NULL, you can set szMachineName to NULL to specify the local computer.
- szObjectName- String that specifies the name of the object whose counter and instance names you want to enumerate.
- mszCounterList- Caller-allocated buffer that receives a list of null-terminated counter names provided by the specified object. The list contains unique counter names. The list is terminated by two NULL characters. Set to NULL if the pcchCounterListLengthparameter is zero.
- pcchCounterListLength- Size of the mszCounterList buffer, in TCHARs. If zero on input and the object exists, the function returns PDH_MORE_DATA and sets this parameter to the required buffer size. If the buffer is larger than the required size, the function sets this parameter to the actual size of the buffer that was used. If the specified size on input is greater than zero but less than the required size, you should not rely on the returned size to reallocate the buffer.
- mszInstanceList- Caller-allocated buffer that receives a list of null-terminated instance names provided by the specified object. The list contains unique instance names. The list is terminated by two NULL characters. Set to NULL if pcchInstanceListLength is zero.
- pcchInstanceListLength- Size of the mszInstanceList buffer, in TCHARs. If zero on input and the object exists, the function returns PDH_MORE_DATA and sets this parameter to the required buffer size. If the buffer is larger than the required size, the function sets this parameter to the actual size of the buffer that was used. If the specified size on input is greater than zero but less than the required size, you should not rely on the returned size to reallocate the buffer. If the specified object does not support variable instances, then the returned value will be zero. If the specified object does support variable instances, but does not currently have any instances, then the value returned is 2, which is the size of an empty MULTI_SZ list string.
- dwDetailLevel- Detail level of the performance items to return. All items that are of the specified detail level or less will be returned.
- dwFlags- This parameter must be zero.
- Returns:
- 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.
- See Also:
 
- 
PdhLookupPerfIndexByNameint PdhLookupPerfIndexByName(String szMachineName, String szNameBuffer, WinDef.DWORDByReference pdwIndex) Returns the counter index corresponding to the specified counter name.- Parameters:
- szMachineName- Null-terminated string that specifies the name of the computer where the specified counter is located. The computer name can be specified by the DNS name or the IP address. If NULL, the function uses the local computer.
- szNameBuffer- Null-terminated string that contains the counter name.
- pdwIndex- Index of the counter.
- Returns:
- 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.
- See Also:
 
- 
PdhLookupPerfNameByIndexint PdhLookupPerfNameByIndex(String szMachineName, int dwNameIndex, Pointer szNameBuffer, WinDef.DWORDByReference pcchNameBufferSize) Returns the performance object name or counter name corresponding to the specified index.- Parameters:
- szMachineName- Null-terminated string that specifies the name of the computer where the specified performance object or counter is located. The computer name can be specified by the DNS name or the IP address. If NULL, the function uses the local computer.
- dwNameIndex- Index of the performance object or counter.
- szNameBuffer- Caller-allocated buffer that receives the null-terminated name of the performance object or counter. Set to NULL if pcchNameBufferSize is zero.
- pcchNameBufferSize- Size of the szNameBuffer buffer, in TCHARs. If zero on input, the function returns PDH_MORE_DATA and sets this parameter to the required buffer size. If the buffer is larger than the required size, the function sets this parameter to the actual size of the buffer that was used. If the specified size on input is greater than zero but less than the required size, you should not rely on the returned size to reallocate the buffer.
- Returns:
- 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.
- See Also:
 
 
-