Skip to content

Commit ad94e70

Browse files
committed
8275334: Move class loading Events to a separate section in hs_err files
Backport-of: bb7dacdc78ad50797900e7e9610a1ed8e7ab1b00
1 parent d29fe03 commit ad94e70

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

src/hotspot/share/classfile/classLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR
11411141

11421142
const char* const class_name = name->as_C_string();
11431143

1144-
EventMark m("loading class %s", class_name);
1144+
EventMarkClassLoading m("Loading class %s", class_name);
11451145

11461146
const char* const file_name = file_name_for_class_name(class_name,
11471147
name->utf8_length());

src/hotspot/share/utilities/events.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ StringEventLog* Events::_vm_operations = NULL;
3939
ExceptionsEventLog* Events::_exceptions = NULL;
4040
StringEventLog* Events::_redefinitions = NULL;
4141
UnloadingEventLog* Events::_class_unloading = NULL;
42+
StringEventLog* Events::_class_loading = NULL;
4243
StringEventLog* Events::_deopt_messages = NULL;
4344
StringEventLog* Events::_dll_messages = NULL;
4445

@@ -97,6 +98,7 @@ void Events::init() {
9798
_exceptions = new ExceptionsEventLog("Internal exceptions", "exc");
9899
_redefinitions = new StringEventLog("Classes redefined", "redef");
99100
_class_unloading = new UnloadingEventLog("Classes unloaded", "unload");
101+
_class_loading = new StringEventLog("Classes loaded", "load");
100102
_deopt_messages = new StringEventLog("Deoptimization events", "deopt");
101103
_dll_messages = new StringEventLog("Dll operation events", "dll");
102104
}

src/hotspot/share/utilities/events.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ class Events : AllStatic {
238238

239239
// Class unloading events
240240
static UnloadingEventLog* _class_unloading;
241+
242+
// Class loading events
243+
static StringEventLog* _class_loading;
241244
public:
242245

243246
// Print all event logs; limit number of events per event log to be printed with max
@@ -263,6 +266,8 @@ class Events : AllStatic {
263266

264267
static void log_class_unloading(Thread* thread, InstanceKlass* ik);
265268

269+
static void log_class_loading(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
270+
266271
static void log_deopt_message(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
267272

268273
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) {
319324
}
320325
}
321326

327+
inline void Events::log_class_loading(Thread* thread, const char* format, ...) {
328+
if (LogEvents && _class_loading != NULL) {
329+
va_list ap;
330+
va_start(ap, format);
331+
_class_loading->logv(thread, format, ap);
332+
va_end(ap);
333+
}
334+
}
335+
322336
inline void Events::log_deopt_message(Thread* thread, const char* format, ...) {
323337
if (LogEvents && _deopt_messages != NULL) {
324338
va_list ap;
@@ -487,4 +501,7 @@ typedef EventMarkWithLogFunction<Events::log> EventMark;
487501
// These end up in the vm_operation log.
488502
typedef EventMarkWithLogFunction<Events::log_vm_operation> EventMarkVMOperation;
489503

504+
// These end up in the class loading log.
505+
typedef EventMarkWithLogFunction<Events::log_class_loading> EventMarkClassLoading;
506+
490507
#endif // SHARE_UTILITIES_EVENTS_HPP

0 commit comments

Comments
 (0)