Quantcast

RFR: Apply UL to PrintCodeCacheOnCompilation

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RFR: Apply UL to PrintCodeCacheOnCompilation

chihiro ito
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>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFR: Apply UL to PrintCodeCacheOnCompilation

Vladimir Kozlov
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
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFR: Apply UL to PrintCodeCacheOnCompilation

chihiro ito
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 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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFR: Apply UL to PrintCodeCacheOnCompilation

Vladimir Kozlov
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>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFR: Apply UL to PrintCodeCacheOnCompilation

chihiro ito
Hi Vladimir,

Thank you for build.
For Windows, I found that I use strtok_s instead of strtok_r. On Windows, should I use strtok_s? I thought that a common code is good (not depend on the OS) . It was fixed as follows.

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,33 @@
   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* remaining_log = s.as_string();
+  char* eol;
+
+  while( *remaining_log != '\0' ){
+    eol = strchr(remaining_log, '\n');
+    if( eol == NULL ) {
+      out->print_cr("%s", remaining_log);
+      remaining_log = remaining_log + strlen(remaining_log);
+    } else {
+      *eol = '\0';
+      out->print_cr("%s", remaining_log);
+      remaining_log = eol + 1;
+    }
+  }
+}
+
 void CompileBroker::post_compile(CompilerThread* thread, CompileTask* task, EventCompilation& event, bool success, ciEnv* ci_env) {
 
   if (success) {
@@ -1939,6 +1966,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

On 2017/05/20 2:12, Vladimir Kozlov wrote:
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>

--

Chihiro Ito | Principal Consultant | +81.90.6148.8815
Oracle 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
Loading...