diff --git a/bindings/java/src/jni/win32/pdh.c b/bindings/java/src/jni/win32/pdh.c index 4c7ca6a6..a0449630 100644 --- a/bindings/java/src/jni/win32/pdh.c +++ b/bindings/java/src/jni/win32/pdh.c @@ -126,7 +126,7 @@ JNIEXPORT void SIGAR_JNI(win32_Pdh_pdhRemoveCounter) } } -JNIEXPORT jdouble SIGAR_JNI(win32_Pdh_pdhGetSingleValue) +JNIEXPORT jdouble SIGAR_JNI(win32_Pdh_pdhGetValue) (JNIEnv *env, jclass cur, jlong query, jlong counter, jboolean fmt) { HCOUNTER h_counter = (HCOUNTER)counter; diff --git a/bindings/java/src/net/hyperic/sigar/win32/Pdh.java b/bindings/java/src/net/hyperic/sigar/win32/Pdh.java index 911e4fb3..4a51cdf0 100644 --- a/bindings/java/src/net/hyperic/sigar/win32/Pdh.java +++ b/bindings/java/src/net/hyperic/sigar/win32/Pdh.java @@ -38,16 +38,24 @@ public class Pdh extends Win32Bindings { h_query = -1l; } } - + + /** + * @deprecated + * @see #getRawValue(String path) + */ public double getSingleValue(String path) throws Win32Exception { - return getSingleValue(path, false); + return getRawValue(path); + } + + public double getRawValue(String path) throws Win32Exception { + return getValue(path, false); } public double getFormattedValue(String path) throws Win32Exception { - return getSingleValue(path, true); + return getValue(path, true); } - private double getSingleValue(String path, boolean format) + private double getValue(String path, boolean format) throws Win32Exception { if (this.hostname != null) { @@ -61,7 +69,7 @@ public class Pdh extends Win32Bindings { h_counter = pdhAddCounter(h_query, path); - return pdhGetSingleValue(h_query, h_counter, format); + return pdhGetValue(h_query, h_counter, format); } public static String[] getInstances(String path) throws Win32Exception { @@ -85,9 +93,9 @@ public class Pdh extends Win32Bindings { throws Win32Exception; private static final native void pdhRemoveCounter(long counter) throws Win32Exception; - private static final native double pdhGetSingleValue(long query, - long counter, - boolean fmt) + private static final native double pdhGetValue(long query, + long counter, + boolean fmt) throws Win32Exception; private static final native String[] pdhGetInstances(String path) throws Win32Exception; @@ -226,7 +234,7 @@ public class Pdh extends Win32Bindings { double val; try { - val = pdh.getSingleValue(query); + val = pdh.getRawValue(query); } catch (Win32Exception e) { System.err.println("Unable to get value for " + " key=" + query + @@ -263,7 +271,7 @@ public class Pdh extends Win32Bindings { double val; try { - val = pdh.getSingleValue(query); + val = pdh.getRawValue(query); } catch (Win32Exception e) { System.err.println("Unable to get value " + "for key=" + query + diff --git a/bindings/java/src/net/hyperic/sigar/win32/test/TestPdh.java b/bindings/java/src/net/hyperic/sigar/win32/test/TestPdh.java index 581cdeac..f502614e 100644 --- a/bindings/java/src/net/hyperic/sigar/win32/test/TestPdh.java +++ b/bindings/java/src/net/hyperic/sigar/win32/test/TestPdh.java @@ -13,7 +13,7 @@ public class TestPdh extends SigarTestCase { Pdh pdh = new Pdh(); assertGtZeroTrace("raw..." + key, - (long)pdh.getSingleValue(key)); + (long)pdh.getRawValue(key)); assertGtZeroTrace("fmt..." + key, (long)pdh.getFormattedValue(key)); }