jdk.jfr.consumer.RecordedMethod Java Examples

The following examples show how to use jdk.jfr.consumer.RecordedMethod. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProfileResults.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
/**
 * Formats a frame to a formatted line. This is deduplicated on!
 */
static String frameToString(RecordedFrame frame, boolean lineNumbers) {
  StringBuilder builder = new StringBuilder();
  RecordedMethod method = frame.getMethod();
  RecordedClass clazz = method.getType();
  if (clazz == null) {
    builder.append("<<");
    builder.append(frame.getType());
    builder.append(">>");
  } else {
    builder.append(clazz.getName());
  }
  builder.append("#");
  builder.append(method.getName());
  builder.append("()");
  if (lineNumbers) {
    builder.append(":");
    if (frame.getLineNumber() == -1) {
      builder.append("(" + frame.getType() + " code)");
    } else {
      builder.append(frame.getLineNumber());
    }
  }
  return builder.toString();
}
 
Example #2
Source File: TestGetStackTrace.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void assertFrame(RecordedFrame frame) {
    int bci = frame.getBytecodeIndex();
    int line = frame.getLineNumber();
    boolean javaFrame = frame.isJavaFrame();
    RecordedMethod method = frame.getMethod();
    String type = frame.getType();
    System.out.println("*** Frame Info ***");
    System.out.println("bci=" + bci);
    System.out.println("line=" + line);
    System.out.println("type=" + type);
    System.out.println("method=" + method);
    System.out.println("***");
    Asserts.assertTrue(javaFrame, "Only Java frame are currently supported");
    Asserts.assertGreaterThanOrEqual(bci, -1);
    Asserts.assertNotNull(method, "Method should not be null");
}
 
Example #3
Source File: PrettyWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private String formatMethod(RecordedMethod m) {
    StringBuilder sb = new StringBuilder();
    sb.append(m.getType().getName());
    sb.append(".");
    sb.append(m.getName());
    sb.append("(");
    StringJoiner sj = new StringJoiner(", ");
    String md = m.getDescriptor().replace("/", ".");
    String parameter = md.substring(1, md.lastIndexOf(")"));
    for (String qualifiedName : decodeDescriptors(parameter, "")) {
        String typeName = qualifiedName.substring(qualifiedName.lastIndexOf('.') + 1);
        sj.add(typeName);
    }
    sb.append(sj);
    sb.append(")");
    return sb.toString();
}
 
Example #4
Source File: TestGetStackTrace.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static void assertFrame(RecordedFrame frame) {
    int bci = frame.getBytecodeIndex();
    int line = frame.getLineNumber();
    boolean javaFrame = frame.isJavaFrame();
    RecordedMethod method = frame.getMethod();
    String type = frame.getType();
    System.out.println("*** Frame Info ***");
    System.out.println("bci=" + bci);
    System.out.println("line=" + line);
    System.out.println("type=" + type);
    System.out.println("method=" + method);
    System.out.println("***");
    Asserts.assertTrue(javaFrame, "Only Java frame are currently supported");
    Asserts.assertGreaterThanOrEqual(bci, -1);
    Asserts.assertNotNull(method, "Method should not be null");
}
 
Example #5
Source File: PrettyWriter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private String formatMethod(RecordedMethod m) {
    StringBuilder sb = new StringBuilder();
    sb.append(m.getType().getName());
    sb.append(".");
    sb.append(m.getName());
    sb.append("(");
    StringJoiner sj = new StringJoiner(", ");
    String md = m.getDescriptor().replace("/", ".");
    String parameter = md.substring(1, md.lastIndexOf(")"));
    for (String qualifiedName : decodeDescriptors(parameter, "")) {
        String typeName = qualifiedName.substring(qualifiedName.lastIndexOf('.') + 1);
        sj.add(typeName);
    }
    sb.append(sj);
    sb.append(")");
    return sb.toString();
}
 
