RFR: Apply UL to PrintCodeCacheOnCompilation

Vladimir Kozlov vladimir.kozlov at oracle.com
Fri May 19 17:12:00 UTC 2017


Unfortunately build failed on Windows:

compileBroker.cpp(1740) : error C3861: 'strtok_r': identifier not found

Vladimir

On 5/19/17 3:03 AM, chihiro ito wrote:
> Hi Vladimir,
>
> Thank you for reviewing and advice. I created a enhancement in JBS as JDK-8180654. Could you possibly check it and
> commit this to jdk10/hs as cito.
>
> Regards,
> Chihiro
>
> On 2017/05/19 2:51, Vladimir Kozlov wrote:
>> 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
>>>
>>>
>
> --
>
> Chihiro Ito | Principal Consultant | +81.90.6148.8815
> Oracle <http://www.oracle.com> Consultant
> ORACLE Japan | Akasaka Center Bldg. | Motoakasaka 1-3-13 | 1070051 Minato-ku, Tokyo, JAPAN
>
> Oracle is committed to developing practices and products that help protect the environment
> <http://www.oracle.com/commitment>


More information about the hotspot-compiler-dev mailing list