rename Pdh.getSingleValue to Pdh.getRawValue

This commit is contained in:
Doug MacEachern 2005-06-15 00:17:04 +00:00
parent 77b18f35e2
commit 7eabd263f5
3 changed files with 20 additions and 12 deletions

View File

@ -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) (JNIEnv *env, jclass cur, jlong query, jlong counter, jboolean fmt)
{ {
HCOUNTER h_counter = (HCOUNTER)counter; HCOUNTER h_counter = (HCOUNTER)counter;

View File

@ -39,15 +39,23 @@ public class Pdh extends Win32Bindings {
} }
} }
/**
* @deprecated
* @see #getRawValue(String path)
*/
public double getSingleValue(String path) throws Win32Exception { 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 { 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 { throws Win32Exception {
if (this.hostname != null) { if (this.hostname != null) {
@ -61,7 +69,7 @@ public class Pdh extends Win32Bindings {
h_counter = pdhAddCounter(h_query, path); 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 { public static String[] getInstances(String path) throws Win32Exception {
@ -85,7 +93,7 @@ public class Pdh extends Win32Bindings {
throws Win32Exception; throws Win32Exception;
private static final native void pdhRemoveCounter(long counter) private static final native void pdhRemoveCounter(long counter)
throws Win32Exception; throws Win32Exception;
private static final native double pdhGetSingleValue(long query, private static final native double pdhGetValue(long query,
long counter, long counter,
boolean fmt) boolean fmt)
throws Win32Exception; throws Win32Exception;
@ -226,7 +234,7 @@ public class Pdh extends Win32Bindings {
double val; double val;
try { try {
val = pdh.getSingleValue(query); val = pdh.getRawValue(query);
} catch (Win32Exception e) { } catch (Win32Exception e) {
System.err.println("Unable to get value for " + System.err.println("Unable to get value for " +
" key=" + query + " key=" + query +
@ -263,7 +271,7 @@ public class Pdh extends Win32Bindings {
double val; double val;
try { try {
val = pdh.getSingleValue(query); val = pdh.getRawValue(query);
} catch (Win32Exception e) { } catch (Win32Exception e) {
System.err.println("Unable to get value " + System.err.println("Unable to get value " +
"for key=" + query + "for key=" + query +

View File

@ -13,7 +13,7 @@ public class TestPdh extends SigarTestCase {
Pdh pdh = new Pdh(); Pdh pdh = new Pdh();
assertGtZeroTrace("raw..." + key, assertGtZeroTrace("raw..." + key,
(long)pdh.getSingleValue(key)); (long)pdh.getRawValue(key));
assertGtZeroTrace("fmt..." + key, assertGtZeroTrace("fmt..." + key,
(long)pdh.getFormattedValue(key)); (long)pdh.getFormattedValue(key));
} }