hotspot.log overlapping log statements (JITWatch)

David Holmes david.holmes at oracle.com
Wed Feb 26 19:03:16 PST 2014


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 (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);
>       }

I see.

David
-----


> The "pos" bit is redundant, an extra clue about trailing spaces.
>
> — John


More information about the hotspot-dev mailing list