author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 58291 | a013100f7a35 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51334
diff
changeset
|
2 |
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51334
diff
changeset
|
25 |
#ifndef SHARE_UTILITIES_EVENTS_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51334
diff
changeset
|
26 |
#define SHARE_UTILITIES_EVENTS_HPP |
7397 | 27 |
|
28 |
#include "memory/allocation.hpp" |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
29 |
#include "runtime/mutexLocker.hpp" |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
30 |
#include "runtime/thread.hpp" |
46560
388aa8d67c80
8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents:
37466
diff
changeset
|
31 |
#include "utilities/formatBuffer.hpp" |
55217 | 32 |
#include "utilities/globalDefinitions.hpp" |
33 |
#include "utilities/ostream.hpp" |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
34 |
#include "utilities/vmError.hpp" |
7397 | 35 |
|
1 | 36 |
// Events and EventMark provide interfaces to log events taking place in the vm. |
37 |
// This facility is extremly useful for post-mortem debugging. The eventlog |
|
38 |
// often provides crucial information about events leading up to the crash. |
|
39 |
// |
|
11788 | 40 |
// Abstractly the logs can record whatever they way but normally they |
41 |
// would record at least a timestamp and the current Thread, along |
|
42 |
// with whatever data they need in a ring buffer. Commonly fixed |
|
43 |
// length text messages are recorded for simplicity but other |
|
44 |
// strategies could be used. Several logs are provided by default but |
|
45 |
// new instances can be created as needed. |
|
1 | 46 |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
47 |
// The base event log dumping class that is registered for dumping at |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
48 |
// crash time. This is a very generic interface that is mainly here |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
49 |
// for completeness. Normally the templated EventLogBase would be |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
50 |
// subclassed to provide different log types. |
13195 | 51 |
class EventLog : public CHeapObj<mtInternal> { |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
52 |
friend class Events; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
53 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
54 |
private: |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
55 |
EventLog* _next; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
56 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
57 |
EventLog* next() const { return _next; } |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
58 |
|
1 | 59 |
public: |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
60 |
// Automatically registers the log so that it will be printed during |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
61 |
// crashes. |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
62 |
EventLog(); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
63 |
|
55217 | 64 |
// Print log to output stream. |
65 |
virtual void print_log_on(outputStream* out, int max = -1) = 0; |
|
66 |
||
67 |
// Returns true if s matches either the log name or the log handle. |
|
68 |
virtual bool matches_name_or_handle(const char* s) const = 0; |
|
69 |
||
70 |
// Print log names (for help output of VM.events). |
|
71 |
virtual void print_names(outputStream* out) const = 0; |
|
72 |
||
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
73 |
}; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
74 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
75 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
76 |
// A templated subclass of EventLog that provides basic ring buffer |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
77 |
// functionality. Most event loggers should subclass this, possibly |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
78 |
// providing a more featureful log function if the existing copy |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
79 |
// semantics aren't appropriate. The name is used as the label of the |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
80 |
// log when it is dumped during a crash. |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
81 |
template <class T> class EventLogBase : public EventLog { |
17376
4ee999c3c007
8012902: remove use of global operator new - take 2
minqi
parents:
17031
diff
changeset
|
82 |
template <class X> class EventRecord : public CHeapObj<mtInternal> { |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
83 |
public: |
11788 | 84 |
double timestamp; |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
85 |
Thread* thread; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
86 |
X data; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
87 |
}; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
88 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
89 |
protected: |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
90 |
Mutex _mutex; |
55217 | 91 |
// Name is printed out as a header. |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
92 |
const char* _name; |
55217 | 93 |
// Handle is a short specifier used to select this particular event log |
94 |
// for printing (see VM.events command). |
|
95 |
const char* _handle; |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
96 |
int _length; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
97 |
int _index; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
98 |
int _count; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
99 |
EventRecord<T>* _records; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
100 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
101 |
public: |
55217 | 102 |
EventLogBase<T>(const char* name, const char* handle, int length = LogEventsBufferEntries): |
58291
a013100f7a35
8213150: Add verification for locking by VMThread
coleenp
parents:
55217
diff
changeset
|
103 |
_mutex(Mutex::event, name, true, Mutex::_safepoint_check_never), |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
104 |
_name(name), |
55217 | 105 |
_handle(handle), |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
106 |
_length(length), |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
107 |
_index(0), |
51334
cc2c79d22508
8208671: Runtime, JFR, Serviceability changes to allow enabling -Wreorder
tschatzl
parents:
47216
diff
changeset
|
108 |
_count(0) { |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
109 |
_records = new EventRecord<T>[length]; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
110 |
} |
1 | 111 |
|
11788 | 112 |
double fetch_timestamp() { |
11795
0c892974d26c
7146729: nightly failure after 7141200: tty is sometimes null during shutdown of main thread
never
parents:
11788
diff
changeset
|
113 |
return os::elapsedTime(); |
11788 | 114 |
} |
115 |
||
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
116 |
// move the ring buffer to next open slot and return the index of |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
117 |
// the slot to use for the current message. Should only be called |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
118 |
// while mutex is held. |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
119 |
int compute_log_index() { |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
120 |
int index = _index; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
121 |
if (_count < _length) _count++; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
122 |
_index++; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
123 |
if (_index >= _length) _index = 0; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
124 |
return index; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
125 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
126 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
127 |
bool should_log() { |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
128 |
// Don't bother adding new entries when we're crashing. This also |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
129 |
// avoids mutating the ring buffer when printing the log. |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
130 |
return !VMError::fatal_error_in_progress(); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
131 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
132 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
133 |
// Print the contents of the log |
55217 | 134 |
void print_log_on(outputStream* out, int max = -1); |
135 |
||
136 |
// Returns true if s matches either the log name or the log handle. |
|
137 |
bool matches_name_or_handle(const char* s) const; |
|
138 |
||
139 |
// Print log names (for help output of VM.events). |
|
140 |
void print_names(outputStream* out) const; |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
141 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
142 |
private: |
55217 | 143 |
void print_log_impl(outputStream* out, int max = -1); |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
144 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
145 |
// Print a single element. A templated implementation might need to |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
146 |
// be declared by subclasses. |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
147 |
void print(outputStream* out, T& e); |
1 | 148 |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
149 |
void print(outputStream* out, EventRecord<T>& e) { |
11788 | 150 |
out->print("Event: %.3f ", e.timestamp); |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
151 |
if (e.thread != NULL) { |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
17376
diff
changeset
|
152 |
out->print("Thread " INTPTR_FORMAT " ", p2i(e.thread)); |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
153 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
154 |
print(out, e.data); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
155 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
156 |
}; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
157 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
158 |
// A simple wrapper class for fixed size text messages. |
53784
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
159 |
template <size_t bufsz> |
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
160 |
class FormatStringLogMessage : public FormatBuffer<bufsz> { |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
161 |
}; |
53784
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
162 |
typedef FormatStringLogMessage<256> StringLogMessage; |
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
163 |
typedef FormatStringLogMessage<512> ExtendedStringLogMessage; |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
164 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
165 |
// A simple ring buffer of fixed size text messages. |
53784
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
166 |
template <size_t bufsz> |
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
167 |
class FormatStringEventLog : public EventLogBase< FormatStringLogMessage<bufsz> > { |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
168 |
public: |
55217 | 169 |
FormatStringEventLog(const char* name, const char* short_name, int count = LogEventsBufferEntries) |
170 |
: EventLogBase< FormatStringLogMessage<bufsz> >(name, short_name, count) {} |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
171 |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
17376
diff
changeset
|
172 |
void logv(Thread* thread, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0) { |
53784
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
173 |
if (!this->should_log()) return; |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
174 |
|
53784
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
175 |
double timestamp = this->fetch_timestamp(); |
54623
1126f0607c70
8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents:
53874
diff
changeset
|
176 |
MutexLocker ml(&this->_mutex, Mutex::_no_safepoint_check_flag); |
53784
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
177 |
int index = this->compute_log_index(); |
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
178 |
this->_records[index].thread = thread; |
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
179 |
this->_records[index].timestamp = timestamp; |
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
180 |
this->_records[index].data.printv(format, ap); |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
181 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
182 |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
17376
diff
changeset
|
183 |
void log(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(3, 4) { |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
184 |
va_list ap; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
185 |
va_start(ap, format); |
53784
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
186 |
this->logv(thread, format, ap); |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
187 |
va_end(ap); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
188 |
} |
1 | 189 |
}; |
53784
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
190 |
typedef FormatStringEventLog<256> StringEventLog; |
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
191 |
typedef FormatStringEventLog<512> ExtendedStringEventLog; |
1 | 192 |
|
53738
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
193 |
class InstanceKlass; |
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
194 |
|
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
195 |
// Event log for class unloading events to materialize the class name in place in the log stream. |
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
196 |
class UnloadingEventLog : public EventLogBase<StringLogMessage> { |
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
197 |
public: |
55217 | 198 |
UnloadingEventLog(const char* name, const char* short_name, int count = LogEventsBufferEntries) |
199 |
: EventLogBase<StringLogMessage>(name, short_name, count) {} |
|
53738
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
200 |
|
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
201 |
void log(Thread* thread, InstanceKlass* ik); |
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
202 |
}; |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
203 |
|
53874
b2fb6f782d84
8153413: Exceptions::_throw always logs exceptions, penalizing performance
coleenp
parents:
53784
diff
changeset
|
204 |
// Event log for exceptions |
b2fb6f782d84
8153413: Exceptions::_throw always logs exceptions, penalizing performance
coleenp
parents:
53784
diff
changeset
|
205 |
class ExceptionsEventLog : public ExtendedStringEventLog { |
b2fb6f782d84
8153413: Exceptions::_throw always logs exceptions, penalizing performance
coleenp
parents:
53784
diff
changeset
|
206 |
public: |
55217 | 207 |
ExceptionsEventLog(const char* name, const char* short_name, int count = LogEventsBufferEntries) |
208 |
: ExtendedStringEventLog(name, short_name, count) {} |
|
53874
b2fb6f782d84
8153413: Exceptions::_throw always logs exceptions, penalizing performance
coleenp
parents:
53784
diff
changeset
|
209 |
|
b2fb6f782d84
8153413: Exceptions::_throw always logs exceptions, penalizing performance
coleenp
parents:
53784
diff
changeset
|
210 |
void log(Thread* thread, Handle h_exception, const char* message, const char* file, int line); |
b2fb6f782d84
8153413: Exceptions::_throw always logs exceptions, penalizing performance
coleenp
parents:
53784
diff
changeset
|
211 |
}; |
b2fb6f782d84
8153413: Exceptions::_throw always logs exceptions, penalizing performance
coleenp
parents:
53784
diff
changeset
|
212 |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
213 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
214 |
class Events : AllStatic { |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
215 |
friend class EventLog; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
216 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
217 |
private: |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
218 |
static EventLog* _logs; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
219 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
220 |
// A log for generic messages that aren't well categorized. |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
221 |
static StringEventLog* _messages; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
222 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
223 |
// A log for internal exception related messages, like internal |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
224 |
// throws and implicit exceptions. |
53874
b2fb6f782d84
8153413: Exceptions::_throw always logs exceptions, penalizing performance
coleenp
parents:
53784
diff
changeset
|
225 |
static ExceptionsEventLog* _exceptions; |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
226 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
227 |
// Deoptization related messages |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
228 |
static StringEventLog* _deopt_messages; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
229 |
|
31234
48000028382c
8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents:
28163
diff
changeset
|
230 |
// Redefinition related messages |
48000028382c
8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents:
28163
diff
changeset
|
231 |
static StringEventLog* _redefinitions; |
48000028382c
8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents:
28163
diff
changeset
|
232 |
|
53738
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
233 |
// Class unloading events |
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
234 |
static UnloadingEventLog* _class_unloading; |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
235 |
public: |
55217 | 236 |
|
237 |
// Print all event logs; limit number of events per event log to be printed with max |
|
238 |
// (max == -1 prints all events). |
|
239 |
static void print_all(outputStream* out, int max = -1); |
|
240 |
||
241 |
// Print a single event log specified by name or handle. |
|
242 |
static void print_one(outputStream* out, const char* log_name, int max = -1); |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
243 |
|
11788 | 244 |
// Dump all events to the tty |
245 |
static void print(); |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
246 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
247 |
// Logs a generic message with timestamp and format as printf. |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
17376
diff
changeset
|
248 |
static void log(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
249 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
250 |
// Log exception related message |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
17376
diff
changeset
|
251 |
static void log_exception(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); |
53874
b2fb6f782d84
8153413: Exceptions::_throw always logs exceptions, penalizing performance
coleenp
parents:
53784
diff
changeset
|
252 |
static void log_exception(Thread* thread, Handle h_exception, const char* message, const char* file, int line); |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
253 |
|
31234
48000028382c
8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents:
28163
diff
changeset
|
254 |
static void log_redefinition(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); |
48000028382c
8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents:
28163
diff
changeset
|
255 |
|
53738
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
256 |
static void log_class_unloading(Thread* thread, InstanceKlass* ik); |
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
257 |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
17376
diff
changeset
|
258 |
static void log_deopt_message(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
259 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
260 |
// Register default loggers |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
261 |
static void init(); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
262 |
}; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
263 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
264 |
inline void Events::log(Thread* thread, const char* format, ...) { |
55044 | 265 |
if (LogEvents && _messages != NULL) { |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
266 |
va_list ap; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
267 |
va_start(ap, format); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
268 |
_messages->logv(thread, format, ap); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
269 |
va_end(ap); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
270 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
271 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
272 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
273 |
inline void Events::log_exception(Thread* thread, const char* format, ...) { |
55044 | 274 |
if (LogEvents && _exceptions != NULL) { |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
275 |
va_list ap; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
276 |
va_start(ap, format); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
277 |
_exceptions->logv(thread, format, ap); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
278 |
va_end(ap); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
279 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
280 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
281 |
|
53874
b2fb6f782d84
8153413: Exceptions::_throw always logs exceptions, penalizing performance
coleenp
parents:
53784
diff
changeset
|
282 |
inline void Events::log_exception(Thread* thread, Handle h_exception, const char* message, const char* file, int line) { |
55044 | 283 |
if (LogEvents && _exceptions != NULL) { |
53874
b2fb6f782d84
8153413: Exceptions::_throw always logs exceptions, penalizing performance
coleenp
parents:
53784
diff
changeset
|
284 |
_exceptions->log(thread, h_exception, message, file, line); |
b2fb6f782d84
8153413: Exceptions::_throw always logs exceptions, penalizing performance
coleenp
parents:
53784
diff
changeset
|
285 |
} |
b2fb6f782d84
8153413: Exceptions::_throw always logs exceptions, penalizing performance
coleenp
parents:
53784
diff
changeset
|
286 |
} |
b2fb6f782d84
8153413: Exceptions::_throw always logs exceptions, penalizing performance
coleenp
parents:
53784
diff
changeset
|
287 |
|
31234
48000028382c
8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents:
28163
diff
changeset
|
288 |
inline void Events::log_redefinition(Thread* thread, const char* format, ...) { |
55044 | 289 |
if (LogEvents && _redefinitions != NULL) { |
31234
48000028382c
8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents:
28163
diff
changeset
|
290 |
va_list ap; |
48000028382c
8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents:
28163
diff
changeset
|
291 |
va_start(ap, format); |
48000028382c
8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents:
28163
diff
changeset
|
292 |
_redefinitions->logv(thread, format, ap); |
48000028382c
8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents:
28163
diff
changeset
|
293 |
va_end(ap); |
48000028382c
8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents:
28163
diff
changeset
|
294 |
} |
48000028382c
8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents:
28163
diff
changeset
|
295 |
} |
48000028382c
8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file
coleenp
parents:
28163
diff
changeset
|
296 |
|
53738
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
297 |
inline void Events::log_class_unloading(Thread* thread, InstanceKlass* ik) { |
55044 | 298 |
if (LogEvents && _class_unloading != NULL) { |
53738
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
299 |
_class_unloading->log(thread, ik); |
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
300 |
} |
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
301 |
} |
7f3b27d9c22d
8212988: add recent class unloading events to the hs_err log
coleenp
parents:
53244
diff
changeset
|
302 |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
303 |
inline void Events::log_deopt_message(Thread* thread, const char* format, ...) { |
55044 | 304 |
if (LogEvents && _deopt_messages != NULL) { |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
305 |
va_list ap; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
306 |
va_start(ap, format); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
307 |
_deopt_messages->logv(thread, format, ap); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
308 |
va_end(ap); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
309 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
310 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
311 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
312 |
template <class T> |
55217 | 313 |
inline void EventLogBase<T>::print_log_on(outputStream* out, int max) { |
34633
2a6c7c7b30a7
8132510: Replace ThreadLocalStorage with compiler/language-based thread-local variables
dholmes
parents:
31234
diff
changeset
|
314 |
if (Thread::current_or_null() == NULL) { |
2a6c7c7b30a7
8132510: Replace ThreadLocalStorage with compiler/language-based thread-local variables
dholmes
parents:
31234
diff
changeset
|
315 |
// Not yet attached? Don't try to use locking |
55217 | 316 |
print_log_impl(out, max); |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
317 |
} else { |
54623
1126f0607c70
8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents:
53874
diff
changeset
|
318 |
MutexLocker ml(&_mutex, Mutex::_no_safepoint_check_flag); |
55217 | 319 |
print_log_impl(out, max); |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
320 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
321 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
322 |
|
55217 | 323 |
template <class T> |
324 |
inline bool EventLogBase<T>::matches_name_or_handle(const char* s) const { |
|
325 |
return ::strcasecmp(s, _name) == 0 || |
|
326 |
::strcasecmp(s, _handle) == 0; |
|
327 |
} |
|
328 |
||
329 |
template <class T> |
|
330 |
inline void EventLogBase<T>::print_names(outputStream* out) const { |
|
331 |
out->print("\"%s\" : %s", _handle, _name); |
|
332 |
} |
|
333 |
||
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
334 |
// Dump the ring buffer entries that current have entries. |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
335 |
template <class T> |
55217 | 336 |
inline void EventLogBase<T>::print_log_impl(outputStream* out, int max) { |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
337 |
out->print_cr("%s (%d events):", _name, _count); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
338 |
if (_count == 0) { |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
339 |
out->print_cr("No events"); |
11788 | 340 |
out->cr(); |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
341 |
return; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
342 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
343 |
|
55217 | 344 |
int printed = 0; |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
345 |
if (_count < _length) { |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
346 |
for (int i = 0; i < _count; i++) { |
55217 | 347 |
if (max > 0 && printed == max) { |
348 |
break; |
|
349 |
} |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
350 |
print(out, _records[i]); |
55217 | 351 |
printed ++; |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
352 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
353 |
} else { |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
354 |
for (int i = _index; i < _length; i++) { |
55217 | 355 |
if (max > 0 && printed == max) { |
356 |
break; |
|
357 |
} |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
358 |
print(out, _records[i]); |
55217 | 359 |
printed ++; |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
360 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
361 |
for (int i = 0; i < _index; i++) { |
55217 | 362 |
if (max > 0 && printed == max) { |
363 |
break; |
|
364 |
} |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
365 |
print(out, _records[i]); |
55217 | 366 |
printed ++; |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
367 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
368 |
} |
55217 | 369 |
|
370 |
if (printed == max) { |
|
371 |
out->print_cr("...(skipped)"); |
|
372 |
} |
|
373 |
||
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
374 |
out->cr(); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
375 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
376 |
|
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
377 |
// Implement a printing routine for the StringLogMessage |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
378 |
template <> |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
379 |
inline void EventLogBase<StringLogMessage>::print(outputStream* out, StringLogMessage& lm) { |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
380 |
out->print_raw(lm); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
381 |
out->cr(); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
382 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
383 |
|
53784
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
384 |
// Implement a printing routine for the ExtendedStringLogMessage |
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
385 |
template <> |
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
386 |
inline void EventLogBase<ExtendedStringLogMessage>::print(outputStream* out, ExtendedStringLogMessage& lm) { |
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
387 |
out->print_raw(lm); |
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
388 |
out->cr(); |
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
389 |
} |
31e3aa9c0c71
8204551: Event descriptions are truncated in logs
ysuenaga
parents:
53738
diff
changeset
|
390 |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
391 |
// Place markers for the beginning and end up of a set of events. |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
392 |
// These end up in the default log. |
1 | 393 |
class EventMark : public StackObj { |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
394 |
StringLogMessage _buffer; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
395 |
|
1 | 396 |
public: |
397 |
// log a begin event, format as printf |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
17376
diff
changeset
|
398 |
EventMark(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); |
1 | 399 |
// log an end event |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
7397
diff
changeset
|
400 |
~EventMark(); |
1 | 401 |
}; |
402 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51334
diff
changeset
|
403 |
#endif // SHARE_UTILITIES_EVENTS_HPP |