hotspot.log overlapping log statements (JITWatch)
John Rose
john.r.rose at oracle.com
Wed Feb 26 09:21:52 PST 2014
On Feb 26, 2014, at 4:35 AM, David Holmes <david.holmes at oracle.com> wrote:
> I really didn't follow how you could untangle arbitrary non-delimited text, but I think it will still require changes to the use of the print functions to fix it - right? Logically what we want is per-thread buffering so that we only do a write() of a full line of text.
The log is line-oriented, so switching threads in the middle of a line requires that extra info.
You could queue up threads until the writer has finished his line but I'd rather not, given that lines might require internal computation.
It's better (IMO) to push the work to decode/reassemble after the JVM exits.
Here's approximately what I had in mind:
diff --git a/src/share/vm/utilities/ostream.cpp b/src/share/vm/utilities/ostream.cpp
--- a/src/share/vm/utilities/ostream.cpp
+++ b/src/share/vm/utilities/ostream.cpp
@@ -961,7 +961,11 @@
// got the lock
if (writer_id != _last_writer) {
if (has_log) {
- _log_file->bol();
+ int pos = _log_file->position();
+ if (pos > 0) {
+ _log_file->bol();
+ _log_file->print_cr("<partial_line pos='%d'/>", pos);
+ }
// output a hint where this output is coming from:
_log_file->print_cr("<writer thread='" UINTX_FORMAT "'/>", writer_id);
}
The "pos" bit is redundant, an extra clue about trailing spaces.
— John
More information about the hotspot-dev
mailing list