aboutsummaryrefslogtreecommitdiff
path: root/src/share/classes/sun/jvmstat
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/classes/sun/jvmstat')
-rw-r--r--src/share/classes/sun/jvmstat/monitor/AbstractMonitor.java3
-rw-r--r--src/share/classes/sun/jvmstat/monitor/Monitor.java3
-rw-r--r--src/share/classes/sun/jvmstat/monitor/Units.java128
-rw-r--r--src/share/classes/sun/jvmstat/monitor/Variability.java111
-rw-r--r--src/share/classes/sun/jvmstat/perfdata/monitor/PerfByteArrayMonitor.java2
-rw-r--r--src/share/classes/sun/jvmstat/perfdata/monitor/PerfIntegerMonitor.java2
-rw-r--r--src/share/classes/sun/jvmstat/perfdata/monitor/PerfLongMonitor.java2
-rw-r--r--src/share/classes/sun/jvmstat/perfdata/monitor/PerfStringConstantMonitor.java1
-rw-r--r--src/share/classes/sun/jvmstat/perfdata/monitor/PerfStringMonitor.java2
-rw-r--r--src/share/classes/sun/jvmstat/perfdata/monitor/PerfStringVariableMonitor.java1
-rw-r--r--src/share/classes/sun/jvmstat/perfdata/monitor/v1_0/PerfDataBuffer.java2
-rw-r--r--src/share/classes/sun/jvmstat/perfdata/monitor/v2_0/PerfDataBuffer.java2
12 files changed, 239 insertions, 20 deletions
diff --git a/src/share/classes/sun/jvmstat/monitor/AbstractMonitor.java b/src/share/classes/sun/jvmstat/monitor/AbstractMonitor.java
index 57a2c1e32..b8d50ddc5 100644
--- a/src/share/classes/sun/jvmstat/monitor/AbstractMonitor.java
+++ b/src/share/classes/sun/jvmstat/monitor/AbstractMonitor.java
@@ -25,9 +25,6 @@
package sun.jvmstat.monitor;
-import sun.management.counter.Units;
-import sun.management.counter.Variability;
-
/**
* The base class for Instrumentation Monitoring Objects. This base class
* provides implementations of the {@link Monitor} methods that are common
diff --git a/src/share/classes/sun/jvmstat/monitor/Monitor.java b/src/share/classes/sun/jvmstat/monitor/Monitor.java
index c83a751e2..8560990fd 100644
--- a/src/share/classes/sun/jvmstat/monitor/Monitor.java
+++ b/src/share/classes/sun/jvmstat/monitor/Monitor.java
@@ -25,9 +25,6 @@
package sun.jvmstat.monitor;
-import sun.management.counter.Units;
-import sun.management.counter.Variability;
-
/**
* Interface provided by Instrumentation Monitoring Objects.
*
diff --git a/src/share/classes/sun/jvmstat/monitor/Units.java b/src/share/classes/sun/jvmstat/monitor/Units.java
new file mode 100644
index 000000000..5e632196d
--- /dev/null
+++ b/src/share/classes/sun/jvmstat/monitor/Units.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.jvmstat.monitor;
+
+/**
+ * Provides a typesafe enumeration for describing units of measurement
+ * attribute for instrumentation objects.
+ *
+ * @author Brian Doherty
+ */
+public class Units implements java.io.Serializable {
+
+ /* The enumeration values for this typesafe enumeration must be
+ * kept in synchronization with the Units enum in the perfData.hpp file
+ * in the HotSpot source base.
+ */
+
+ private static final int NUNITS=8;
+
+ private static Units[] map = new Units[NUNITS];
+
+ private final String name;
+ private final int value;
+
+ /**
+ * An Invalid Units value.
+ */
+ public static final Units INVALID = new Units("Invalid", 0);
+
+ /**
+ * Units attribute representing unit-less quantities.
+ */
+ public static final Units NONE = new Units("None", 1);
+
+ /**
+ * Units attribute representing Bytes.
+ */
+ public static final Units BYTES = new Units("Bytes", 2);
+
+ /**
+ * Units attribute representing Ticks.
+ */
+ public static final Units TICKS = new Units("Ticks", 3);
+
+ /**
+ * Units attribute representing a count of events.
+ */
+ public static final Units EVENTS = new Units("Events", 4);
+
+ /**
+ * Units attribute representing String data. Although not really
+ * a unit of measure, this Units value serves to distinguish String
+ * instrumentation objects from instrumentation objects of other types.
+ */
+ public static final Units STRING = new Units("String", 5);
+
+ /**
+ * Units attribute representing Hertz (frequency).
+ */
+ public static final Units HERTZ = new Units("Hertz", 6);
+
+ /**
+ * Returns a string describing this Unit of measurement attribute
+ *
+ * @return String - a descriptive string for this enum.
+ */
+ public String toString() {
+ return name;
+ }
+
+ /**
+ * Returns the integer representation of this Units attribute
+ *
+ * @return int - an integer representation of this Units attribute.
+ */
+ public int intValue() {
+ return value;
+ }
+
+ /**
+ * Maps an integer value to its corresponding Units attribute.
+ * If the integer value does not have a corresponding Units enum
+ * value, then {@link Units#INVALID} is returned.
+ *
+ * @param value an integer representation of counter Units
+ * @return Units - the Units object for the given <code>value</code>
+ * or {@link Units#INVALID} if out of range.
+ */
+ public static Units toUnits(int value) {
+
+ if (value < 0 || value >= map.length || map[value] == null) {
+ return INVALID;
+ }
+
+ return map[value];
+ }
+
+ private Units(String name, int value) {
+ this.name = name;
+ this.value = value;
+ map[value] = this;
+ }
+
+ private static final long serialVersionUID = 6992337162326171013L;
+}
diff --git a/src/share/classes/sun/jvmstat/monitor/Variability.java b/src/share/classes/sun/jvmstat/monitor/Variability.java
new file mode 100644
index 000000000..1323226d4
--- /dev/null
+++ b/src/share/classes/sun/jvmstat/monitor/Variability.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.jvmstat.monitor;
+
+/**
+ * Provides a typesafe enumeration for the Variability attribute for
+ * instrumentation objects.
+ *
+ * @author Brian Doherty
+ */
+public class Variability implements java.io.Serializable {
+
+ /* The enumeration values for this typesafe enumeration must be
+ * kept in synchronization with the Variability enum in the perfData.hpp file
+ * in the HotSpot source base.
+ */
+
+ private static final int NATTRIBUTES = 4;
+ private static Variability[] map = new Variability[NATTRIBUTES];
+
+ private String name;
+ private int value;
+
+ /**
+ * An invalid Variablity value.
+ */
+ public static final Variability INVALID = new Variability("Invalid",0);
+
+ /**
+ * Variability attribute representing Constant counters.
+ */
+ public static final Variability CONSTANT = new Variability("Constant",1);
+
+ /**
+ * Variability attribute representing a Monotonically changing counters.
+ */
+ public static final Variability MONOTONIC = new Variability("Monotonic",2);
+
+ /**
+ * Variability attribute representing Variable counters.
+ */
+ public static final Variability VARIABLE = new Variability("Variable",3);
+
+ /**
+ * Returns a string describing this Variability attribute.
+ *
+ * @return String - a descriptive string for this enum.
+ */
+ public String toString() {
+ return name;
+ }
+
+ /**
+ * Returns the integer representation of this Variability attribute.
+ *
+ * @return int - an integer representation of this Variability attribute.
+ */
+ public int intValue() {
+ return value;
+ }
+
+ /**
+ * Maps an integer value its corresponding Variability attribute.
+ * If the integer value does not have a corresponding Variability enum
+ * value, the {@link Variability#INVALID} is returned
+ *
+ * @param value an integer representation of a Variability attribute
+ * @return Variability - The Variability object for the given
+ * <code>value</code> or {@link Variability#INVALID}
+ * if out of range.
+ */
+ public static Variability toVariability(int value) {
+
+ if (value < 0 || value >= map.length || map[value] == null) {
+ return INVALID;
+ }
+
+ return map[value];
+ }
+
+ private Variability(String name, int value) {
+ this.name = name;
+ this.value = value;
+ map[value]=this;
+ }
+
+ private static final long serialVersionUID = 6992337162326171013L;
+}
diff --git a/src/share/classes/sun/jvmstat/perfdata/monitor/PerfByteArrayMonitor.java b/src/share/classes/sun/jvmstat/perfdata/monitor/PerfByteArrayMonitor.java
index f052b98a9..b5000511a 100644
--- a/src/share/classes/sun/jvmstat/perfdata/monitor/PerfByteArrayMonitor.java
+++ b/src/share/classes/sun/jvmstat/perfdata/monitor/PerfByteArrayMonitor.java
@@ -26,8 +26,6 @@
package sun.jvmstat.perfdata.monitor;
import sun.jvmstat.monitor.*;
-import sun.management.counter.Units;
-import sun.management.counter.Variability;
import java.nio.ByteBuffer;
/**
diff --git a/src/share/classes/sun/jvmstat/perfdata/monitor/PerfIntegerMonitor.java b/src/share/classes/sun/jvmstat/perfdata/monitor/PerfIntegerMonitor.java
index 5a27f3946..d1f486c73 100644
--- a/src/share/classes/sun/jvmstat/perfdata/monitor/PerfIntegerMonitor.java
+++ b/src/share/classes/sun/jvmstat/perfdata/monitor/PerfIntegerMonitor.java
@@ -26,8 +26,6 @@
package sun.jvmstat.perfdata.monitor;
import sun.jvmstat.monitor.*;
-import sun.management.counter.Units;
-import sun.management.counter.Variability;
import java.nio.IntBuffer;
/**
diff --git a/src/share/classes/sun/jvmstat/perfdata/monitor/PerfLongMonitor.java b/src/share/classes/sun/jvmstat/perfdata/monitor/PerfLongMonitor.java
index 669977c66..3dcf4e59c 100644
--- a/src/share/classes/sun/jvmstat/perfdata/monitor/PerfLongMonitor.java
+++ b/src/share/classes/sun/jvmstat/perfdata/monitor/PerfLongMonitor.java
@@ -26,8 +26,6 @@
package sun.jvmstat.perfdata.monitor;
import sun.jvmstat.monitor.*;
-import sun.management.counter.Units;
-import sun.management.counter.Variability;
import java.nio.LongBuffer;
/**
diff --git a/src/share/classes/sun/jvmstat/perfdata/monitor/PerfStringConstantMonitor.java b/src/share/classes/sun/jvmstat/perfdata/monitor/PerfStringConstantMonitor.java
index fb4d759c1..672110138 100644
--- a/src/share/classes/sun/jvmstat/perfdata/monitor/PerfStringConstantMonitor.java
+++ b/src/share/classes/sun/jvmstat/perfdata/monitor/PerfStringConstantMonitor.java
@@ -26,7 +26,6 @@
package sun.jvmstat.perfdata.monitor;
import sun.jvmstat.monitor.*;
-import sun.management.counter.Variability;
import java.nio.ByteBuffer;
/**
diff --git a/src/share/classes/sun/jvmstat/perfdata/monitor/PerfStringMonitor.java b/src/share/classes/sun/jvmstat/perfdata/monitor/PerfStringMonitor.java
index add428237..f689db82e 100644
--- a/src/share/classes/sun/jvmstat/perfdata/monitor/PerfStringMonitor.java
+++ b/src/share/classes/sun/jvmstat/perfdata/monitor/PerfStringMonitor.java
@@ -26,8 +26,6 @@
package sun.jvmstat.perfdata.monitor;
import sun.jvmstat.monitor.*;
-import sun.management.counter.Units;
-import sun.management.counter.Variability;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
diff --git a/src/share/classes/sun/jvmstat/perfdata/monitor/PerfStringVariableMonitor.java b/src/share/classes/sun/jvmstat/perfdata/monitor/PerfStringVariableMonitor.java
index ffcf1a148..156eeb8c8 100644
--- a/src/share/classes/sun/jvmstat/perfdata/monitor/PerfStringVariableMonitor.java
+++ b/src/share/classes/sun/jvmstat/perfdata/monitor/PerfStringVariableMonitor.java
@@ -26,7 +26,6 @@
package sun.jvmstat.perfdata.monitor;
import sun.jvmstat.monitor.*;
-import sun.management.counter.Variability;
import java.nio.ByteBuffer;
/**
diff --git a/src/share/classes/sun/jvmstat/perfdata/monitor/v1_0/PerfDataBuffer.java b/src/share/classes/sun/jvmstat/perfdata/monitor/v1_0/PerfDataBuffer.java
index 7d10a1693..d13a8476c 100644
--- a/src/share/classes/sun/jvmstat/perfdata/monitor/v1_0/PerfDataBuffer.java
+++ b/src/share/classes/sun/jvmstat/perfdata/monitor/v1_0/PerfDataBuffer.java
@@ -25,8 +25,6 @@
package sun.jvmstat.perfdata.monitor.v1_0;
-import sun.management.counter.Units;
-import sun.management.counter.Variability;
import sun.jvmstat.monitor.*;
import sun.jvmstat.perfdata.monitor.*;
import java.util.*;
diff --git a/src/share/classes/sun/jvmstat/perfdata/monitor/v2_0/PerfDataBuffer.java b/src/share/classes/sun/jvmstat/perfdata/monitor/v2_0/PerfDataBuffer.java
index 102208615..7675509dd 100644
--- a/src/share/classes/sun/jvmstat/perfdata/monitor/v2_0/PerfDataBuffer.java
+++ b/src/share/classes/sun/jvmstat/perfdata/monitor/v2_0/PerfDataBuffer.java
@@ -27,8 +27,6 @@ package sun.jvmstat.perfdata.monitor.v2_0;
import sun.jvmstat.monitor.*;
import sun.jvmstat.perfdata.monitor.*;
-import sun.management.counter.Units;
-import sun.management.counter.Variability;
import java.util.*;
import java.util.regex.*;
import java.nio.*;