(SIGAR-207) Add Pdh.getCounterType method

This commit is contained in:
Doug MacEachern committed 2010-03-31 14:54:25 -07:00
1 parent 7905904cb6
commit 2dc981dfa8
3 files changed
+43

No files matched your search

+17
View File
@@ -254,6 +254,23 @@ JNIEXPORT jstring SIGAR_JNI(win32_Pdh_pdhGetDescription)
return retval;
}
JNIEXPORT jlong SIGAR_JNI(win32_Pdh_pdhGetCounterType)
(JNIEnv *env, jclass cur, jlong counter)
{
HCOUNTER h_counter = (HCOUNTER)counter;
PDH_COUNTER_INFO info;
DWORD size = sizeof(info);
PDH_STATUS status;
status = PdhGetCounterInfo(h_counter, FALSE, &size, &info);
if (status != ERROR_SUCCESS) {
win32_throw_exception(env, get_error_message(status));
return -1;
}
return info.dwType;
}
JNIEXPORT jobjectArray SIGAR_JNI(win32_Pdh_pdhGetInstances)
(JNIEnv *env, jclass cur, jstring cp)
{