annotate hotspot/src/share/vm/utilities/events.cpp @ 46545:b970b6e40209

8181450: assert in BasicHashtable::verify_table Summary: remove assert as it has small probability of happening and added logging Reviewed-by: kbarrett, sspitsyn
author coleenp
date Fri, 16 Jun 2017 09:13:56 -0400
parents 48000028382c
children
rev   line source
duke@1 1 /*
coleenp@31234 2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
duke@1 7 * published by the Free Software Foundation.
duke@1 8 *
duke@1 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 13 * accompanied this code).
duke@1 14 *
duke@1 15 * You should have received a copy of the GNU General Public License version
duke@1 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 18 *
trims@5547 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@5547 20 * or visit www.oracle.com if you need additional information or have any
trims@5547 21 * questions.
duke@1 22 *
duke@1 23 */
duke@1 24
stefank@7397 25 #include "precompiled.hpp"
stefank@7397 26 #include "memory/allocation.inline.hpp"
stefank@7397 27 #include "runtime/mutexLocker.hpp"
goetz@25468 28 #include "runtime/os.inline.hpp"
stefank@7397 29 #include "runtime/osThread.hpp"
stefank@14583 30 #include "runtime/thread.inline.hpp"
never@11636 31 #include "runtime/threadCritical.hpp"
stefank@7397 32 #include "runtime/timer.hpp"
stefank@7397 33 #include "utilities/events.hpp"
duke@1 34
duke@1 35
never@11636 36 EventLog* Events::_logs = NULL;
never@11636 37 StringEventLog* Events::_messages = NULL;
never@11636 38 StringEventLog* Events::_exceptions = NULL;
coleenp@31234 39 StringEventLog* Events::_redefinitions = NULL;
never@11636 40 StringEventLog* Events::_deopt_messages = NULL;
duke@1 41
never@11636 42 EventLog::EventLog() {
never@11636 43 // This normally done during bootstrap when we're only single
never@11636 44 // threaded but use a ThreadCritical to ensure inclusion in case
never@11636 45 // some are created slightly late.
never@11636 46 ThreadCritical tc;
never@11636 47 _next = Events::_logs;
never@11636 48 Events::_logs = this;
never@11636 49 }
duke@1 50
never@11636 51 // For each registered event logger, print out the current contents of
never@11636 52 // the buffer. This is normally called when the JVM is crashing.
never@11636 53 void Events::print_all(outputStream* out) {
never@11636 54 EventLog* log = _logs;
never@11636 55 while (log != NULL) {
never@11636 56 log->print_log_on(out);
never@11636 57 log = log->next();
duke@1 58 }
duke@1 59 }
duke@1 60
never@11788 61 void Events::print() {
never@11788 62 print_all(tty);
never@11788 63 }
never@11788 64
never@11636 65 void Events::init() {
never@11636 66 if (LogEvents) {
never@11636 67 _messages = new StringEventLog("Events");
never@11636 68 _exceptions = new StringEventLog("Internal exceptions");
coleenp@31234 69 _redefinitions = new StringEventLog("Classes redefined");
never@11636 70 _deopt_messages = new StringEventLog("Deoptimization events");
never@11636 71 }
duke@1 72 }
duke@1 73
never@11636 74 void eventlog_init() {
never@11636 75 Events::init();
duke@1 76 }
duke@1 77
duke@1 78 ///////////////////////////////////////////////////////////////////////////
duke@1 79 // EventMark
duke@1 80
duke@1 81 EventMark::EventMark(const char* format, ...) {
duke@1 82 if (LogEvents) {
duke@1 83 va_list ap;
duke@1 84 va_start(ap, format);
never@11636 85 // Save a copy of begin message and log it.
never@11636 86 _buffer.printv(format, ap);
drchase@24424 87 Events::log(NULL, "%s", _buffer.buffer());
duke@1 88 va_end(ap);
duke@1 89 }
duke@1 90 }
duke@1 91
duke@1 92 EventMark::~EventMark() {
duke@1 93 if (LogEvents) {
never@11636 94 // Append " done" to the begin message and log it
never@11636 95 _buffer.append(" done");
drchase@24424 96 Events::log(NULL, "%s", _buffer.buffer());
duke@1 97 }
duke@1 98 }