From c084431fae8c9f9b5a157cdaca484f63cbd6691a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gr=C3=B6nlund?= Date: Thu, 8 Dec 2022 14:37:18 +0000 Subject: [PATCH] 8298379: JFR: Some UNTIMED events only sets endTime Reviewed-by: ehelin, egahlin --- src/hotspot/share/gc/shared/gcTraceSend.cpp | 1 + src/hotspot/share/gc/shared/objectCountEventSender.cpp | 5 +++-- .../share/jfr/periodic/jfrFinalizerStatisticsEvent.cpp | 3 ++- src/hotspot/share/jfr/periodic/jfrModuleEvent.cpp | 4 +++- src/hotspot/share/jfr/periodic/jfrOSInterface.cpp | 3 ++- src/hotspot/share/jfr/periodic/jfrPeriodic.cpp | 3 +++ src/hotspot/share/jfr/periodic/jfrThreadCPULoadEvent.cpp | 1 + 7 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/hotspot/share/gc/shared/gcTraceSend.cpp b/src/hotspot/share/gc/shared/gcTraceSend.cpp index 5ee37592f28..1cbf1f6fdb0 100644 --- a/src/hotspot/share/gc/shared/gcTraceSend.cpp +++ b/src/hotspot/share/gc/shared/gcTraceSend.cpp @@ -389,6 +389,7 @@ void GCLockerTracer::report_gc_locker() { EventGCLocker event(UNTIMED); if (event.should_commit()) { event.set_starttime(_needs_gc_start_timestamp); + event.set_endtime(_needs_gc_start_timestamp); event.set_lockCount(_jni_lock_count); event.set_stallCount(_stall_count); event.commit(); diff --git a/src/hotspot/share/gc/shared/objectCountEventSender.cpp b/src/hotspot/share/gc/shared/objectCountEventSender.cpp index bf24a98cf67..ce78b847708 100644 --- a/src/hotspot/share/gc/shared/objectCountEventSender.cpp +++ b/src/hotspot/share/gc/shared/objectCountEventSender.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,11 +54,12 @@ template void ObjectCountEventSender::send_event_if_enabled(Klass* klass, jlong count, julong size, const Ticks& timestamp) { T event(UNTIMED); if (event.should_commit()) { + event.set_starttime(timestamp); + event.set_endtime(timestamp); event.set_gcId(GCId::current()); event.set_objectClass(klass); event.set_count(count); event.set_totalSize(size); - event.set_endtime(timestamp); event.commit(); } } diff --git a/src/hotspot/share/jfr/periodic/jfrFinalizerStatisticsEvent.cpp b/src/hotspot/share/jfr/periodic/jfrFinalizerStatisticsEvent.cpp index d292173ba10..ad1c3043690 100644 --- a/src/hotspot/share/jfr/periodic/jfrFinalizerStatisticsEvent.cpp +++ b/src/hotspot/share/jfr/periodic/jfrFinalizerStatisticsEvent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,6 +42,7 @@ static void send_event(const FinalizerEntry* fe, const InstanceKlass* ik, const const char* const url = fe != nullptr ? fe->codesource() : nullptr; const traceid url_symbol_id = url != NULL ? JfrSymbolTable::add(url) : 0; EventFinalizerStatistics event(UNTIMED); + event.set_starttime(timestamp); event.set_endtime(timestamp); event.set_finalizableClass(ik); event.set_codeSource(url_symbol_id); diff --git a/src/hotspot/share/jfr/periodic/jfrModuleEvent.cpp b/src/hotspot/share/jfr/periodic/jfrModuleEvent.cpp index e73e21d3479..ef9ede8bc1d 100644 --- a/src/hotspot/share/jfr/periodic/jfrModuleEvent.cpp +++ b/src/hotspot/share/jfr/periodic/jfrModuleEvent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,6 +60,7 @@ class ModuleExportClosure : public ModuleEventCallbackClosure { static void write_module_dependency_event(const void* from_module, const ModuleEntry* to_module) { EventModuleRequire event(UNTIMED); + event.set_starttime(invocation_time); event.set_endtime(invocation_time); event.set_source((const ModuleEntry* const)from_module); event.set_requiredModule(to_module); @@ -68,6 +69,7 @@ static void write_module_dependency_event(const void* from_module, const ModuleE static void write_module_export_event(const void* package, const ModuleEntry* qualified_export) { EventModuleExport event(UNTIMED); + event.set_starttime(invocation_time); event.set_endtime(invocation_time); event.set_exportedPackage((const PackageEntry*)package); event.set_targetModule(qualified_export); diff --git a/src/hotspot/share/jfr/periodic/jfrOSInterface.cpp b/src/hotspot/share/jfr/periodic/jfrOSInterface.cpp index 85f6614ff5e..9a14bf4837a 100644 --- a/src/hotspot/share/jfr/periodic/jfrOSInterface.cpp +++ b/src/hotspot/share/jfr/periodic/jfrOSInterface.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -292,6 +292,7 @@ int JfrOSInterface::generate_initial_environment_variable_events() { strncpy(key, variable, key_length); key[key_length] = '\0'; EventInitialEnvironmentVariable event(UNTIMED); + event.set_starttime(time_stamp); event.set_endtime(time_stamp); event.set_key(key); event.set_value(value); diff --git a/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp index 79f42b6f425..3704bec1555 100644 --- a/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp +++ b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp @@ -151,6 +151,7 @@ static int _native_library_callback(const char* name, address base, address top, event.set_name(name); event.set_baseAddress((u8)base); event.set_topAddress((u8)top); + event.set_starttime(*(JfrTicks*)param); event.set_endtime(*(JfrTicks*) param); event.commit(); return 0; @@ -425,6 +426,7 @@ TRACE_REQUEST_FUNC(InitialSystemProperty) { EventInitialSystemProperty event(UNTIMED); event.set_key(p->key()); event.set_value(p->value()); + event.set_starttime(time_stamp); event.set_endtime(time_stamp); event.commit(); } @@ -451,6 +453,7 @@ TRACE_REQUEST_FUNC(ThreadAllocationStatistics) { EventThreadAllocationStatistics event(UNTIMED); event.set_allocated(allocated.at(i)); event.set_thread(thread_ids.at(i)); + event.set_starttime(time_stamp); event.set_endtime(time_stamp); event.commit(); } diff --git a/src/hotspot/share/jfr/periodic/jfrThreadCPULoadEvent.cpp b/src/hotspot/share/jfr/periodic/jfrThreadCPULoadEvent.cpp index f9e9c537fd8..41dadd0d394 100644 --- a/src/hotspot/share/jfr/periodic/jfrThreadCPULoadEvent.cpp +++ b/src/hotspot/share/jfr/periodic/jfrThreadCPULoadEvent.cpp @@ -120,6 +120,7 @@ void JfrThreadCPULoadEvent::send_events() { EventThreadCPULoad event(UNTIMED); if (JfrThreadCPULoadEvent::update_event(event, jt, cur_wallclock_time, processor_count)) { event.set_starttime(event_time); + event.set_endtime(event_time); if (jt != periodic_thread) { // Commit reads the thread id from this thread's trace data, so put it there temporarily JfrThreadLocal::impersonate(periodic_thread, JFR_JVM_THREAD_ID(jt));