Skip navigation links
JNA API 4.4.0
com.sun.jna.platform.win32

Interface Pdh

    • Method Detail

      • PdhConnectMachine

        int PdhConnectMachine(String szMachineName)
        Connects 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:
        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. 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:
        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 the Pdh.PDH_COUNTER_PATH_ELEMENTS structure.
        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 null if 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 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:
        PdhAddCounter, Specifying a Counter Path
      • 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
      • 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 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:
        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 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:
        PdhCollectQueryDataWithTime
JNA API 4.4.0

Copyright © 2007-2016 Timothy Wall. All Rights Reserved.