< prev index next >
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/PerfDataEntry.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2004, Oracle and/or its affiliates. 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.
--- 1,7 ----
/*
! * Copyright (c) 2004, 2017, Oracle and/or its affiliates. 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.
*** 129,205 ****
}
public boolean booleanValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.tBoolean, "not a boolean");
}
return addr.getJBooleanAt(dataOffset());
}
public char charValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.tChar, "not a char");
}
return addr.getJCharAt(dataOffset());
}
public byte byteValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.tByte, "not a byte");
}
return addr.getJByteAt(dataOffset());
}
public short shortValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.tShort, "not a short");
}
return addr.getJShortAt(dataOffset());
}
public int intValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.tInt, "not an int");
}
return addr.getJIntAt(dataOffset());
}
public long longValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.tLong, "not a long");
}
return addr.getJLongAt(dataOffset());
}
public float floatValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.tFloat, "not a float");
}
return addr.getJFloatAt(dataOffset());
}
public double doubleValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.tDouble, "not a double");
}
return addr.getJDoubleAt(dataOffset());
}
public boolean[] booleanArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.tBoolean, "not a boolean vector");
}
boolean[] res = new boolean[len];
final int off = dataOffset();
final long size = getHeap().getBooleanSize();
for (int i = 0; i < len; i++) {
--- 129,205 ----
}
public boolean booleanValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.getTBoolean(), "not a boolean");
}
return addr.getJBooleanAt(dataOffset());
}
public char charValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.getTChar(), "not a char");
}
return addr.getJCharAt(dataOffset());
}
public byte byteValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.getTByte(), "not a byte");
}
return addr.getJByteAt(dataOffset());
}
public short shortValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.getTShort(), "not a short");
}
return addr.getJShortAt(dataOffset());
}
public int intValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.getTInt(), "not an int");
}
return addr.getJIntAt(dataOffset());
}
public long longValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.getTLong(), "not a long");
}
return addr.getJLongAt(dataOffset());
}
public float floatValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.getTFloat(), "not a float");
}
return addr.getJFloatAt(dataOffset());
}
public double doubleValue() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(vectorLength() == 0 &&
! dataType() == BasicType.getTDouble(), "not a double");
}
return addr.getJDoubleAt(dataOffset());
}
public boolean[] booleanArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.getTBoolean(), "not a boolean vector");
}
boolean[] res = new boolean[len];
final int off = dataOffset();
final long size = getHeap().getBooleanSize();
for (int i = 0; i < len; i++) {
*** 210,220 ****
public char[] charArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.tChar, "not a char vector");
}
char[] res = new char[len];
final int off = dataOffset();
final long size = getHeap().getCharSize();
for (int i = 0; i < len; i++) {
--- 210,220 ----
public char[] charArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.getTChar(), "not a char vector");
}
char[] res = new char[len];
final int off = dataOffset();
final long size = getHeap().getCharSize();
for (int i = 0; i < len; i++) {
*** 225,235 ****
public byte[] byteArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.tByte, "not a byte vector");
}
byte[] res = new byte[len];
final int off = dataOffset();
final long size = getHeap().getByteSize();
for (int i = 0; i < len; i++) {
--- 225,235 ----
public byte[] byteArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.getTByte(), "not a byte vector");
}
byte[] res = new byte[len];
final int off = dataOffset();
final long size = getHeap().getByteSize();
for (int i = 0; i < len; i++) {
*** 240,250 ****
public short[] shortArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.tShort, "not a short vector");
}
short[] res = new short[len];
final int off = dataOffset();
final long size = getHeap().getShortSize();
for (int i = 0; i < len; i++) {
--- 240,250 ----
public short[] shortArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.getTShort(), "not a short vector");
}
short[] res = new short[len];
final int off = dataOffset();
final long size = getHeap().getShortSize();
for (int i = 0; i < len; i++) {
*** 255,265 ****
public int[] intArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.tInt, "not an int vector");
}
int[] res = new int[len];
final int off = dataOffset();
final long size = getHeap().getIntSize();
for (int i = 0; i < len; i++) {
--- 255,265 ----
public int[] intArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.getTInt(), "not an int vector");
}
int[] res = new int[len];
final int off = dataOffset();
final long size = getHeap().getIntSize();
for (int i = 0; i < len; i++) {
*** 270,280 ****
public long[] longArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.tLong, "not a long vector");
}
long[] res = new long[len];
final int off = dataOffset();
final long size = getHeap().getLongSize();
for (int i = 0; i < len; i++) {
--- 270,280 ----
public long[] longArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.getTLong(), "not a long vector");
}
long[] res = new long[len];
final int off = dataOffset();
final long size = getHeap().getLongSize();
for (int i = 0; i < len; i++) {
*** 285,295 ****
public float[] floatArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.tFloat, "not a float vector");
}
float[] res = new float[len];
final int off = dataOffset();
final long size = getHeap().getFloatSize();
for (int i = 0; i < len; i++) {
--- 285,295 ----
public float[] floatArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.getTFloat(), "not a float vector");
}
float[] res = new float[len];
final int off = dataOffset();
final long size = getHeap().getFloatSize();
for (int i = 0; i < len; i++) {
*** 300,310 ****
public double[] doubleArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.tDouble, "not a double vector");
}
double[] res = new double[len];
final int off = dataOffset();
final long size = getHeap().getDoubleSize();
for (int i = 0; i < len; i++) {
--- 300,310 ----
public double[] doubleArrayValue() {
int len = vectorLength();
if (Assert.ASSERTS_ENABLED) {
Assert.that(len > 0 &&
! dataType() == BasicType.getTDouble(), "not a double vector");
}
double[] res = new double[len];
final int off = dataOffset();
final long size = getHeap().getDoubleSize();
for (int i = 0; i < len; i++) {
*** 317,454 ****
public String valueAsString() {
int dataType = dataType();
int len = vectorLength();
String str = null;
if (len == 0) { // scalar
! switch (dataType) {
! case BasicType.tBoolean:
str = Boolean.toString(booleanValue());
! break;
! case BasicType.tChar:
str = "'" + Character.toString(charValue()) + "'";
! break;
! case BasicType.tByte:
str = Byte.toString(byteValue());
! break;
! case BasicType.tShort:
str = Short.toString(shortValue());
! break;
! case BasicType.tInt:
str = Integer.toString(intValue());
! break;
! case BasicType.tLong:
str = Long.toString(longValue());
! break;
! case BasicType.tFloat:
str = Float.toString(floatValue());
! break;
! case BasicType.tDouble:
str = Double.toString(doubleValue());
! break;
! default:
str = "<unknown scalar value>";
- break;
}
} else { // vector
! switch (dataType) {
! case BasicType.tBoolean: {
boolean[] res = booleanArrayValue();
StringBuffer buf = new StringBuffer();
buf.append('[');
for (int i = 0; i < res.length; i++) {
buf.append(Boolean.toString(res[i]));
buf.append(", ");
}
buf.append(']');
str = buf.toString();
! break;
! }
!
! case BasicType.tChar: {
// char[] is returned as a String
str = new String(charArrayValue());
! break;
! }
!
! case BasicType.tByte: {
// byte[] is returned as a String
try {
str = new String(byteArrayValue(), "US-ASCII");
} catch (java.io.UnsupportedEncodingException e) {
str = "can't decode string : " + e.getMessage();
}
! break;
! }
!
! case BasicType.tShort: {
short[] res = shortArrayValue();
StringBuffer buf = new StringBuffer();
buf.append('[');
for (int i = 0; i < res.length; i++) {
buf.append(Short.toString(res[i]));
buf.append(", ");
}
buf.append(']');
str = buf.toString();
! break;
! }
!
! case BasicType.tInt: {
int[] res = intArrayValue();
StringBuffer buf = new StringBuffer();
buf.append('[');
for (int i = 0; i < res.length; i++) {
buf.append(Integer.toString(res[i]));
buf.append(", ");
}
buf.append(']');
str = buf.toString();
! break;
! }
!
! case BasicType.tLong: {
long[] res = longArrayValue();
StringBuffer buf = new StringBuffer();
buf.append('[');
for (int i = 0; i < res.length; i++) {
buf.append(Long.toString(res[i]));
buf.append(", ");
}
buf.append(']');
str = buf.toString();
! break;
! }
!
! case BasicType.tFloat: {
float[] res = floatArrayValue();
StringBuffer buf = new StringBuffer();
buf.append('[');
for (int i = 0; i < res.length; i++) {
buf.append(Float.toString(res[i]));
buf.append(", ");
}
buf.append(']');
str = buf.toString();
! break;
! }
!
! case BasicType.tDouble: {
double[] res = doubleArrayValue();
StringBuffer buf = new StringBuffer();
buf.append('[');
for (int i = 0; i < res.length; i++) {
buf.append(Double.toString(res[i]));
buf.append(", ");
}
buf.append(']');
str = buf.toString();
! break;
! }
!
! default:
str = "<unknown vector value>";
- break;
}
}
// add units
switch (dataUnits()) {
--- 317,418 ----
public String valueAsString() {
int dataType = dataType();
int len = vectorLength();
String str = null;
if (len == 0) { // scalar
! if (dataType == BasicType.getTBoolean()) {
str = Boolean.toString(booleanValue());
! } else if (dataType == BasicType.getTChar()) {
str = "'" + Character.toString(charValue()) + "'";
! } else if (dataType == BasicType.getTByte()) {
str = Byte.toString(byteValue());
! } else if (dataType == BasicType.getTShort()) {
str = Short.toString(shortValue());
! } else if (dataType == BasicType.getTInt()) {
str = Integer.toString(intValue());
! } else if (dataType == BasicType.getTLong()) {
str = Long.toString(longValue());
! } else if (dataType == BasicType.getTFloat()) {
str = Float.toString(floatValue());
! } else if (dataType == BasicType.getTDouble()) {
str = Double.toString(doubleValue());
! } else {
str = "<unknown scalar value>";
}
} else { // vector
! if (dataType == BasicType.getTBoolean()) {
boolean[] res = booleanArrayValue();
StringBuffer buf = new StringBuffer();
buf.append('[');
for (int i = 0; i < res.length; i++) {
buf.append(Boolean.toString(res[i]));
buf.append(", ");
}
buf.append(']');
str = buf.toString();
! } else if (dataType == BasicType.getTChar()) {
// char[] is returned as a String
str = new String(charArrayValue());
! } else if (dataType == BasicType.getTByte()) {
// byte[] is returned as a String
try {
str = new String(byteArrayValue(), "US-ASCII");
} catch (java.io.UnsupportedEncodingException e) {
str = "can't decode string : " + e.getMessage();
}
! } else if (dataType == BasicType.getTShort()) {
short[] res = shortArrayValue();
StringBuffer buf = new StringBuffer();
buf.append('[');
for (int i = 0; i < res.length; i++) {
buf.append(Short.toString(res[i]));
buf.append(", ");
}
buf.append(']');
str = buf.toString();
! } else if (dataType == BasicType.getTInt()) {
int[] res = intArrayValue();
StringBuffer buf = new StringBuffer();
buf.append('[');
for (int i = 0; i < res.length; i++) {
buf.append(Integer.toString(res[i]));
buf.append(", ");
}
buf.append(']');
str = buf.toString();
! } else if (dataType == BasicType.getTLong()) {
long[] res = longArrayValue();
StringBuffer buf = new StringBuffer();
buf.append('[');
for (int i = 0; i < res.length; i++) {
buf.append(Long.toString(res[i]));
buf.append(", ");
}
buf.append(']');
str = buf.toString();
! } else if (dataType == BasicType.getTFloat()) {
float[] res = floatArrayValue();
StringBuffer buf = new StringBuffer();
buf.append('[');
for (int i = 0; i < res.length; i++) {
buf.append(Float.toString(res[i]));
buf.append(", ");
}
buf.append(']');
str = buf.toString();
! } else if (dataType == BasicType.getTDouble()) {
double[] res = doubleArrayValue();
StringBuffer buf = new StringBuffer();
buf.append('[');
for (int i = 0; i < res.length; i++) {
buf.append(Double.toString(res[i]));
buf.append(", ");
}
buf.append(']');
str = buf.toString();
! } else {
str = "<unknown vector value>";
}
}
// add units
switch (dataUnits()) {
< prev index next >