[SIGAR-26] Change Pdh.getFormattedValue() to collect 2 counters if needed

This commit is contained in:
Doug MacEachern committed 2006-12-04 19:45:00 +00:00
1 parent d4f10e9cc7
commit 228ee133be
2 files changed
+18 -5

No files matched your search

+13 -4
View File
@@ -173,10 +173,19 @@ JNIEXPORT jdouble SIGAR_JNI(win32_Pdh_pdhGetValue)
}
if (fmt) {
status = PdhGetFormattedCounterValue(h_counter,
PDH_FMT_DOUBLE,
(LPDWORD)NULL,
&fmt_value);
/* may require 2 counters, see msdn docs */
int i=0;
for (i=0; i<2; i++) {
status = PdhGetFormattedCounterValue(h_counter,
PDH_FMT_DOUBLE,
(LPDWORD)NULL,
&fmt_value);
if (status == ERROR_SUCCESS) {
break;
}
PdhCollectQueryData(h_query);
}
}
else {
status = PdhGetRawCounterValue(h_counter, &type, &raw_value);