Java Code Examples for jdk.jfr.consumer.RecordedFrame#getMethod()
The following examples show how to use
jdk.jfr.consumer.RecordedFrame#getMethod() .
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: TestGetStackTrace.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
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 2
Source File: ProfileResults.java From lucene-solr with Apache License 2.0 | 6 votes |
/** * 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 3
Source File: TestGetStackTrace.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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 4
Source File: TestGetStackTrace.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
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: TestMethodGetModifiers.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 6
Source File: TestMethodGetModifiers.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
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 7
Source File: TestMethodGetModifiers.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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: AllocationStackTrace.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private static String frameToString(RecordedFrame f) { RecordedMethod m = f.getMethod(); String methodName = m.getName(); String className = m.getType().getName(); return className + "." + methodName; }
Example 9
Source File: OldObjects.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private static String frameToString(RecordedFrame f) { RecordedMethod m = f.getMethod(); String methodName = m.getName(); String className = m.getType().getName(); return className + "." + methodName; }
Example 10
Source File: AllocationStackTrace.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private static String frameToString(RecordedFrame f) { RecordedMethod m = f.getMethod(); String methodName = m.getName(); String className = m.getType().getName(); return className + "." + methodName; }
Example 11
Source File: OldObjects.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private static String frameToString(RecordedFrame f) { RecordedMethod m = f.getMethod(); String methodName = m.getName(); String className = m.getType().getName(); return className + "." + methodName; }
Example 12
Source File: TestRecordedFrame.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
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 13
Source File: AllocationStackTrace.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private static String frameToString(RecordedFrame f) { RecordedMethod m = f.getMethod(); String methodName = m.getName(); String className = m.getType().getName(); return className + "." + methodName; }
Example 14
Source File: OldObjects.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private static String frameToString(RecordedFrame f) { RecordedMethod m = f.getMethod(); String methodName = m.getName(); String className = m.getType().getName(); return className + "." + methodName; }
Example 15
Source File: TestRecordedFrame.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
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 16
Source File: AllocationStackTrace.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
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: OldObjects.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private static String frameToString(RecordedFrame f) { RecordedMethod m = f.getMethod(); String methodName = m.getName(); String className = m.getType().getName(); return className + "." + methodName; }
Example 18
Source File: TestRecordedFrame.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
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); } } }