annotate src/share/vm/utilities/events.cpp @ 6862:8a5ea0a9ccc4

7127708: G1: change task num types from int to uint in concurrent mark Summary: Change the type of various task num fields, parameters etc to unsigned and rename them to be more consistent with the other collectors. Code changes were also reviewed by Vitaly Davidovich. Reviewed-by: johnc Contributed-by: Kaushik Srenevasan <kaushik@twitter.com>
author johnc
date Sat, 06 Oct 2012 01:17:44 -0700
parents 09d00c18e323
children f34d701e952e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #include "memory/allocation.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "runtime/mutexLocker.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "runtime/osThread.hpp"
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
29 #include "runtime/threadCritical.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "runtime/threadLocalStorage.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "runtime/timer.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "utilities/events.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 #ifdef TARGET_OS_FAMILY_linux
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
34 # include "thread_linux.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
35 #endif
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
36 #ifdef TARGET_OS_FAMILY_solaris
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
37 # include "thread_solaris.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
38 #endif
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
39 #ifdef TARGET_OS_FAMILY_windows
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
40 # include "thread_windows.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
41 #endif
3960
f08d439fab8c 7089790: integrate bsd-port changes
never
parents: 1972
diff changeset
42 #ifdef TARGET_OS_FAMILY_bsd
f08d439fab8c 7089790: integrate bsd-port changes
never
parents: 1972
diff changeset
43 # include "thread_bsd.inline.hpp"
f08d439fab8c 7089790: integrate bsd-port changes
never
parents: 1972
diff changeset
44 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
47 EventLog* Events::_logs = NULL;
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
48 StringEventLog* Events::_messages = NULL;
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
49 StringEventLog* Events::_exceptions = NULL;
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
50 StringEventLog* Events::_deopt_messages = NULL;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
51
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
52 EventLog::EventLog() {
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
53 // This normally done during bootstrap when we're only single
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
54 // threaded but use a ThreadCritical to ensure inclusion in case
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
55 // some are created slightly late.
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
56 ThreadCritical tc;
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
57 _next = Events::_logs;
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
58 Events::_logs = this;
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
59 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
60
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
61 // For each registered event logger, print out the current contents of
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
62 // the buffer. This is normally called when the JVM is crashing.
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
63 void Events::print_all(outputStream* out) {
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
64 EventLog* log = _logs;
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
65 while (log != NULL) {
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
66 log->print_log_on(out);
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
67 log = log->next();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
68 }
a61af66fc99e Initial load
duke
parents:
diff changeset
69 }
a61af66fc99e Initial load
duke
parents:
diff changeset
70
4944
09d00c18e323 7145537: minor tweaks to LogEvents
never
parents: 4872
diff changeset
71 void Events::print() {
09d00c18e323 7145537: minor tweaks to LogEvents
never
parents: 4872
diff changeset
72 print_all(tty);
09d00c18e323 7145537: minor tweaks to LogEvents
never
parents: 4872
diff changeset
73 }
09d00c18e323 7145537: minor tweaks to LogEvents
never
parents: 4872
diff changeset
74
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
75 void Events::init() {
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
76 if (LogEvents) {
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
77 _messages = new StringEventLog("Events");
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
78 _exceptions = new StringEventLog("Internal exceptions");
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
79 _deopt_messages = new StringEventLog("Deoptimization events");
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
80 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
81 }
a61af66fc99e Initial load
duke
parents:
diff changeset
82
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
83 void eventlog_init() {
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
84 Events::init();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
85 }
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 ///////////////////////////////////////////////////////////////////////////
a61af66fc99e Initial load
duke
parents:
diff changeset
88 // EventMark
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 EventMark::EventMark(const char* format, ...) {
a61af66fc99e Initial load
duke
parents:
diff changeset
91 if (LogEvents) {
a61af66fc99e Initial load
duke
parents:
diff changeset
92 va_list ap;
a61af66fc99e Initial load
duke
parents:
diff changeset
93 va_start(ap, format);
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
94 // Save a copy of begin message and log it.
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
95 _buffer.printv(format, ap);
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
96 Events::log(NULL, _buffer);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
97 va_end(ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
98 }
a61af66fc99e Initial load
duke
parents:
diff changeset
99 }
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 EventMark::~EventMark() {
a61af66fc99e Initial load
duke
parents:
diff changeset
102 if (LogEvents) {
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
103 // Append " done" to the begin message and log it
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
104 _buffer.append(" done");
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
105 Events::log(NULL, _buffer);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
106 }
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }