Package com.sun.jna.platform.win32
Class PdhUtil
- java.lang.Object
-
- com.sun.jna.platform.win32.PdhUtil
-
public abstract class PdhUtil extends Object
Pdh utility API.- Author:
- widdis[at]gmail[dot]com
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PdhUtil.PdhEnumObjectItems
Holder Object for PdhEnumObjectsItems.static class
PdhUtil.PdhException
-
Constructor Summary
Constructors Constructor Description PdhUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PdhUtil.PdhEnumObjectItems
PdhEnumObjectItems(String szDataSource, String szMachineName, String szObjectName, int dwDetailLevel)
Utility method to call Pdh's PdhEnumObjectItems that allocates the required memory for the lists parameters based on the type mapping used, calls to PdhEnumObjectItems, and returns the received lists of strings.static int
PdhLookupPerfIndexByEnglishName(String szNameBuffer)
Utility method similar to Pdh's PdhLookupPerfIndexByName that returns the counter index corresponding to the specified counter name in English.static String
PdhLookupPerfNameByIndex(String szMachineName, int dwNameIndex)
Utility method to call Pdh's PdhLookupPerfNameByIndex that allocates the required memory for the szNameBuffer parameter based on the type mapping used, calls to PdhLookupPerfNameByIndex, and returns the received string.
-
-
-
Method Detail
-
PdhLookupPerfNameByIndex
public static String PdhLookupPerfNameByIndex(String szMachineName, int dwNameIndex)
Utility method to call Pdh's PdhLookupPerfNameByIndex that allocates the required memory for the szNameBuffer parameter based on the type mapping used, calls to PdhLookupPerfNameByIndex, and returns the received string.- 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.- Returns:
- Returns the name of the performance object or counter.
-
PdhLookupPerfIndexByEnglishName
public static int PdhLookupPerfIndexByEnglishName(String szNameBuffer)
Utility method similar to Pdh's PdhLookupPerfIndexByName that returns the counter index corresponding to the specified counter name in English. Uses the registry on the local machine to find the index in the English locale, regardless of the current language setting on the machine.- Parameters:
szNameBuffer
- The English name of the performance counter- Returns:
- The counter's index if it exists, or 0 otherwise.
-
PdhEnumObjectItems
public static PdhUtil.PdhEnumObjectItems PdhEnumObjectItems(String szDataSource, String szMachineName, String szObjectName, int dwDetailLevel)
Utility method to call Pdh's PdhEnumObjectItems that allocates the required memory for the lists parameters based on the type mapping used, calls to PdhEnumObjectItems, and returns the received lists of strings.- 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.dwDetailLevel
- Detail level of the performance items to return. All items that are of the specified detail level or less will be returned.- Returns:
- Returns a List of Strings of the counters for the object.
-
-