32
32
import com .oracle .svm .core .Uninterruptible ;
33
33
import com .oracle .svm .core .collections .EnumBitmask ;
34
34
import com .oracle .svm .core .thread .JavaThreads ;
35
+ import com .oracle .svm .core .VMInspectionOptions ;
35
36
36
37
/**
37
38
* This file contains the VM-level events that Native Image supports on all JDK versions. The event
38
39
* IDs depend on the JDK version (see metadata.xml file) and are computed at image build time.
39
40
*/
40
41
public final class JfrEvent {
41
- public static final JfrEvent ThreadStart = create ("jdk.ThreadStart" );
42
+ private static final int defaultInternalSkipCount = VMInspectionOptions .JfrTrimInternalStackTraces .getValue () ? 3 : 0 ;
43
+
44
+ public static final JfrEvent ThreadStart = create ("jdk.ThreadStart" , defaultInternalSkipCount );
42
45
public static final JfrEvent ThreadEnd = create ("jdk.ThreadEnd" );
43
46
public static final JfrEvent ThreadCPULoad = create ("jdk.ThreadCPULoad" );
44
47
public static final JfrEvent DataLoss = create ("jdk.DataLoss" );
@@ -60,41 +63,53 @@ public final class JfrEvent {
60
63
public static final JfrEvent SafepointBegin = create ("jdk.SafepointBegin" , JfrEventFlags .HasDuration );
61
64
public static final JfrEvent SafepointEnd = create ("jdk.SafepointEnd" , JfrEventFlags .HasDuration );
62
65
public static final JfrEvent ExecuteVMOperation = create ("jdk.ExecuteVMOperation" , JfrEventFlags .HasDuration );
63
- public static final JfrEvent JavaMonitorEnter = create ("jdk.JavaMonitorEnter" , JfrEventFlags .HasDuration );
64
- public static final JfrEvent ThreadPark = create ("jdk.ThreadPark" , JfrEventFlags .HasDuration );
65
- public static final JfrEvent JavaMonitorWait = create ("jdk.JavaMonitorWait" , JfrEventFlags .HasDuration );
66
- public static final JfrEvent JavaMonitorInflate = create ("jdk.JavaMonitorInflate" , JfrEventFlags .HasDuration );
67
- public static final JfrEvent ObjectAllocationInNewTLAB = create ("jdk.ObjectAllocationInNewTLAB" );
66
+ public static final JfrEvent JavaMonitorEnter = create ("jdk.JavaMonitorEnter" , defaultInternalSkipCount , JfrEventFlags .HasDuration );
67
+ public static final JfrEvent ThreadPark = create ("jdk.ThreadPark" , defaultInternalSkipCount , JfrEventFlags .HasDuration );
68
+ public static final JfrEvent JavaMonitorWait = create ("jdk.JavaMonitorWait" , defaultInternalSkipCount , JfrEventFlags .HasDuration );
69
+ public static final JfrEvent JavaMonitorInflate = create ("jdk.JavaMonitorInflate" , defaultInternalSkipCount , JfrEventFlags .HasDuration );
70
+ public static final JfrEvent ObjectAllocationInNewTLAB = create ("jdk.ObjectAllocationInNewTLAB" , defaultInternalSkipCount );
68
71
public static final JfrEvent GCHeapSummary = create ("jdk.GCHeapSummary" );
69
72
public static final JfrEvent ThreadAllocationStatistics = create ("jdk.ThreadAllocationStatistics" );
70
- public static final JfrEvent SystemGC = create ("jdk.SystemGC" , JfrEventFlags .HasDuration );
71
- public static final JfrEvent AllocationRequiringGC = create ("jdk.AllocationRequiringGC" );
72
- public static final JfrEvent OldObjectSample = create ("jdk.OldObjectSample" );
73
- public static final JfrEvent ObjectAllocationSample = create ("jdk.ObjectAllocationSample" , JfrEventFlags .SupportsThrottling );
73
+ public static final JfrEvent SystemGC = create ("jdk.SystemGC" , defaultInternalSkipCount , JfrEventFlags .HasDuration );
74
+ public static final JfrEvent AllocationRequiringGC = create ("jdk.AllocationRequiringGC" , defaultInternalSkipCount );
75
+ public static final JfrEvent OldObjectSample = create ("jdk.OldObjectSample" , defaultInternalSkipCount );
76
+ public static final JfrEvent ObjectAllocationSample = create ("jdk.ObjectAllocationSample" , defaultInternalSkipCount , JfrEventFlags .SupportsThrottling );
74
77
public static final JfrEvent NativeMemoryUsage = create ("jdk.NativeMemoryUsage" );
75
78
public static final JfrEvent NativeMemoryUsageTotal = create ("jdk.NativeMemoryUsageTotal" );
76
79
77
80
private final long id ;
78
81
private final String name ;
79
82
private final int flags ;
83
+ private final int skipCount ;
80
84
81
85
@ Platforms (Platform .HOSTED_ONLY .class )
82
86
public static JfrEvent create (String name , JfrEventFlags ... flags ) {
83
- return new JfrEvent (name , flags );
87
+ return new JfrEvent (name , 0 , flags );
88
+ }
89
+
90
+ @ Platforms (Platform .HOSTED_ONLY .class )
91
+ public static JfrEvent create (String name , int skipCount , JfrEventFlags ... flags ) {
92
+ return new JfrEvent (name , skipCount , flags );
84
93
}
85
94
86
95
@ Platforms (Platform .HOSTED_ONLY .class )
87
- private JfrEvent (String name , JfrEventFlags ... flags ) {
96
+ private JfrEvent (String name , int skipCount , JfrEventFlags ... flags ) {
88
97
this .id = JfrMetadataTypeLibrary .lookupPlatformEvent (name );
89
98
this .name = name ;
90
99
this .flags = EnumBitmask .computeBitmask (flags );
100
+ this .skipCount = skipCount ;
91
101
}
92
102
93
103
@ Uninterruptible (reason = CALLED_FROM_UNINTERRUPTIBLE_CODE , mayBeInlined = true )
94
104
public long getId () {
95
105
return id ;
96
106
}
97
107
108
+ @ Uninterruptible (reason = CALLED_FROM_UNINTERRUPTIBLE_CODE , mayBeInlined = true )
109
+ public int getSkipCount () {
110
+ return skipCount ;
111
+ }
112
+
98
113
@ Uninterruptible (reason = CALLED_FROM_UNINTERRUPTIBLE_CODE , mayBeInlined = true )
99
114
public String getName () {
100
115
return name ;
0 commit comments