Java Code Examples for jdk.jfr.consumer.RecordedFrame#getLineNumber()

The following examples show how to use jdk.jfr.consumer.RecordedFrame#getLineNumber() . 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 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 2
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 3
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 4
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 5
Source File: PrettyWriter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void printJavaFrame(RecordedFrame f, String postFix) {
    print(formatMethod(f.getMethod()));
    int line = f.getLineNumber();
    if (line >= 0) {
        print(" line: " + line);
    }
    print(postFix);
}
 
Example 6
Source File: PrettyWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void printJavaFrame(RecordedFrame f, String postFix) {
    print(formatMethod(f.getMethod()));
    int line = f.getLineNumber();
    if (line >= 0) {
        print(" line: " + line);
    }
    print(postFix);
}