8275334: Move class loading Events to a separate section in hs_err files

Reviewed-by: stuefe, coleenp
This commit is contained in:
Stefan Karlsson 2021-10-18 07:03:17 +00:00
parent 31500692d1
commit bb7dacdc78
3 changed files with 20 additions and 1 deletions
src/hotspot/share

@ -1138,7 +1138,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());

@ -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;
EventLog::EventLog() {
@ -96,6 +97,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");
}
}

@ -235,6 +235,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
@ -260,6 +263,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);
// Register default loggers
@ -314,6 +319,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;
@ -473,4 +487,7 @@ typedef EventMarkWithLogFunction<Events::log> EventMark;
// These end up in the vm_operation log.
typedef EventMarkWithLogFunction<Events::log_vm_operation> EventMarkVMOperation;
// These end up in the class loading log.
typedef EventMarkWithLogFunction<Events::log_class_loading> EventMarkClassLoading;
#endif // SHARE_UTILITIES_EVENTS_HPP