50113
|
1 |
/*
|
58863
|
2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
50113
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
|
24 |
*/
|
|
25 |
|
|
26 |
package jdk.jfr.consumer;
|
|
27 |
|
|
28 |
import java.lang.reflect.Modifier;
|
|
29 |
|
58863
|
30 |
import jdk.jfr.internal.consumer.ObjectContext;
|
50113
|
31 |
|
|
32 |
/**
|
|
33 |
* A recorded frame in a stack trace.
|
|
34 |
*
|
|
35 |
* @since 9
|
|
36 |
*/
|
|
37 |
public final class RecordedFrame extends RecordedObject {
|
|
38 |
// package private
|
58863
|
39 |
RecordedFrame(ObjectContext objectContext, Object[] values) {
|
|
40 |
super(objectContext, values);
|
50113
|
41 |
}
|
|
42 |
|
|
43 |
/**
|
|
44 |
* Returns {@code true} if this is a Java frame, {@code false} otherwise.
|
|
45 |
* <p>
|
|
46 |
* A Java method that has a native modifier is considered a Java frame.
|
|
47 |
*
|
|
48 |
* @return {@code true} if this is a Java frame, {@code false} otherwise
|
|
49 |
*
|
|
50 |
* @see Modifier#isNative(int)
|
|
51 |
*/
|
|
52 |
public boolean isJavaFrame() {
|
|
53 |
// Only Java frames exist today, but this allows
|
|
54 |
// API to be extended for native frame in the future.
|
|
55 |
if (hasField("javaFrame")) {
|
|
56 |
return getTyped("javaFrame", Boolean.class, Boolean.TRUE);
|
|
57 |
}
|
|
58 |
return true;
|
|
59 |
}
|
|
60 |
|
|
61 |
/**
|
|
62 |
* Returns the bytecode index for the execution point that is represented by
|
|
63 |
* this recorded frame.
|
|
64 |
*
|
|
65 |
* @return byte code index, or {@code -1} if doesn't exist
|
|
66 |
*/
|
|
67 |
public int getBytecodeIndex() {
|
|
68 |
return getTyped("bytecodeIndex", Integer.class, Integer.valueOf(-1));
|
|
69 |
}
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Returns the line number for the execution point that is represented by this
|
|
73 |
* recorded frame, or {@code -1} if doesn't exist
|
|
74 |
*
|
|
75 |
* @return the line number, or {@code -1} if doesn't exist
|
|
76 |
*/
|
|
77 |
public int getLineNumber() {
|
|
78 |
return getTyped("lineNumber", Integer.class, Integer.valueOf(-1));
|
|
79 |
}
|
|
80 |
|
|
81 |
/**
|
|
82 |
* Returns the frame type for the execution point that is represented by this
|
|
83 |
* recorded frame (for example, {@code "Interpreted"}, {@code "JIT compiled"} or
|
|
84 |
* {@code "Inlined"}).
|
|
85 |
*
|
|
86 |
* @return the frame type, or {@code null} if doesn't exist
|
|
87 |
*/
|
|
88 |
public String getType() {
|
|
89 |
return getTyped("type", String.class, null);
|
|
90 |
}
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Returns the method for the execution point that is represented by this
|
|
94 |
* recorded frame.
|
|
95 |
*
|
|
96 |
* @return the method, not {@code null}
|
|
97 |
*/
|
|
98 |
public RecordedMethod getMethod() {
|
|
99 |
return getTyped("method", RecordedMethod.class, null);
|
|
100 |
}
|
|
101 |
}
|