hotspot.log overlapping log statements (JITWatch) (original) (raw)
David Holmes david.holmes at oracle.com
Wed Feb 26 19:03:16 PST 2014
- Previous message: hotspot.log overlapping log statements (JITWatch)
- Next message: hotspot.log overlapping log statements (JITWatch)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 27/02/2014 3:21 AM, John Rose wrote:
On Feb 26, 2014, at 4:35 AM, David Holmes <david.holmes at oracle.com_ _<mailto: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.
Line-oriented in that we always start a new line when we switch threads
- ok. Hadn't realized that.
You could queue up threads until the writer has finished his line but I'd rather not, given that lines might require internal computation.
That's why I said per-thread buffering (not that I see a way to implement it). No-one blocks but no thread starts to write a line until it has a full line to write.
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 (writerid != lastwriter) { if (haslog) { - logfile->bol(); + int pos = logfile->position(); + if (pos > 0) { + logfile->bol(); + logfile->printcr("", pos); + } // output a hint where this output is coming from: logfile->printcr("", writerid); }
I see.
David
The "pos" bit is redundant, an extra clue about trailing spaces.
— John
- Previous message: hotspot.log overlapping log statements (JITWatch)
- Next message: hotspot.log overlapping log statements (JITWatch)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]