Package com.sun.jna.platform.win32
Interface Pdh
-
- All Superinterfaces:
AltCallingConvention,Library,StdCall,StdCallLibrary
public interface Pdh extends StdCallLibrary
Windows Performance Data Helper (a.k.a. PDH).- Author:
- Lyor Goldstein
- See Also:
- Performance Counters
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classPdh.PDH_COUNTER_PATH_ELEMENTSComponents of a counter pathstatic classPdh.PDH_RAW_COUNTERThe data as it was collected from the counter provider.static classPdh.PDH_TIME_INFOInformation on time intervals as applied to the sampling of performance data.-
Nested classes/interfaces inherited from interface com.sun.jna.Library
Library.Handler
-
Nested classes/interfaces inherited from interface com.sun.jna.win32.StdCallLibrary
StdCallLibrary.StdCallCallback
-
-
Field Summary
Fields Modifier and Type Field Description static PdhINSTANCEstatic intPDH_CVERSION_WIN40static intPDH_CVERSION_WIN50static intPDH_FMT_1000static intPDH_FMT_ANSIstatic intPDH_FMT_DOUBLEstatic intPDH_FMT_LARGEstatic intPDH_FMT_LONGstatic intPDH_FMT_NOCAP100static intPDH_FMT_NODATAstatic intPDH_FMT_NOSCALEstatic intPDH_FMT_RAWstatic intPDH_FMT_UNICODEstatic intPDH_MAX_COUNTER_NAMEMaximum counter name length.static intPDH_MAX_COUNTER_PATHMaximum full counter path length.static intPDH_MAX_DATASOURCE_PATHMaximum full counter log name length.static intPDH_MAX_INSTANCE_NAMEMaximum counter instance name length.static intPDH_PATH_WBEM_INPUTstatic intPDH_PATH_WBEM_RESULTstatic intPDH_VERSIONstatic intPERF_DETAIL_COSTLYstatic intPERF_DETAIL_STANDARD-
Fields inherited from interface com.sun.jna.Library
OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_CLASSLOADER, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRING_ENCODING, OPTION_STRUCTURE_ALIGNMENT, OPTION_TYPE_MAPPER
-
Fields inherited from interface com.sun.jna.win32.StdCallLibrary
FUNCTION_MAPPER, STDCALL_CONVENTION
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intPdhAddCounter(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.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)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 Detail
-
INSTANCE
static final Pdh INSTANCE
-
PDH_MAX_COUNTER_NAME
static final int PDH_MAX_COUNTER_NAME
Maximum counter name length.- See Also:
- Constant Field Values
-
PDH_MAX_INSTANCE_NAME
static final int PDH_MAX_INSTANCE_NAME
Maximum counter instance name length.- See Also:
- Constant Field Values
-
PDH_MAX_COUNTER_PATH
static final int PDH_MAX_COUNTER_PATH
Maximum full counter path length.- See Also:
- Constant Field Values
-
PDH_MAX_DATASOURCE_PATH
static final int PDH_MAX_DATASOURCE_PATH
Maximum full counter log name length.- See Also:
- Constant Field Values
-
PDH_CVERSION_WIN40
static final int PDH_CVERSION_WIN40
- See Also:
- Constant Field Values
-
PDH_CVERSION_WIN50
static final int PDH_CVERSION_WIN50
- See Also:
- Constant Field Values
-
PDH_VERSION
static final int PDH_VERSION
- See Also:
- Constant Field Values
-
PDH_PATH_WBEM_RESULT
static final int PDH_PATH_WBEM_RESULT
- See Also:
- Constant Field Values
-
PDH_PATH_WBEM_INPUT
static final int PDH_PATH_WBEM_INPUT
- See Also:
- Constant Field Values
-
PDH_FMT_RAW
static final int PDH_FMT_RAW
- See Also:
- Constant Field Values
-
PDH_FMT_ANSI
static final int PDH_FMT_ANSI
- See Also:
- Constant Field Values
-
PDH_FMT_UNICODE
static final int PDH_FMT_UNICODE
- See Also:
- Constant Field Values
-
PDH_FMT_LONG
static final int PDH_FMT_LONG
- See Also:
- Constant Field Values
-
PDH_FMT_DOUBLE
static final int PDH_FMT_DOUBLE
- See Also:
- Constant Field Values
-
PDH_FMT_LARGE
static final int PDH_FMT_LARGE
- See Also:
- Constant Field Values
-
PDH_FMT_NOSCALE
static final int PDH_FMT_NOSCALE
- See Also:
- Constant Field Values
-
PDH_FMT_1000
static final int PDH_FMT_1000
- See Also:
- Constant Field Values
-
PDH_FMT_NODATA
static final int PDH_FMT_NODATA
- See Also:
- Constant Field Values
-
PDH_FMT_NOCAP100
static final int PDH_FMT_NOCAP100
- See Also:
- Constant Field Values
-
PERF_DETAIL_COSTLY
static final int PERF_DETAIL_COSTLY
- See Also:
- Constant Field Values
-
PERF_DETAIL_STANDARD
static final int PERF_DETAIL_STANDARD
- See Also:
- Constant Field Values
-
-
Method Detail
-
PdhConnectMachine
int PdhConnectMachine(String szMachineName)
Connects to the specified computer.- Parameters:
szMachineName- The name of the computer to connect to. Ifnull, PDH connects to the local computer.- Returns:
- ERROR_SUCCESS if successful
- See Also:
- PdhConnectMachine
-
PdhGetDllVersion
int PdhGetDllVersion(WinDef.DWORDByReference lpdwVersion)
Returns 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:
- PdhGetDllVersion
-
PdhOpenQuery
int 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. Ifnull, 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:
- PdhOpenQuery
-
PdhCloseQuery
int PdhCloseQuery(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.- Parameters:
hQuery- Handle to the query to close.- Returns:
- ERROR_SUCCESS if successful
- See Also:
- PdhCloseQuery
-
PdhMakeCounterPath
int 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 pathszFullPathBuffer- Caller-allocated buffer that receives a null-terminated counter path. The maximum length of a counter path is PDH_MAX_COUNTER_PATH. Set tonullif 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:
- PdhMakeCounterPath
-
PdhAddCounter
int 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 isPDH_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:
- PdhAddCounter, Specifying a Counter Path
-
PdhAddEnglishCounter
int PdhAddEnglishCounter(WinNT.HANDLE hQuery, String szFullCounterPath, BaseTSD.DWORD_PTR dwUserData, WinNT.HANDLEByReference phCounter)
-
PdhRemoveCounter
int PdhRemoveCounter(WinNT.HANDLE hCounter)
Removes a counter from a query.- Parameters:
hCounter- Handle of the counter to remove from its query.- Returns:
- ERROR_SUCCESS if successful
- See Also:
- PdhRemoveCounter
-
PdhGetRawCounterValue
int 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 optionalpValue- ThePdh.PDH_RAW_COUNTERstructure to receive the data- Returns:
- ERROR_SUCCESS if successful
- See Also:
- PdhGetRawCounterValue
-
PdhValidatePath
int PdhValidatePath(String szFullCounterPath)
Validates 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:
- PdhValidatePath
-
PdhCollectQueryData
int PdhCollectQueryData(WinNT.HANDLE hQuery)
Collects 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:
- PdhCollectQueryData
-
PdhCollectQueryDataEx
int PdhCollectQueryDataEx(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. The function then signals the application-defined event and waits the specified time interval before returning.- Parameters:
hQuery- Handle to the querydwIntervalTime- 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 theKernel32.CreateEvent(com.sun.jna.platform.win32.WinBase.SECURITY_ATTRIBUTES, boolean, boolean, String)function- Returns:
- ERROR_SUCCESS if successful
- See Also:
- PdhCollectQueryDataEx
-
PdhCollectQueryDataWithTime
int PdhCollectQueryDataWithTime(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.- Parameters:
hQuery- Handle to the querypllTimeStamp- Time stamp when the first counter value in the query was retrieved. The time is specified asWinBase.FILETIME.- Returns:
- ERROR_SUCCESS if successful
- See Also:
- PdhCollectQueryDataWithTime
-
PdhSetQueryTimeRange
int PdhSetQueryTimeRange(WinNT.HANDLE hQuery, Pdh.PDH_TIME_INFO pInfo)
- Parameters:
hQuery- Handle to the query.pInfo- APdh.PDH_TIME_INFOstructure that specifies the time range.- Returns:
- ERROR_SUCCESS if successful
- See Also:
- PdhSetQueryTimeRange
-
-