RFR: 8154791: Xlog classload too redundant msgs info/debug

Max Ockner max.ockner at oracle.com
Tue May 10 16:55:50 UTC 2016


Thanks for the responses.

(1) classFileParser.cpp missing conditional

This provides a better view: 
http://cr.openjdk.java.net/~mockner/8154791.02/src/share/vm/classfile/classFileParser.cpp.sdiff.html

Here is the surrounding code:
     if (log_is_enabled(Info, class, load)) {
       ResourceMark rm;
       const char* module_name = NULL;
       static const size_t modules_image_name_len = 
strlen(MODULES_IMAGE_NAME);
       size_t stream_len = strlen(_stream->source());
       // See if _stream->source() ends in "modules"
       if (module_entry->is_named() && modules_image_name_len < 
stream_len &&
         (strncmp(_stream->source() + stream_len - modules_image_name_len,
                  MODULES_IMAGE_NAME, modules_image_name_len) == 0)) {
         module_name = module_entry->name()->as_C_string();
       }
       ik->print_loading_log(_loader_data, module_name, _stream);
     }

The log_is_enabled conditional has always been there at the top. The 
conditionals at the bottom (which have been removed) were used to 
differentiate between info and debug cases. Since there is no debug 
level for class,load now, we can remove these conditionals.

(2) Snippet of output

This is what we used to have for debug level logging:
[0.027s][info][class,load] java.lang.Object source: jrt:/java.base
[0.027s][debug][class,load] java.lang.Object source: jrt:/java.base 
klass: 0x00000007c0000fb0 super: 0x0000000000000000 loader: [NULL 
class_loader] bytes: 1859 checksum: 8833820d

This is what we now have for info level logging:
[0.023s][info][class,load] java.lang.Object source: jrt:/java.base 
klass: 0x00000007c0000fb0 super: 0x0000000000000000 loader: [NULL 
class_loader] bytes: 1859 checksum: 8833820d

There is no longer any debug level logging for class,load

Thanks,
Max

On 5/10/2016 3:45 AM, David Holmes wrote:
> On 10/05/2016 12:56 PM, Ioi Lam wrote:
>> Max,
>>
>> Does this mean that the class loading log is always printed. Or at
>> least, all the formatting in instanceKlass::print_loading_log() is done
>> and the stuff is printed to a NULL stream?
>
> That's what I was wondering too - the call in 
> src/share/vm/classfile/classFileParser.cpp is unconditional.
>
> David
>
>> classFileParser.cpp:
>>
>>     ik->print_loading_log(_loader_data, module_name, _stream);
>>
>> InstanceKlass::print_loading_log(...) {
>>   outputStream* log = Log(class, load)::info_stream();
>>   // Name and class hierarchy info
>>   log->print("%s", external_name());
>>   ...
>> }
>>
>> I think you should add a quick test in print_loading_log() and return if
>> (class, load) is not enabled.
>>
>> As usual, it would be helpful for the reviewers if you can include a
>> small sample of the output (before and after).
>>
>> Thanks
>> - Ioi
>>
>> On 5/9/16 12:06 PM, Coleen Phillimore wrote:
>>>
>>> Max, This looks a lot nicer.
>>> Thanks,
>>> Coleen
>>>
>>>
>>> On 5/9/16 2:43 PM, Max Ockner wrote:
>>>> Hello,
>>>>
>>>> Please review this small change to logging for class loading.
>>>>
>>>> Webrev: http://cr.openjdk.java.net/~mockner/8154791.02/
>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8154791
>>>>
>>>> -Xlog:class+load=debug used to produce redundant info. Some of the
>>>> debug level lines were nearly identical to some of the info level
>>>> lines. To reduce the redundant information, these debug messages have
>>>> been moved into the info level, replacing the corresponding info
>>>> messages.
>>>>
>>>> Tested with jtreg runtime.
>>>>
>>>> I can wait to submit this until after the FC deadline.
>>>>
>>>> Thanks,
>>>> Max
>>>
>>



More information about the hotspot-runtime-dev mailing list