Example #6
Source File: TestGetStackTrace.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void assertFrame(RecordedFrame frame) {
    int bci = frame.getBytecodeIndex();
    int line = frame.getLineNumber();
    boolean javaFrame = frame.isJavaFrame();
    RecordedMethod method = frame.getMethod();
    String type = frame.getType();
    System.out.println("*** Frame Info ***");
    System.out.println("bci=" + bci);
    System.out.println("line=" + line);
    System.out.println("type=" + type);
    System.out.println("method=" + method);
    System.out.println("***");
    Asserts.assertTrue(javaFrame, "Only Java frame are currently supported");
    Asserts.assertGreaterThanOrEqual(bci, -1);
    Asserts.assertNotNull(method, "Method should not be null");
}
 
Example #7
Source File: TestMethodGetModifiers.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Throwable {
    Recording recording = new Recording();
    recording.start();

    SimpleEvent ev = new SimpleEvent();
    ev.commit();
    recording.stop();

    List<RecordedEvent> recordedEvents = Events.fromRecording(recording);
    Events.hasEvents(recordedEvents);
    RecordedEvent recordedEvent = recordedEvents.get(0);

    System.out.println("recorded event:" + recordedEvent);

    RecordedStackTrace stacktrace = recordedEvent.getStackTrace();
    List<RecordedFrame> frames = stacktrace.getFrames();
    for (RecordedFrame frame : frames) {
        RecordedMethod method = frame.getMethod();
        if (method.getName().equals("main")) {
            System.out.println("'main' method: " + method);
            int modifiers = TestMethodGetModifiers.class.getDeclaredMethod("main", (Class<?>)String[].class).getModifiers();
            System.out.println("modifiers: " + modifiers);
            Asserts.assertEquals(method.getModifiers(), modifiers, "Incorrect method modifier reported");
            RecordedClass type = method.getType();
            assertNotNull(type, "Recorded class can not be null");
        }

    }
}
 
Example #8
Source File: TestCompilerInlining.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void testLevel(Map<Call, Boolean> expectedResult, int level) throws IOException {
    System.out.println("****** Testing level " + level + " *******");
    Recording r = new Recording();
    r.enable(EventNames.CompilerInlining);
    r.start();
    WHITE_BOX.enqueueMethodForCompilation(ENTRY_POINT, level);
    WHITE_BOX.deoptimizeMethod(ENTRY_POINT);
    r.stop();
    System.out.println("Expected:");

    List<RecordedEvent> events = Events.fromRecording(r);
    Set<Call> foundEvents = new HashSet<>();
    int foundRelevantEvent = 0;
    for (RecordedEvent event : events) {
        RecordedMethod callerObject = event.getValue("caller");
        RecordedObject calleeObject = event.getValue("callee");
        MethodDesc caller = methodToMethodDesc(callerObject);
        MethodDesc callee = ciMethodToMethodDesc(calleeObject);
        // only TestCase.* -> TestCase.* OR TestCase.* -> Object.<init> are tested/filtered
        if (caller.className.equals(TEST_CASE_CLASS_NAME) && (callee.className.equals(TEST_CASE_CLASS_NAME)
                || (callee.className.equals("java/lang/Object") && callee.methodName.equals("<init>")))) {
            System.out.println(event);
            boolean succeeded = (boolean) event.getValue("succeeded");
            int bci = Events.assertField(event, "bci").atLeast(0).getValue();
            Call call = new Call(caller, callee, bci);
            foundRelevantEvent++;
            Boolean expected = expectedResult.get(call);
            Asserts.assertNotNull(expected, "Unexpected inlined call : " + call);
            Asserts.assertEquals(expected, succeeded, "Incorrect result for " + call);
            Asserts.assertTrue(foundEvents.add(call), "repeated event for " + call);
        }
    }
    Asserts.assertEquals(foundRelevantEvent, expectedResult.size(), String.format("not all events found at lavel %d. " + "found = '%s'. expected = '%s'", level, events, expectedResult.keySet()));
    System.out.println();
    System.out.println();
}
 
