RFR: Apply UL to PrintCodeCacheOnCompilation
Vladimir Kozlov
vladimir.kozlov at oracle.com
Thu May 18 17:51:00 UTC 2017
Hi Chihiro,
Changes looks fine.
Please, file Enhancement in JBS. Then we can sponsor it.
Thanks,
Vladimir
On 5/18/17 6:10 AM, 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,22 @@
> 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);
> + }
> +
> + for( char *pos, *line = strtok_r(s.as_string(), "\n", &pos) ; line != NULL ; line = strtok_r(NULL, "\n", &pos) ) {
> + out->print_cr("%s", line);
> + }
> +}
> +
> void CompileBroker::post_compile(CompilerThread* thread, CompileTask* task, EventCompilation& event, bool success, ciEnv* ci_env) {
>
> if (success) {
> @@ -1939,6 +1955,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 hotspot-compiler-dev
mailing list