diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index 0287b73e503..05561110ad7 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -1141,7 +1141,7 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR const char* const class_name = name->as_C_string(); - EventMark m("loading class %s", class_name); + EventMarkClassLoading m("Loading class %s", class_name); const char* const file_name = file_name_for_class_name(class_name, name->utf8_length()); diff --git a/src/hotspot/share/utilities/events.cpp b/src/hotspot/share/utilities/events.cpp index f4b7d74ee14..100acb3e90f 100644 --- a/src/hotspot/share/utilities/events.cpp +++ b/src/hotspot/share/utilities/events.cpp @@ -39,6 +39,7 @@ StringEventLog* Events::_vm_operations = NULL; ExceptionsEventLog* Events::_exceptions = NULL; StringEventLog* Events::_redefinitions = NULL; UnloadingEventLog* Events::_class_unloading = NULL; +StringEventLog* Events::_class_loading = NULL; StringEventLog* Events::_deopt_messages = NULL; StringEventLog* Events::_dll_messages = NULL; @@ -97,6 +98,7 @@ void Events::init() { _exceptions = new ExceptionsEventLog("Internal exceptions", "exc"); _redefinitions = new StringEventLog("Classes redefined", "redef"); _class_unloading = new UnloadingEventLog("Classes unloaded", "unload"); + _class_loading = new StringEventLog("Classes loaded", "load"); _deopt_messages = new StringEventLog("Deoptimization events", "deopt"); _dll_messages = new StringEventLog("Dll operation events", "dll"); } diff --git a/src/hotspot/share/utilities/events.hpp b/src/hotspot/share/utilities/events.hpp index 6f3dadde281..8ddf466f206 100644 --- a/src/hotspot/share/utilities/events.hpp +++ b/src/hotspot/share/utilities/events.hpp @@ -238,6 +238,9 @@ class Events : AllStatic { // Class unloading events static UnloadingEventLog* _class_unloading; + + // Class loading events + static StringEventLog* _class_loading; public: // Print all event logs; limit number of events per event log to be printed with max @@ -263,6 +266,8 @@ class Events : AllStatic { static void log_class_unloading(Thread* thread, InstanceKlass* ik); + static void log_class_loading(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + static void log_deopt_message(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); static void log_dll_message(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); @@ -319,6 +324,15 @@ inline void Events::log_class_unloading(Thread* thread, InstanceKlass* ik) { } } +inline void Events::log_class_loading(Thread* thread, const char* format, ...) { + if (LogEvents && _class_loading != NULL) { + va_list ap; + va_start(ap, format); + _class_loading->logv(thread, format, ap); + va_end(ap); + } +} + inline void Events::log_deopt_message(Thread* thread, const char* format, ...) { if (LogEvents && _deopt_messages != NULL) { va_list ap; @@ -487,4 +501,7 @@ typedef EventMarkWithLogFunction EventMark; // These end up in the vm_operation log. typedef EventMarkWithLogFunction EventMarkVMOperation; +// These end up in the class loading log. +typedef EventMarkWithLogFunction EventMarkClassLoading; + #endif // SHARE_UTILITIES_EVENTS_HPP