Example #9
Source File: TestMethodGetModifiers.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Throwable {
    Recording recording = new Recording();
    recording.start();

    SimpleEvent ev = new SimpleEvent();
    ev.commit();
    recording.stop();

    List<RecordedEvent> recordedEvents = Events.fromRecording(recording);
    Events.hasEvents(recordedEvents);
    RecordedEvent recordedEvent = recordedEvents.get(0);

    System.out.println("recorded event:" + recordedEvent);

    RecordedStackTrace stacktrace = recordedEvent.getStackTrace();
    List<RecordedFrame> frames = stacktrace.getFrames();
    for (RecordedFrame frame : frames) {
        RecordedMethod method = frame.getMethod();
        if (method.getName().equals("main")) {
            System.out.println("'main' method: " + method);
            int modifiers = TestMethodGetModifiers.class.getDeclaredMethod("main", (Class<?>)String[].class).getModifiers();
            System.out.println("modifiers: " + modifiers);
            Asserts.assertEquals(method.getModifiers(), modifiers, "Incorrect method modifier reported");
            RecordedClass type = method.getType();
            assertNotNull(type, "Recorded class can not be null");
        }

    }
}
 
Example #10
Source File: TestRecordedMethodDescriptor.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void analyzeRecordedMethodDescriptor(RecordedMethod method) {

        String descr = method.getDescriptor();
        assertNotNull(descr, "Method descriptor is null");
        String name = method.getName();
        assertNotNull(name, "Method name is null");

        if (name.equals(MAIN_METHOD_NAME) && descr.equals(MAIN_METHOD_DESCRIPTOR)) {
            assertFalse(isMainMethodDescriptorRecorded, "main() method descriptor already recorded");
            isMainMethodDescriptorRecorded = true;
        }
    }
 
Example #11
Source File: TestRecordedMethodDescriptor.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void analyzeRecordedMethodDescriptor(RecordedMethod method) {

        String descr = method.getDescriptor();
        assertNotNull(descr, "Method descriptor is null");
        String name = method.getName();
        assertNotNull(name, "Method name is null");

        if (name.equals(MAIN_METHOD_NAME) && descr.equals(MAIN_METHOD_DESCRIPTOR)) {
            assertFalse(isMainMethodDescriptorRecorded, "main() method descriptor already recorded");
            isMainMethodDescriptorRecorded = true;
        }
    }
 
Example #12
Source File: TestMethodGetModifiers.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Throwable {
    Recording recording = new Recording();
    recording.start();

    SimpleEvent ev = new SimpleEvent();
    ev.commit();
    recording.stop();

    List<RecordedEvent> recordedEvents = Events.fromRecording(recording);
    Events.hasEvents(recordedEvents);
    RecordedEvent recordedEvent = recordedEvents.get(0);

    System.out.println("recorded event:" + recordedEvent);

    RecordedStackTrace stacktrace = recordedEvent.getStackTrace();
    List<RecordedFrame> frames = stacktrace.getFrames();
    for (RecordedFrame frame : frames) {
        RecordedMethod method = frame.getMethod();
        if (method.getName().equals("main")) {
            System.out.println("'main' method: " + method);
            int modifiers = TestMethodGetModifiers.class.getDeclaredMethod("main", (Class<?>)String[].class).getModifiers();
            System.out.println("modifiers: " + modifiers);
            Asserts.assertEquals(method.getModifiers(), modifiers, "Incorrect method modifier reported");
            RecordedClass type = method.getType();
            assertNotNull(type, "Recorded class can not be null");
        }

    }
}
 
Example #13
Source File: TestCompilerInlining.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void testLevel(Map<Call, Boolean> expectedResult, int level) throws IOException {
    System.out.println("****** Testing level " + level + " *******");
    Recording r = new Recording();
    r.enable(EventNames.CompilerInlining);
    r.start();
    WHITE_BOX.enqueueMethodForCompilation(ENTRY_POINT, level);
    WHITE_BOX.deoptimizeMethod(ENTRY_POINT);
    r.stop();
    System.out.println("Expected:");

    List<RecordedEvent> events = Events.fromRecording(r);
    Set<Call> foundEvents = new HashSet<>();
    int foundRelevantEvent = 0;
    for (RecordedEvent event : events) {
        RecordedMethod callerObject = event.getValue("caller");
        RecordedObject calleeObject = event.getValue("callee");
        MethodDesc caller = methodToMethodDesc(callerObject);
        MethodDesc callee = ciMethodToMethodDesc(calleeObject);
        // only TestCase.* -> TestCase.* OR TestCase.* -> Object.<init> are tested/filtered
        if (caller.className.equals(TEST_CASE_CLASS_NAME) && (callee.className.equals(TEST_CASE_CLASS_NAME)
                || (callee.className.equals("java/lang/Object") && callee.methodName.equals("<init>")))) {
            System.out.println(event);
            boolean succeeded = (boolean) event.getValue("succeeded");
            int bci = Events.assertField(event, "bci").atLeast(0).getValue();
            Call call = new Call(caller, callee, bci);
            foundRelevantEvent++;
            Boolean expected = expectedResult.get(call);
            Asserts.assertNotNull(expected, "Unexpected inlined call : " + call);
            Asserts.assertEquals(expected, succeeded, "Incorrect result for " + call);
            Asserts.assertTrue(foundEvents.add(call), "repeated event for " + call);
        }
    }
    Asserts.assertEquals(foundRelevantEvent, expectedResult.size(), String.format("not all events found at lavel %d. " + "found = '%s'. expected = '%s'", level, events, expectedResult.keySet()));
    System.out.println();
    System.out.println();
}
 
Example #14
Source File: TestRecordedMethodDescriptor.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void analyzeRecordedMethodDescriptor(RecordedMethod method) {

        String descr = method.getDescriptor();
        assertNotNull(descr, "Method descriptor is null");
        String name = method.getName();
        assertNotNull(name, "Method name is null");

        if (name.equals(MAIN_METHOD_NAME) && descr.equals(MAIN_METHOD_DESCRIPTOR)) {
            assertFalse(isMainMethodDescriptorRecorded, "main() method descriptor already recorded");
            isMainMethodDescriptorRecorded = true;
        }
    }
 
Example #15
Source File: AllocationStackTrace.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private static String frameToString(RecordedFrame f) {
    RecordedMethod m = f.getMethod();
    String methodName = m.getName();
    String className = m.getType().getName();
    return className + "." + methodName;
}
 
Example #16
Source File: OldObjects.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private static String frameToString(RecordedFrame f) {
    RecordedMethod m = f.getMethod();
    String methodName = m.getName();
    String className = m.getType().getName();
    return className + "." + methodName;
}
 
Example #17
Source File: TestCompilerInlining.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private static MethodDesc methodToMethodDesc(RecordedMethod method) {
    String internalClassName = method.getType().getName().replace('.', '/');
    String methodName = method.getValue("name");
    String methodDescriptor = method.getValue("descriptor");
    return new MethodDesc(internalClassName, methodName, methodDescriptor);
}
 
Example #18
Source File: JFRJDK9StackFrame.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
@Override
public JFRMethod getMethod() {
    RecordedMethod method = stackFrame.getMethod();
    return method == null ? null : new JFRJDK9Method(method);
}
 
Example #19
Source File: JFRJDK9Method.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
JFRJDK9Method(RecordedMethod method) {
    this.method = method;
}
 
Example #20
Source File: TestRecordedFrame.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void doTest(int lineNumber) throws IOException {

        System.out.println("Enetring method");

        Recording recording = new Recording();
        recording.start();

        SimpleEvent ev = new SimpleEvent();
        commitEvent(ev);
        recording.stop();

        List<RecordedEvent> recordedEvents = Events.fromRecording(recording);
        Events.hasEvents(recordedEvents);
        RecordedEvent recordedEvent = recordedEvents.get(0);

        RecordedStackTrace stacktrace = recordedEvent.getStackTrace();
        List<RecordedFrame> frames = stacktrace.getFrames();
        for (RecordedFrame frame : frames) {

            // All frames are java frames
            Asserts.assertTrue(frame.isJavaFrame());
            // Verify the main() method frame
            RecordedMethod method = frame.getMethod();
            if (method.getName().equals("main")) {

                // Frame type
                String type = frame.getType();
                System.out.println("type: " + type);
                Asserts.assertTrue(
                        type.equals("Interpreted")
                        || type.equals("JIT compiled")
                        || type.equals("Inlined"));

                Asserts.assertEquals(lineNumber, frame.getLineNumber());

                boolean isInterpreted = "Interpreted".equals(type);
                boolean expectedInterpreted = "true".equals(System.getProperty("interpreted"));
                Asserts.assertEquals(isInterpreted, expectedInterpreted);

                int bci = frame.getBytecodeIndex();

                System.out.println("bci: " + bci);
                Asserts.assertTrue(bci > 0);
            }

        }

    }
 
