@Override public String toString() { StringBuilder sb = new StringBuilder(); String nl = String.format("%n"); String nlIndent = String.format("%n%38s", ""); if (hasNormalData()) { int pos = 0; HotSpotMethodDataAccessor data; while ((data = getNormalData(pos)) != null) { if (pos != 0) { sb.append(nl); } int bci = data.getBCI(this, pos); sb.append(String.format("%-6d bci: %-6d%-20s", pos, bci, data.getClass().getSimpleName())); sb.append(data.appendTo(new StringBuilder(), this, pos).toString().replace(nl, nlIndent)); pos = pos + data.getSize(this, pos); } } if (hasExtraData()) { int pos = getExtraDataBeginOffset(); HotSpotMethodDataAccessor data; while ((data = getExtraData(pos)) != null) { if (pos == getExtraDataBeginOffset()) { sb.append(nl).append("--- Extra data:"); } int bci = data.getBCI(this, pos); sb.append( String.format("%n%-6d bci: %-6d%-20s", pos, bci, data.getClass().getSimpleName())); sb.append(data.appendTo(new StringBuilder(), this, pos).toString().replace(nl, nlIndent)); pos = pos + data.getSize(this, pos); } } return sb.toString(); }
@Override public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { int entries = getLength(data, pos) / MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS; sb.append(format("entries(%d)", entries)); for (int i = 0; i < entries; i++) { sb.append( format( "%n %d: count(%d) displacement(%d)", i, data.readUnsignedInt(pos, getCountOffset(i)), data.readUnsignedInt(pos, getDisplacementOffset(i)))); } return sb; }
@Override public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { RawItemProfile<ResolvedJavaMethod> profile = getRawMethodProfile(data, pos); super.appendTo( sb.append(format("exception_seen(%s) ", getExceptionSeen(data, pos))), data, pos) .append(format("%nmethod_entries(%d)", profile.entries)); for (int i = 0; i < profile.entries; i++) { long count = profile.counts[i]; sb.append( format( "%n %s (%d, %4.2f)", profile.items[i].format("%H.%n(%p)"), count, (double) count / profile.totalCount)); } return sb; }
@Override public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { return sb.append( format( "taken(%d) displacement(%d)", getExecutionCount(data, pos), getTakenDisplacement(data, pos))); }
@Override public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { return sb.append( format( "count(%d) null_seen(%s) exception_seen(%s)", getCounterValue(data, pos), getNullSeen(data, pos), getExceptionSeen(data, pos))); }
/** * Returns a string representation of the given collection of objects. * * @param objects The {@link Iterable} that will be used to iterate over the objects. * @return A string of the format "[a, b, ...]". */ public static String toString(Iterable<?> objects) { StringBuilder str = new StringBuilder(); str.append("["); for (Object o : objects) { str.append(o).append(", "); } if (str.length() > 1) { str.setLength(str.length() - 2); } str.append("]"); return str.toString(); }
@Override public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { RawItemProfile<ResolvedJavaType> profile = getRawTypeProfile(data, pos); TriState nullSeen = getNullSeen(data, pos); TriState exceptionSeen = getExceptionSeen(data, pos); sb.append( format( "count(%d) null_seen(%s) exception_seen(%s) nonprofiled_count(%d) entries(%d)", getCounterValue(data, pos), nullSeen, exceptionSeen, getTypesNotRecordedExecutionCount(data, pos), profile.entries)); for (int i = 0; i < profile.entries; i++) { long count = profile.counts[i]; sb.append( format( "%n %s (%d, %4.2f)", profile.items[i].toJavaName(), count, (double) count / profile.totalCount)); } return sb; }
@Override public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { long taken = data.readUnsignedInt(pos, TAKEN_COUNT_OFFSET); long notTaken = data.readUnsignedInt(pos, NOT_TAKEN_COUNT_OFFSET); double takenProbability = getBranchTakenProbability(data, pos); return sb.append( format( "taken(%d, %4.2f) not_taken(%d, %4.2f) displacement(%d)", taken, takenProbability, notTaken, 1.0D - takenProbability, getTakenDisplacement(data, pos))); }
@Override public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { return sb.append(format("length(%d)", getLength(data, pos))); }
@Override public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { return sb.append(format("exception_seen(%s)", getExceptionSeen(data, pos))); }