EventLog::EventLog() { // This normally done during bootstrap when we're only single // threaded but use a ThreadCritical to ensure inclusion in case // some are created slightly late.
ThreadCritical tc;
_next = Events::_logs;
Events::_logs = this;
}
// For each registered event logger, print out the current contents of // the buffer. void Events::print_all(outputStream* out, int max) {
EventLog* log = _logs; while (log != NULL) {
log->print_log_on(out, max);
log = log->next();
}
}
// Print a single event log specified by name. void Events::print_one(outputStream* out, const char* log_name, int max) {
EventLog* log = _logs;
int num_printed = 0; while (log != NULL) {
if (log->matches_name_or_handle(log_name)) {
log->print_log_on(out, max);
num_printed ++;
}
log = log->next();
} // Write a short error note if no name matched.
if (num_printed == 0) {
out->print_cr("The name \"%s\" did not match any known event log. " "Valid event log names are:", log_name);
EventLog* log = _logs; while (log != NULL) {
log->print_names(out);
out->cr();
log = log->next();
}
}
}
void Events::print() {
print_all(tty);
}
void Events::init() {
if (LogEvents) {
_messages = new StringEventLog("Events", "events");
_vm_operations = new StringEventLog("VM Operations", "vmops");
_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");
}
}
void EventMarkBase::log_start(const char* format, va_list argp) { // Save a copy of begin message and log it.
_buffer.printv(format, argp);
_log_function(NULL, "%s", _buffer.buffer());
}
void EventMarkBase::log_end() { // Append " done" to the begin message and log it
_buffer.append(" done");
_log_function(NULL, "%s", _buffer.buffer());
}
void UnloadingEventLog::log(Thread* thread, InstanceKlass* ik) {
if (!should_log()) return;
double timestamp = fetch_timestamp(); // Unloading events are single threaded.
int index = compute_log_index();
_records[index].thread = thread;
_records[index].timestamp = timestamp;
stringStream st(_records[index].data.buffer(),
_records[index].data.size());
st.print("Unloading class " PTR_FORMAT " ", p2i(ik));
ik->name()->print_value_on(&st);
}
void ExceptionsEventLog::log(Thread* thread, Handle h_exception, const char* message, const char* file, int line) {
if (!should_log()) return;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.