add PdhLookupPerfIndexByName wrapper
This commit is contained in:
parent
a4f7770067
commit
9289f45dce
|
@ -430,6 +430,26 @@ JNIEXPORT jstring SIGAR_JNI(win32_Pdh_pdhLookupPerfName)
|
|||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jint SIGAR_JNI(win32_Pdh_pdhLookupPerfIndex)
|
||||
(JNIEnv *env, jclass cur, jstring jname)
|
||||
{
|
||||
DWORD index;
|
||||
LPCTSTR name =
|
||||
JENV->GetStringChars(env, jname, NULL);
|
||||
PDH_STATUS status =
|
||||
PdhLookupPerfIndexByNameW(NULL, name, &index);
|
||||
|
||||
JENV->ReleaseStringChars(env, jname, name);
|
||||
|
||||
if (status == ERROR_SUCCESS) {
|
||||
return index;
|
||||
}
|
||||
else {
|
||||
win32_throw_exception(env, get_error_message(status));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -253,6 +253,8 @@ public class Pdh extends Win32 {
|
|||
throws Win32Exception;
|
||||
private static final native String pdhLookupPerfName(int index)
|
||||
throws Win32Exception;
|
||||
private static final native int pdhLookupPerfIndex(String name)
|
||||
throws Win32Exception;
|
||||
|
||||
/**
|
||||
* Main method for dumping the entire PDH
|
||||
|
|
Loading…
Reference in New Issue