Skip to content

Commit bb7dacd

Browse files
committed
8275334: Move class loading Events to a separate section in hs_err files
Reviewed-by: stuefe, coleenp
1 parent 3150069 commit bb7dacd

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
@@ -1138,7 +1138,7 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR
11381138

11391139
const char* const class_name = name->as_C_string();
11401140

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

11431143
const char* const file_name = file_name_for_class_name(class_name,
11441144
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

4445
EventLog::EventLog() {
@@ -96,6 +97,7 @@ void Events::init() {
9697
_exceptions = new ExceptionsEventLog("Internal exceptions", "exc");
9798
_redefinitions = new StringEventLog("Classes redefined", "redef");
9899
_class_unloading = new UnloadingEventLog("Classes unloaded", "unload");
100+
_class_loading = new StringEventLog("Classes loaded", "load");
99101
_deopt_messages = new StringEventLog("Deoptimization events", "deopt");
100102
}
101103
}

src/hotspot/share/utilities/events.hpp

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

236236
// Class unloading events
237237
static UnloadingEventLog* _class_unloading;
238+
239+
// Class loading events
240+
static StringEventLog* _class_loading;
238241
public:
239242

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

261264
static void log_class_unloading(Thread* thread, InstanceKlass* ik);
262265

266+
static void log_class_loading(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
267+
263268
static void log_deopt_message(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
264269

265270
// Register default loggers
@@ -314,6 +319,15 @@ inline void Events::log_class_unloading(Thread* thread, InstanceKlass* ik) {
314319
}
315320
}
316321

322+
inline void Events::log_class_loading(Thread* thread, const char* format, ...) {
323+
if (LogEvents && _class_loading != NULL) {
324+
va_list ap;
325+
va_start(ap, format);
326+
_class_loading->logv(thread, format, ap);
327+
va_end(ap);
328+
}
329+
}
330+
317331
inline void Events::log_deopt_message(Thread* thread, const char* format, ...) {
318332
if (LogEvents && _deopt_messages != NULL) {
319333
va_list ap;
@@ -473,4 +487,7 @@ typedef EventMarkWithLogFunction<Events::log> EventMark;
473487
// These end up in the vm_operation log.
474488
typedef EventMarkWithLogFunction<Events::log_vm_operation> EventMarkVMOperation;
475489

490+
// These end up in the class loading log.
491+
typedef EventMarkWithLogFunction<Events::log_class_loading> EventMarkClassLoading;
492+
476493
#endif // SHARE_UTILITIES_EVENTS_HPP

0 commit comments

Comments
 (0)