Hi,
I'm trying to create entry from Java program to hsperfdata through
sun.misc.PerfCounter .
However, I cannot watch the updated value in my entry through the jstat with
interval option.
I guess this cause is that wrong arguments are passed from PerfCounter#<init>
to Perf#createLong .
sun.misc.PerfCounter:
---------
private PerfCounter(String name, int type) {
this.name = name;
ByteBuffer bb = perf.createLong(name, U_None, type, 0L);
bb.order(ByteOrder.nativeOrder());
this.lb = bb.asLongBuffer();
}
---------
sun.misc.Perf:
---------
public native ByteBuffer createLong(String name, int variability,
int units, long value);
---------
"type" in constructor of PerfCounter means "variability".
So "type" should be set to 2nd argument in perf.createLong()
perf.createLong() should be called as following:
---------
ByteBuffer bb = perf.createLong(name, type, U_None, 0L);
---------
I've applied a patch which is attached in this email, it's works fine.
Thanks,
Yasumasa
diff -r 43da85020921 src/share/classes/sun/misc/PerfCounter.java
--- a/src/share/classes/sun/misc/PerfCounter.java Thu Apr 04 19:05:32
2013 -0700
+++ b/src/share/classes/sun/misc/PerfCounter.java Tue Apr 09 17:45:20
2013 +0900
@@ -62,7 +62,7 @@
private PerfCounter(String name, int type) {
this.name = name;
- ByteBuffer bb = perf.createLong(name, U_None, type, 0L);
+ ByteBuffer bb = perf.createLong(name, type, U_None, 0L);
bb.order(ByteOrder.nativeOrder());
this.lb = bb.asLongBuffer();
}