RFR: Apply UL to PrintCodeCacheOnCompilation

David Holmes david.holmes at oracle.com
Thu May 18 06:40:22 UTC 2017


Hi Chihiro,

Reviews take place on the mailing list for the area the code change 
relates to - in this case it looks like 
hotspot-compiler-dev at opnejdk.java.net. Please send your RFR over there.

Thanks,
David

On 18/05/2017 4:22 PM, chihiro ito wrote:
> Hi all,
>
> I apply Unified JVM Logging to log of PrintCodeCacheOnCompilation
> option. Logs which applied this is following.
> Could you possibly review for this following small change? If review is
> ok, please commit this as cito.
>
> Sample Log:
> [1.370s][debug][compilation,codecache] CodeHeap 'non-profiled nmethods':
> size=120036Kb used=13Kb max_used=13Kb free=120022Kb
> [1.372s][debug][compilation,codecache] CodeHeap 'profiled nmethods':
> size=120032Kb used=85Kb max_used=85Kb free=119946Kb
> [1.372s][debug][compilation,codecache] CodeHeap 'non-nmethods':
> size=5692Kb used=2648Kb max_used=2655Kb free=3043Kb
>
> Source:
> diff --git a/src/share/vm/compiler/compileBroker.cpp
> b/src/share/vm/compiler/compileBroker.cpp
> --- a/src/share/vm/compiler/compileBroker.cpp
> +++ b/src/share/vm/compiler/compileBroker.cpp
> @@ -1726,6 +1726,34 @@
>    tty->print("%s", s.as_string());
>  }
>
> +// wrapper for CodeCache::print_summary() using outputStream
> +static void codecache_print(outputStream* out, bool detailed)
> +{
> +  ResourceMark rm;
> +  stringStream s;
> +
> +  // Dump code cache into a buffer
> +  {
> +    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
> +    CodeCache::print_summary(&s, detailed);
> +  }
> +
> +  char* summary = s.as_string();
> +  char* cr_pos;
> +
> +  do {
> +    cr_pos = strchr(summary, '\n');
> +    if (cr_pos != NULL) {
> +      *cr_pos = '\0';
> +    }
> +    if (strlen(summary)!=0) {
> +      out->print_cr("%s", summary);
> +    }
> +
> +    summary = cr_pos + 1;
> +  } while (cr_pos != NULL);
> +}
> +
>  void CompileBroker::post_compile(CompilerThread* thread, CompileTask*
> task, EventCompilation& event, bool success, ciEnv* ci_env) {
>
>    if (success) {
> @@ -1939,6 +1967,10 @@
>      tty->print_cr("time: %d inlined: %d bytes",
> (int)time.milliseconds(), task->num_inlined_bytecodes());
>    }
>
> +  Log(compilation, codecache) log;
> +  if (log.is_debug())
> +    codecache_print(log.debug_stream(), /* detailed= */ false);
> +
>    if (PrintCodeCacheOnCompilation)
>      codecache_print(/* detailed= */ false);
>
>
> Regards,
> Chihiro
>
>


More information about the jdk10-dev mailing list