Example #21
Source File: OldObjects.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private static String frameToString(RecordedFrame f) {
    RecordedMethod m = f.getMethod();
    String methodName = m.getName();
    String className = m.getType().getName();
    return className + "." + methodName;
}
 
Example #22
Source File: PrettyWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void printValue(Object value, ValueDescriptor field, String postFix) {
    if (value == null) {
        println("N/A" + postFix);
        return;
    }
    if (value instanceof RecordedObject) {
        if (value instanceof RecordedThread) {
            printThread((RecordedThread) value, postFix);
            return;
        }
        if (value instanceof RecordedClass) {
            printClass((RecordedClass) value, postFix);
            return;
        }
        if (value instanceof RecordedClassLoader) {
            printClassLoader((RecordedClassLoader) value, postFix);
            return;
        }
        if (value instanceof RecordedFrame) {
            RecordedFrame frame = (RecordedFrame) value;
            if (frame.isJavaFrame()) {
                printJavaFrame((RecordedFrame) value, postFix);
                return;
            }
        }
        if (value instanceof RecordedMethod) {
            println(formatMethod((RecordedMethod) value));
            return;
        }
        if (field.getTypeName().equals(TYPE_OLD_OBJECT)) {
            printOldObject((RecordedObject) value);
            return;
        }
         print((RecordedObject) value, postFix);
        return;
    }
    if (value.getClass().isArray()) {
        printArray((Object[]) value);
        return;
    }

    if (value instanceof Double) {
        Double d = (Double) value;
        if (Double.isNaN(d) || d == Double.NEGATIVE_INFINITY) {
            println("N/A");
            return;
        }
    }
    if (value instanceof Float) {
        Float f = (Float) value;
        if (Float.isNaN(f) || f == Float.NEGATIVE_INFINITY) {
            println("N/A");
            return;
        }
    }
    if (value instanceof Long) {
        Long l = (Long) value;
        if (l == Long.MIN_VALUE) {
            println("N/A");
            return;
        }
    }
    if (value instanceof Integer) {
        Integer i = (Integer) value;
        if (i == Integer.MIN_VALUE) {
            println("N/A");
            return;
        }
    }

    if (field.getContentType() != null) {
        if (printFormatted(field, value)) {
            return;
        }
    }

    String text = String.valueOf(value);
    if (value instanceof String) {
        text = "\"" + text + "\"";
    }
    println(text);
}
 
Example #23
Source File: TestCompilerInlining.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private static MethodDesc methodToMethodDesc(RecordedMethod method) {
    String internalClassName = method.getType().getName().replace('.', '/');
    String methodName = method.getValue("name");
    String methodDescriptor = method.getValue("descriptor");
    return new MethodDesc(internalClassName, methodName, methodDescriptor);
}
 
Example #24
Source File: AllocationStackTrace.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private static String frameToString(RecordedFrame f) {
    RecordedMethod m = f.getMethod();
    String methodName = m.getName();
    String className = m.getType().getName();
    return className + "." + methodName;
}
 
