49 _next = Events::_logs; |
49 _next = Events::_logs; |
50 Events::_logs = this; |
50 Events::_logs = this; |
51 } |
51 } |
52 |
52 |
53 // For each registered event logger, print out the current contents of |
53 // For each registered event logger, print out the current contents of |
54 // the buffer. This is normally called when the JVM is crashing. |
54 // the buffer. |
55 void Events::print_all(outputStream* out) { |
55 void Events::print_all(outputStream* out, int max) { |
56 EventLog* log = _logs; |
56 EventLog* log = _logs; |
57 while (log != NULL) { |
57 while (log != NULL) { |
58 log->print_log_on(out); |
58 log->print_log_on(out, max); |
59 log = log->next(); |
59 log = log->next(); |
60 } |
60 } |
61 } |
61 } |
|
62 |
|
63 // Print a single event log specified by name. |
|
64 void Events::print_one(outputStream* out, const char* log_name, int max) { |
|
65 EventLog* log = _logs; |
|
66 int num_printed = 0; |
|
67 while (log != NULL) { |
|
68 if (log->matches_name_or_handle(log_name)) { |
|
69 log->print_log_on(out, max); |
|
70 num_printed ++; |
|
71 } |
|
72 log = log->next(); |
|
73 } |
|
74 // Write a short error note if no name matched. |
|
75 if (num_printed == 0) { |
|
76 out->print_cr("The name \"%s\" did not match any known event log. " |
|
77 "Valid event log names are:", log_name); |
|
78 EventLog* log = _logs; |
|
79 while (log != NULL) { |
|
80 log->print_names(out); |
|
81 out->cr(); |
|
82 log = log->next(); |
|
83 } |
|
84 } |
|
85 } |
|
86 |
62 |
87 |
63 void Events::print() { |
88 void Events::print() { |
64 print_all(tty); |
89 print_all(tty); |
65 } |
90 } |
66 |
91 |
67 void Events::init() { |
92 void Events::init() { |
68 if (LogEvents) { |
93 if (LogEvents) { |
69 _messages = new StringEventLog("Events"); |
94 _messages = new StringEventLog("Events", "events"); |
70 _exceptions = new ExceptionsEventLog("Internal exceptions"); |
95 _exceptions = new ExceptionsEventLog("Internal exceptions", "exc"); |
71 _redefinitions = new StringEventLog("Classes redefined"); |
96 _redefinitions = new StringEventLog("Classes redefined", "redef"); |
72 _class_unloading = new UnloadingEventLog("Classes unloaded"); |
97 _class_unloading = new UnloadingEventLog("Classes unloaded", "unload"); |
73 _deopt_messages = new StringEventLog("Deoptimization events"); |
98 _deopt_messages = new StringEventLog("Deoptimization events", "deopt"); |
74 } |
99 } |
75 } |
100 } |
76 |
101 |
77 void eventlog_init() { |
102 void eventlog_init() { |
78 Events::init(); |
103 Events::init(); |