jstat LGCC column shows

Yasumasa Suenaga suenaga.yasumasa at oss.ntt.co.jp
Tue Jan 25 01:02:37 UTC 2011


Hi,

I made a patch for resolving this problem and attached it to this email.
I hope to discuss this problem.


Thanks.

(2011/01/04 13:11), Yasumasa Suenaga wrote:
> Hi,
> 
> I ran SPECjvm2008 with OpenJDK6 provided by Fedora14 and Ubuntu 10.10 .
> I got following messages when I attached jstat to that VM with "-gccause" option:
> 
> ------------
> root at ubuntu10:~# jstat -gccause 8411 500
>    S0     S1     E      O      P     YGC     YGCT    FGC    FGCT     GCT    LGCC                 GCC
>    0.00   0.00  12.11  12.65  31.36      1    0.005     2    0.037    0.042 System.gc()          No GC
>    0.00   0.00  12.11  12.65  31.36      1    0.005     2    0.037    0.042 System.gc()          No GC
> 
>     -- snip --
> 
>    0.00   0.00  76.81  12.65  31.58      1    0.005     2    0.037    0.042 System.gc()          No GC
>   42.20   0.00   0.00  12.65  33.10      4    0.011     2    0.037    0.047 unknown GCCause      No GC
>   91.06   0.00   0.00  15.12  34.10     10    0.019     2    0.037    0.056 unknown GCCause      No GC
> 
>     -- snip --
> 
> ------------
> 
> "LGCC" column shows "unknown GCCause".
> I want to get "REAL" last gccause (I want to know what happened in VM, relating to GC).
> (In this case, I guess that LGCC shows "Allocation Failure".)
> 
> 
> I found the comment in constructor of VM_GC_Operation class as following:
> (OpenJDK7 (HS20) and OpenJDK6(HS19) are similar.)
> 
> ------------
>      // A subclass constructor will likely overwrite the following
>      _gc_cause           = GCCause::_no_cause_specified;
> ------------
> 
> 
> I checked constructor of subclass of VM_GC_Operation, and following classes do not
> initialize "_gc_cause" member:
> 
>   - VM_HeapDumper
>   - VM_GC_HeapInspection
>   - VM_GenCollectForAllocation
>   - VM_G1OperationWithAllocRequest
>   - VM_ParallelGCFailedAllocation
>   - VM_ParallelGCFailedPermanentAllocation
> 
> I think that we should initialize "_gc_cause" in constructor of these classes.
> 
> 
> Best regards,
> 
> 


-- 
日本電信電話株式会社 研究企画部門 OSS センタ
応用技術ユニット Webグループ 

末永 恭正(すえなが やすまさ)

TEL: 03-5860-5105 (直通 5069)
E-mail: suenaga.yasumasa at oss.ntt.co.jp
-------------- next part --------------
diff -r 102466e70deb src/share/vm/gc_implementation/g1/vm_operations_g1.hpp
--- a/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp	Thu Jan 20 15:52:05 2011 -0800
+++ b/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp	Tue Jan 25 09:39:32 2011 +0900
@@ -45,7 +45,9 @@
   VM_G1OperationWithAllocRequest(unsigned int gc_count_before,
                                  size_t       word_size)
     : VM_GC_Operation(gc_count_before),
-      _word_size(word_size), _result(NULL), _pause_succeeded(false) { }
+      _word_size(word_size), _result(NULL), _pause_succeeded(false) {
+    _gc_cause = GCCause::_g1_alloc_request;
+  }
   HeapWord* result() { return _result; }
   bool pause_succeeded() { return _pause_succeeded; }
 };
