src/share/vm/gc_implementation/shared/gcTraceSend.cpp

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc_implementation/shared/gcHeapSummary.hpp"
  27 #include "gc_implementation/shared/gcTimer.hpp"
  28 #include "gc_implementation/shared/gcTrace.hpp"
  29 #include "gc_implementation/shared/gcWhen.hpp"
  30 #include "gc_implementation/shared/copyFailedInfo.hpp"

  31 #include "runtime/os.hpp"
  32 #include "trace/tracing.hpp"
  33 #include "trace/traceBackend.hpp"
  34 #if INCLUDE_ALL_GCS
  35 #include "gc_implementation/g1/evacuationInfo.hpp"
  36 #include "gc_implementation/g1/g1YCTypes.hpp"
  37 #endif
  38 
  39 // All GC dependencies against the trace framework is contained within this file.
  40 
  41 typedef uintptr_t TraceAddress;
  42 
  43 void GCTracer::send_garbage_collection_event() const {
  44   EventGCGarbageCollection event(UNTIMED);
  45   if (event.should_commit()) {
  46     event.set_gcId(_shared_gc_info.gc_id().id());
  47     event.set_name(_shared_gc_info.name());
  48     event.set_cause((u2) _shared_gc_info.cause());
  49     event.set_sumOfPauses(_shared_gc_info.sum_of_pauses());
  50     event.set_longestPause(_shared_gc_info.longest_pause());


  90 
  91 void ParallelOldTracer::send_parallel_old_event() const {
  92   EventGCParallelOld e(UNTIMED);
  93   if (e.should_commit()) {
  94     e.set_gcId(_shared_gc_info.gc_id().id());
  95     e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix());
  96     e.set_starttime(_shared_gc_info.start_timestamp());
  97     e.set_endtime(_shared_gc_info.end_timestamp());
  98     e.commit();
  99   }
 100 }
 101 
 102 void YoungGCTracer::send_young_gc_event() const {
 103   EventGCYoungGarbageCollection e(UNTIMED);
 104   if (e.should_commit()) {
 105     e.set_gcId(_shared_gc_info.gc_id().id());
 106     e.set_tenuringThreshold(_tenuring_threshold);
 107     e.set_starttime(_shared_gc_info.start_timestamp());
 108     e.set_endtime(_shared_gc_info.end_timestamp());
 109     e.commit();








































 110   }
 111 }
 112 
 113 void OldGCTracer::send_old_gc_event() const {
 114   EventGCOldGarbageCollection e(UNTIMED);
 115   if (e.should_commit()) {
 116     e.set_gcId(_shared_gc_info.gc_id().id());
 117     e.set_starttime(_shared_gc_info.start_timestamp());
 118     e.set_endtime(_shared_gc_info.end_timestamp());
 119     e.commit();
 120   }
 121 }
 122 
 123 static TraceStructCopyFailed to_trace_struct(const CopyFailedInfo& cf_info) {
 124   TraceStructCopyFailed failed_info;
 125   failed_info.set_objectCount(cf_info.failed_count());
 126   failed_info.set_firstSize(cf_info.first_size());
 127   failed_info.set_smallestSize(cf_info.smallest_size());
 128   failed_info.set_totalSize(cf_info.total_size());
 129   return failed_info;




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc_implementation/shared/gcHeapSummary.hpp"
  27 #include "gc_implementation/shared/gcTimer.hpp"
  28 #include "gc_implementation/shared/gcTrace.hpp"
  29 #include "gc_implementation/shared/gcWhen.hpp"
  30 #include "gc_implementation/shared/copyFailedInfo.hpp"
  31 #include "runtime/handles.hpp"
  32 #include "runtime/os.hpp"
  33 #include "trace/tracing.hpp"
  34 #include "trace/traceBackend.hpp"
  35 #if INCLUDE_ALL_GCS
  36 #include "gc_implementation/g1/evacuationInfo.hpp"
  37 #include "gc_implementation/g1/g1YCTypes.hpp"
  38 #endif
  39 
  40 // All GC dependencies against the trace framework is contained within this file.
  41 
  42 typedef uintptr_t TraceAddress;
  43 
  44 void GCTracer::send_garbage_collection_event() const {
  45   EventGCGarbageCollection event(UNTIMED);
  46   if (event.should_commit()) {
  47     event.set_gcId(_shared_gc_info.gc_id().id());
  48     event.set_name(_shared_gc_info.name());
  49     event.set_cause((u2) _shared_gc_info.cause());
  50     event.set_sumOfPauses(_shared_gc_info.sum_of_pauses());
  51     event.set_longestPause(_shared_gc_info.longest_pause());


  91 
  92 void ParallelOldTracer::send_parallel_old_event() const {
  93   EventGCParallelOld e(UNTIMED);
  94   if (e.should_commit()) {
  95     e.set_gcId(_shared_gc_info.gc_id().id());
  96     e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix());
  97     e.set_starttime(_shared_gc_info.start_timestamp());
  98     e.set_endtime(_shared_gc_info.end_timestamp());
  99     e.commit();
 100   }
 101 }
 102 
 103 void YoungGCTracer::send_young_gc_event() const {
 104   EventGCYoungGarbageCollection e(UNTIMED);
 105   if (e.should_commit()) {
 106     e.set_gcId(_shared_gc_info.gc_id().id());
 107     e.set_tenuringThreshold(_tenuring_threshold);
 108     e.set_starttime(_shared_gc_info.start_timestamp());
 109     e.set_endtime(_shared_gc_info.end_timestamp());
 110     e.commit();
 111   }
 112 }
 113 
 114 bool YoungGCTracer::should_send_promotion_in_new_plab_event() const {
 115   EventPromoteObjectInNewPLAB event;
 116   return event.should_commit();
 117 }
 118 
 119 bool YoungGCTracer::should_send_promotion_outside_plab_event() const {
 120   EventPromoteObjectOutsidePLAB event;
 121   return event.should_commit();
 122 }
 123 
 124 void YoungGCTracer::send_promotion_in_new_plab_event(const oop old, const size_t obj_size,
 125                                                      const uint age, bool tenured,
 126                                                      size_t plab_size) const {
 127 
 128   EventPromoteObjectInNewPLAB event;
 129   if (event.should_commit()) {
 130     event.set_gcId(_shared_gc_info.gc_id().id());
 131     event.set_class(KlassHandle(old->klass())());
 132     event.set_objectSize(obj_size * HeapWordSize);
 133     event.set_tenured(tenured);
 134     event.set_tenuringAge(age);
 135     event.set_plabSize(plab_size * HeapWordSize);
 136     event.commit();
 137   }
 138 }
 139 
 140 void YoungGCTracer::send_promotion_outside_plab_event(const oop old, const size_t obj_size,
 141                                                       const uint age, bool tenured) const {
 142 
 143   EventPromoteObjectOutsidePLAB event;
 144   if (event.should_commit()) {
 145     event.set_gcId(_shared_gc_info.gc_id().id());
 146     event.set_class(KlassHandle(old->klass())());
 147     event.set_objectSize(obj_size * HeapWordSize);
 148     event.set_tenured(tenured);
 149     event.set_tenuringAge(age);
 150     event.commit();
 151   }
 152 }
 153 
 154 void OldGCTracer::send_old_gc_event() const {
 155   EventGCOldGarbageCollection e(UNTIMED);
 156   if (e.should_commit()) {
 157     e.set_gcId(_shared_gc_info.gc_id().id());
 158     e.set_starttime(_shared_gc_info.start_timestamp());
 159     e.set_endtime(_shared_gc_info.end_timestamp());
 160     e.commit();
 161   }
 162 }
 163 
 164 static TraceStructCopyFailed to_trace_struct(const CopyFailedInfo& cf_info) {
 165   TraceStructCopyFailed failed_info;
 166   failed_info.set_objectCount(cf_info.failed_count());
 167   failed_info.set_firstSize(cf_info.first_size());
 168   failed_info.set_smallestSize(cf_info.smallest_size());
 169   failed_info.set_totalSize(cf_info.total_size());
 170   return failed_info;