RFR(S/M): 8217659 monitor_logging updates from Async Monitor Deflation project

Daniel D. Daugherty daniel.daugherty at oracle.com
Sat Jan 26 02:03:07 UTC 2019


On 1/24/19 9:27 AM, Daniel D. Daugherty wrote:
> On 1/24/19 2:41 AM, David Holmes wrote:
>
>> When we have different Info versus Debug logging eg:
>>
>> !   if (deflated_count != 0) {
>> !     if (log_is_enabled(Info, monitorinflation)) {
>> !       log_info(monitorinflation)("deflating global idle monitors, 
>> %3.7f secs, %d monitors", timer.seconds(), deflated_count);
>> !     }
>> !   } else {
>> !     if (log_is_enabled(Debug, monitorinflation)) {
>> !       log_debug(monitorinflation)("deflating global idle monitors, 
>> %3.7f secs, 0 monitors", timer.seconds());
>> !     }
>> !   }
>>
>> is it possible to rewrite that as:
>>
>>  if (log_is_enabled( deflated_count != 0 ? Info : Debug,
>>                     monitorinflation)) {
>> !       log_info(monitorinflation)("deflating global idle monitors, 
>> %3.7f secs, %d monitors", timer.seconds(), deflated_count);
>> !     }
>>
>> or does the logging macro-magic not allow it?
>
> Good question. I'll check it out.

Closing the loop on this question:

/work/shared/bug_hunt/8183909/8217659_exp/open/src/hotspot/share/runtime/synchronizer.cpp:1653:22: 
error: expected unqualified-id
   if (log_is_enabled((deflated_count != 0) ? Info : Debug, 
monitorinflation)) {
                      ^
/work/shared/bug_hunt/8183909/8217659_exp/open/src/hotspot/share/runtime/synchronizer.cpp:1653:46: 
error: use of undeclared identifier 'Info'; did you mean 'LogLevel::Info'?
   if (log_is_enabled((deflated_count != 0) ? Info : Debug, 
monitorinflation)) {
                                              ^~~~
                                              LogLevel::Info
/work/shared/bug_hunt/8183909/8217659_exp/open/src/hotspot/share/logging/log.hpp:69:88: 
note: expanded from macro 'log_is_enabled'
#define log_is_enabled(level, ...) 
(LogImpl<LOG_TAGS(__VA_ARGS__)>::is_level(LogLevel::level))

        ^
/work/shared/bug_hunt/8183909/8217659_exp/open/src/hotspot/share/logging/logLevel.hpp:57:5: 
note: 'LogLevel::Info' declared here
     LOG_LEVEL_LIST
     ^
/work/shared/bug_hunt/8183909/8217659_exp/open/src/hotspot/share/logging/logLevel.hpp:48:13: 
note: expanded from macro 'LOG_LEVEL_LIST'
   LOG_LEVEL(Info, info) \
             ^
/work/shared/bug_hunt/8183909/8217659_exp/open/src/hotspot/share/runtime/synchronizer.cpp:1653:53: 
error: use of undeclared identifier 'Debug'; did you mean 'LogLevel::Debug'?
   if (log_is_enabled((deflated_count != 0) ? Info : Debug, 
monitorinflation)) {
                                                     ^~~~~
LogLevel::Debug
/work/shared/bug_hunt/8183909/8217659_exp/open/src/hotspot/share/logging/log.hpp:69:88: 
note: expanded from macro 'log_is_enabled'
#define log_is_enabled(level, ...) 
(LogImpl<LOG_TAGS(__VA_ARGS__)>::is_level(LogLevel::level))

        ^
/work/shared/bug_hunt/8183909/8217659_exp/open/src/hotspot/share/logging/logLevel.hpp:57:5: 
note: 'LogLevel::Debug' declared here
     LOG_LEVEL_LIST
     ^
/work/shared/bug_hunt/8183909/8217659_exp/open/src/hotspot/share/logging/logLevel.hpp:47:13: 
note: expanded from macro 'LOG_LEVEL_LIST'
   LOG_LEVEL(Debug, debug) \
             ^
3 errors generated.


Yeah, the macro stuff was definitely not happy, but I think
I have come up with a different simplification...

Dan



More information about the hotspot-runtime-dev mailing list