jdk.jfr.StackTrace Java Examples
The following examples show how to use
jdk.jfr.StackTrace.
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: EventControl.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
EventControl(PlatformEventType eventType) { eventControls.put(Enabled.NAME, defineEnabled(eventType)); if (eventType.hasDuration()) { eventControls.put(Threshold.NAME, defineThreshold(eventType)); } if (eventType.hasStackTrace()) { eventControls.put(StackTrace.NAME, defineStackTrace(eventType)); } if (eventType.hasPeriod()) { eventControls.put(Period.NAME, definePeriod(eventType)); } if (eventType.hasCutoff()) { eventControls.put(Cutoff.NAME, defineCutoff(eventType)); } ArrayList<AnnotationElement> aes = new ArrayList<>(eventType.getAnnotationElements()); remove(eventType, aes, Threshold.class); remove(eventType, aes, Period.class); remove(eventType, aes, Enabled.class); remove(eventType, aes, StackTrace.class); remove(eventType, aes, Cutoff.class); aes.trimToSize(); eventType.setAnnotations(aes); this.type = eventType; this.idName = String.valueOf(eventType.getId()); }
Example #2
Source File: MetadataRepository.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private void initializeJVMEventTypes() { List<RequestHook> requestHooks = new ArrayList<>(); for (Type type : typeLibrary.getTypes()) { if (type instanceof PlatformEventType) { PlatformEventType pEventType = (PlatformEventType) type; EventType eventType = PrivateAccess.getInstance().newEventType(pEventType); pEventType.setHasDuration(eventType.getAnnotation(Threshold.class) != null); pEventType.setHasStackTrace(eventType.getAnnotation(StackTrace.class) != null); pEventType.setHasCutoff(eventType.getAnnotation(Cutoff.class) != null); pEventType.setHasPeriod(eventType.getAnnotation(Period.class) != null); // Must add hook before EventControl is created as it removes // annotations, such as Period and Threshold. if (pEventType.hasPeriod()) { pEventType.setEventHook(true); if (!"com.oracle.jdk.ExecutionSample".equals(type.getName())) { requestHooks.add(new RequestHook(pEventType)); } } nativeControls.add(new EventControl(pEventType)); nativeEventTypes.add(eventType); } } RequestEngine.addHooks(requestHooks); }
Example #3
Source File: EventControl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
EventControl(PlatformEventType eventType) { eventControls.put(Enabled.NAME, defineEnabled(eventType)); if (eventType.hasDuration()) { eventControls.put(Threshold.NAME, defineThreshold(eventType)); } if (eventType.hasStackTrace()) { eventControls.put(StackTrace.NAME, defineStackTrace(eventType)); } if (eventType.hasPeriod()) { eventControls.put(Period.NAME, definePeriod(eventType)); } if (eventType.hasCutoff()) { eventControls.put(Cutoff.NAME, defineCutoff(eventType)); } ArrayList<AnnotationElement> aes = new ArrayList<>(eventType.getAnnotationElements()); remove(eventType, aes, Threshold.class); remove(eventType, aes, Period.class); remove(eventType, aes, Enabled.class); remove(eventType, aes, StackTrace.class); remove(eventType, aes, Cutoff.class); aes.trimToSize(); eventType.setAnnotations(aes); this.type = eventType; this.idName = String.valueOf(eventType.getId()); }
Example #4
Source File: MetadataRepository.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private void initializeJVMEventTypes() { List<RequestHook> requestHooks = new ArrayList<>(); for (Type type : typeLibrary.getTypes()) { if (type instanceof PlatformEventType) { PlatformEventType pEventType = (PlatformEventType) type; EventType eventType = PrivateAccess.getInstance().newEventType(pEventType); pEventType.setHasDuration(eventType.getAnnotation(Threshold.class) != null); pEventType.setHasStackTrace(eventType.getAnnotation(StackTrace.class) != null); pEventType.setHasCutoff(eventType.getAnnotation(Cutoff.class) != null); pEventType.setHasPeriod(eventType.getAnnotation(Period.class) != null); // Must add hook before EventControl is created as it removes // annotations, such as Period and Threshold. if (pEventType.hasPeriod()) { pEventType.setEventHook(true); if (!(Type.EVENT_NAME_PREFIX + "ExecutionSample").equals(type.getName())) { requestHooks.add(new RequestHook(pEventType)); } } nativeControls.add(new EventControl(pEventType)); nativeEventTypes.add(eventType); } } RequestEngine.addHooks(requestHooks); }
Example #5
Source File: EventControl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
EventControl(PlatformEventType eventType) { eventControls.put(Enabled.NAME, defineEnabled(eventType)); if (eventType.hasDuration()) { eventControls.put(Threshold.NAME, defineThreshold(eventType)); } if (eventType.hasStackTrace()) { eventControls.put(StackTrace.NAME, defineStackTrace(eventType)); } if (eventType.hasPeriod()) { eventControls.put(Period.NAME, definePeriod(eventType)); } if (eventType.hasCutoff()) { eventControls.put(Cutoff.NAME, defineCutoff(eventType)); } ArrayList<AnnotationElement> aes = new ArrayList<>(eventType.getAnnotationElements()); remove(eventType, aes, Threshold.class); remove(eventType, aes, Period.class); remove(eventType, aes, Enabled.class); remove(eventType, aes, StackTrace.class); remove(eventType, aes, Cutoff.class); aes.trimToSize(); eventType.setAnnotations(aes); this.type = eventType; this.idName = String.valueOf(eventType.getId()); }
Example #6
Source File: MetadataRepository.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private void initializeJVMEventTypes() { List<RequestHook> requestHooks = new ArrayList<>(); for (Type type : typeLibrary.getTypes()) { if (type instanceof PlatformEventType) { PlatformEventType pEventType = (PlatformEventType) type; EventType eventType = PrivateAccess.getInstance().newEventType(pEventType); pEventType.setHasDuration(eventType.getAnnotation(Threshold.class) != null); pEventType.setHasStackTrace(eventType.getAnnotation(StackTrace.class) != null); pEventType.setHasCutoff(eventType.getAnnotation(Cutoff.class) != null); pEventType.setHasPeriod(eventType.getAnnotation(Period.class) != null); // Must add hook before EventControl is created as it removes // annotations, such as Period and Threshold. if (pEventType.hasPeriod()) { pEventType.setEventHook(true); if (!(Type.EVENT_NAME_PREFIX + "ExecutionSample").equals(type.getName())) { requestHooks.add(new RequestHook(pEventType)); } } nativeControls.add(new EventControl(pEventType)); nativeEventTypes.add(eventType); } } RequestEngine.addHooks(requestHooks); }
Example #7
Source File: EventControl.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static Control defineStackTrace(PlatformEventType type) { StackTrace stackTrace = type.getAnnotation(StackTrace.class); String def = "true"; if (stackTrace != null) { def = Boolean.toString(stackTrace.value()); } type.add(PrivateAccess.getInstance().newSettingDescriptor(TYPE_STACK_TRACE, StackTrace.NAME, def, Collections.emptyList())); return new StackTraceSetting(type, def); }
Example #8
Source File: TestStackTrace.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { EventType onEvent = EventType.getEventType(StackTraceOnEvent.class); EventType offEvent = EventType.getEventType(StackTraceOffEvent.class); String defaultValue = Events.getSetting(onEvent, StackTrace.NAME).getDefaultValue(); Asserts.assertEquals(defaultValue, "true", "@StackTrace(true) should reault in 'true'"); defaultValue = Events.getSetting(offEvent, StackTrace.NAME).getDefaultValue(); Asserts.assertEquals(defaultValue, "false", "@StackTrace(false) should reault in 'false'"); }
Example #9
Source File: EventControl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static Control defineStackTrace(PlatformEventType type) { StackTrace stackTrace = type.getAnnotation(StackTrace.class); String def = "true"; if (stackTrace != null) { def = Boolean.toString(stackTrace.value()); } type.add(PrivateAccess.getInstance().newSettingDescriptor(TYPE_STACK_TRACE, StackTrace.NAME, def, Collections.emptyList())); return new StackTraceSetting(type, def); }
Example #10
Source File: TestStackTrace.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { EventType onEvent = EventType.getEventType(StackTraceOnEvent.class); EventType offEvent = EventType.getEventType(StackTraceOffEvent.class); String defaultValue = Events.getSetting(onEvent, StackTrace.NAME).getDefaultValue(); Asserts.assertEquals(defaultValue, "true", "@StackTrace(true) should reault in 'true'"); defaultValue = Events.getSetting(offEvent, StackTrace.NAME).getDefaultValue(); Asserts.assertEquals(defaultValue, "false", "@StackTrace(false) should reault in 'false'"); }
Example #11
Source File: EventControl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static Control defineStackTrace(PlatformEventType type) { StackTrace stackTrace = type.getAnnotation(StackTrace.class); String def = "true"; if (stackTrace != null) { def = Boolean.toString(stackTrace.value()); } type.add(PrivateAccess.getInstance().newSettingDescriptor(TYPE_STACK_TRACE, StackTrace.NAME, def, Collections.emptyList())); return new StackTraceSetting(type, def); }
Example #12
Source File: TestStackTrace.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { EventType onEvent = EventType.getEventType(StackTraceOnEvent.class); EventType offEvent = EventType.getEventType(StackTraceOffEvent.class); String defaultValue = Events.getSetting(onEvent, StackTrace.NAME).getDefaultValue(); Asserts.assertEquals(defaultValue, "true", "@StackTrace(true) should reault in 'true'"); defaultValue = Events.getSetting(offEvent, StackTrace.NAME).getDefaultValue(); Asserts.assertEquals(defaultValue, "false", "@StackTrace(false) should reault in 'false'"); }
Example #13
Source File: TraceHandler.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { switch (qName) { case ELEMENT_RELATION_DECL: String relationalURI = attributes.getValue(ATTRIBUTE_URI); String id = attributes.getValue(ATTRIBUTE_ID); typedef.put(id, relationalURI); break; case ELEMENT_PRIMARY_TYPE: addTypedef(attributes); break; case ELEMENT_STRUCT_ARRAY: valueDeclarations.add(new ValueDeclaration(type, 1, attributes)); break; case ELEMENT_VALUE: case ELEMENT_STRUCT_VALUE: valueDeclarations.add(new ValueDeclaration(type, 0, attributes)); break; case ELEMENT_EVENT: type = createType(attributes, true, structTypeId++, false); boolean stackTrace = getBoolean(attributes, ATTRIBUTE_HAS_STACKTRACE); boolean thread = getBoolean(attributes, (ATTRIBUTE_HAS_THREAD)); boolean instant = getBoolean(attributes, (ATTRIBUTE_IS_INSTANT)); boolean requestable = getBoolean(attributes, (ATTRIBUTE_IS_REQUESTABLE)); boolean constant = getBoolean(attributes, (ATTRIBUTE_IS_CONSTANT)); boolean duration = !requestable && !instant; boolean experimental = getBoolean(attributes, ATTRIBUTE_EXPERIMENTAL); boolean cutoff = getBoolean(attributes, ATTRIBUTE_CUTOFF); TypeLibrary.addImplicitFields(type, requestable, duration, thread, stackTrace, cutoff); ArrayList<AnnotationElement> aes = new ArrayList<>(); aes.addAll(type.getAnnotationElements()); if (requestable) { String period = constant ? "endChunk" : "everyChunk"; aes.add(new AnnotationElement(Period.class, period)); } else { if (!instant) { aes.add(new AnnotationElement(Threshold.class, "0 ns")); } if (stackTrace) { aes.add(new AnnotationElement(StackTrace.class, true)); } } if (cutoff) { aes.add(new AnnotationElement(Cutoff.class, Cutoff.INIFITY)); } if (experimental) { aes.add(new AnnotationElement(Experimental.class)); } aes.add(new AnnotationElement(Enabled.class, false)); aes.trimToSize(); type.setAnnotations(aes); break; case ELEMENT_CONTENT_TYPE: if (attributes.getValue(ATTRIBUTE_BUILTIN_TYPE) != null) { type = createType(attributes, false, builtInId(attributes), true); } else { type = createType(attributes, false, jvmTypeId++, true); } break; case ELEMENT_STRUCT_TYPE: case ELEMENT_STRUCT: type = createType(attributes, false, structTypeId++, false); break; } }