diff -r 102466e70deb src/share/vm/gc_implementation/parallelScavenge/vmPSOperations.cpp
--- a/src/share/vm/gc_implementation/parallelScavenge/vmPSOperations.cpp	Thu Jan 20 15:52:05 2011 -0800
+++ b/src/share/vm/gc_implementation/parallelScavenge/vmPSOperations.cpp	Tue Jan 25 09:39:32 2011 +0900
@@ -39,6 +39,7 @@
   _is_tlab(is_tlab),
   _result(NULL)
 {
+  _gc_cause = GCCause::_allocation_failure;
 }
 
 void VM_ParallelGCFailedAllocation::doit() {
@@ -64,6 +65,7 @@
   _size(size),
   _result(NULL)
 {
+  _gc_cause = GCCause::_allocation_failure;
 }
 
 void VM_ParallelGCFailedPermanentAllocation::doit() {
diff -r 102466e70deb src/share/vm/gc_implementation/shared/vmGCOperations.hpp
--- a/src/share/vm/gc_implementation/shared/vmGCOperations.hpp	Thu Jan 20 15:52:05 2011 -0800
+++ b/src/share/vm/gc_implementation/shared/vmGCOperations.hpp	Tue Jan 25 09:39:32 2011 +0900
@@ -137,6 +137,7 @@
     VM_GC_Operation(0 /* total collections,      dummy, ignored */,
                     0 /* total full collections, dummy, ignored */,
                     request_full_gc) {
+    _gc_cause = GCCause::_heap_inspection;
     _out = out;
     _full_gc = request_full_gc;
     _need_prologue = need_prologue;
@@ -162,6 +163,7 @@
     : VM_GC_Operation(gc_count_before),
       _size(size),
       _tlab(tlab) {
+    _gc_cause = GCCause::_collect_for_allocation;
     _res = NULL;
   }
   ~VM_GenCollectForAllocation()  {}
diff -r 102466e70deb src/share/vm/gc_interface/gcCause.cpp
--- a/src/share/vm/gc_interface/gcCause.cpp	Thu Jan 20 15:52:05 2011 -0800
+++ b/src/share/vm/gc_interface/gcCause.cpp	Tue Jan 25 09:39:32 2011 +0900
@@ -48,6 +48,9 @@
     case _allocation_failure:
       return "Allocation Failure";
 
+    case _collect_for_allocation:
+      return "Collect for Allocation";
+
     case _gc_locker:
       return "GCLocker Initiated GC";
 
@@ -81,6 +84,9 @@
     case _g1_inc_collection_pause:
       return "G1 Evacuation Pause";
 
+    case _g1_alloc_request:
+      return "G1 Allocation Request";
+
     case _last_ditch_collection:
       return "Last ditch collection";
 
diff -r 102466e70deb src/share/vm/gc_interface/gcCause.hpp
--- a/src/share/vm/gc_interface/gcCause.hpp	Thu Jan 20 15:52:05 2011 -0800
+++ b/src/share/vm/gc_interface/gcCause.hpp	Tue Jan 25 09:39:32 2011 +0900
@@ -51,6 +51,7 @@
     _no_gc,
     _no_cause_specified,
     _allocation_failure,
+    _collect_for_allocation,
 
     /* implementation specific */
 
@@ -66,6 +67,7 @@
     _adaptive_size_policy,
 
     _g1_inc_collection_pause,
+    _g1_alloc_request,
 
     _last_ditch_collection,
     _last_gc_cause
diff -r 102466e70deb src/share/vm/services/heapDumper.cpp
--- a/src/share/vm/services/heapDumper.cpp	Thu Jan 20 15:52:05 2011 -0800
+++ b/src/share/vm/services/heapDumper.cpp	Tue Jan 25 09:39:32 2011 +0900
@@ -1390,6 +1390,7 @@
     VM_GC_Operation(0 /* total collections,      dummy, ignored */,
                     0 /* total full collections, dummy, ignored */,
                     gc_before_heap_dump) {
+    _gc_cause = GCCause::_heap_dump;
     _local_writer = writer;
     _gc_before_heap_dump = gc_before_heap_dump;
     _is_segmented_dump = false;


More information about the hotspot-gc-dev mailing list