Example #25
Source File: TestRecordedFrame.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void doTest(int lineNumber) throws IOException {

        System.out.println("Enetring method");

        Recording recording = new Recording();
        recording.start();

        SimpleEvent ev = new SimpleEvent();
        commitEvent(ev);
        recording.stop();

        List<RecordedEvent> recordedEvents = Events.fromRecording(recording);
        Events.hasEvents(recordedEvents);
        RecordedEvent recordedEvent = recordedEvents.get(0);

        RecordedStackTrace stacktrace = recordedEvent.getStackTrace();
        List<RecordedFrame> frames = stacktrace.getFrames();
        for (RecordedFrame frame : frames) {

            // All frames are java frames
            Asserts.assertTrue(frame.isJavaFrame());
            // Verify the main() method frame
            RecordedMethod method = frame.getMethod();
            if (method.getName().equals("main")) {

                // Frame type
                String type = frame.getType();
                System.out.println("type: " + type);
                Asserts.assertTrue(
                        type.equals("Interpreted")
                        || type.equals("JIT compiled")
                        || type.equals("Inlined"));

                Asserts.assertEquals(lineNumber, frame.getLineNumber());

                boolean isInterpreted = "Interpreted".equals(type);
                boolean expectedInterpreted = "true".equals(System.getProperty("interpreted"));
                Asserts.assertEquals(isInterpreted, expectedInterpreted);

                int bci = frame.getBytecodeIndex();

                System.out.println("bci: " + bci);
                Asserts.assertTrue(bci > 0);
            }

        }

    }
 
Example #26
Source File: PrettyWriter.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void printValue(Object value, ValueDescriptor field, String postFix) {
    if (value == null) {
        println("N/A" + postFix);
        return;
    }
    if (value instanceof RecordedObject) {
        if (value instanceof RecordedThread) {
            printThread((RecordedThread) value, postFix);
            return;
        }
        if (value instanceof RecordedClass) {
            printClass((RecordedClass) value, postFix);
            return;
        }
        if (value instanceof RecordedClassLoader) {
            printClassLoader((RecordedClassLoader) value, postFix);
            return;
        }
        if (value instanceof RecordedFrame) {
            RecordedFrame frame = (RecordedFrame) value;
            if (frame.isJavaFrame()) {
                printJavaFrame((RecordedFrame) value, postFix);
                return;
            }
        }
        if (value instanceof RecordedMethod) {
            println(formatMethod((RecordedMethod) value));
            return;
        }
        if (field.getTypeName().equals(TYPE_OLD_OBJECT)) {
            printOldObject((RecordedObject) value);
            return;
        }
         print((RecordedObject) value, postFix);
        return;
    }
    if (value.getClass().isArray()) {
        printArray((Object[]) value);
        return;
    }

    if (value instanceof Double) {
        Double d = (Double) value;
        if (Double.isNaN(d) || d == Double.NEGATIVE_INFINITY) {
            println("N/A");
            return;
        }
    }
    if (value instanceof Float) {
        Float f = (Float) value;
        if (Float.isNaN(f) || f == Float.NEGATIVE_INFINITY) {
            println("N/A");
            return;
        }
    }
    if (value instanceof Long) {
        Long l = (Long) value;
        if (l == Long.MIN_VALUE) {
            println("N/A");
            return;
        }
    }
    if (value instanceof Integer) {
        Integer i = (Integer) value;
        if (i == Integer.MIN_VALUE) {
            println("N/A");
            return;
        }
    }

    if (field.getContentType() != null) {
        if (printFormatted(field, value)) {
            return;
        }
    }

    String text = String.valueOf(value);
    if (value instanceof String) {
        text = "\"" + text + "\"";
    }
    println(text);
}
 
Example #27
Source File: OldObjects.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private static String frameToString(RecordedFrame f) {
    RecordedMethod m = f.getMethod();
    String methodName = m.getName();
    String className = m.getType().getName();
    return className + "." + methodName;
}
 
Example #28
Source File: AllocationStackTrace.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private static String frameToString(RecordedFrame f) {
    RecordedMethod m = f.getMethod();
    String methodName = m.getName();
    String className = m.getType().getName();
    return className + "." + methodName;
}
 
Example #29
Source File: OldObjects.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private static String frameToString(RecordedFrame f) {
    RecordedMethod m = f.getMethod();
    String methodName = m.getName();
    String className = m.getType().getName();
    return className + "." + methodName;
}
 
Example #30
Source File: AllocationStackTrace.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private static String frameToString(RecordedFrame f) {
    RecordedMethod m = f.getMethod();
    String methodName = m.getName();
    String className = m.getType().getName();
    return className + "." + methodName;
}