hotspot/src/share/vm/gc/shared/gcTraceSend.cpp
changeset 40664 1ec65b303bb7
parent 39980 dcef6760667c
child 41076 8c6aa0873dd1
equal deleted inserted replaced
40659:a2b2936240b9 40664:1ec65b303bb7
    41 // All GC dependencies against the trace framework is contained within this file.
    41 // All GC dependencies against the trace framework is contained within this file.
    42 
    42 
    43 typedef uintptr_t TraceAddress;
    43 typedef uintptr_t TraceAddress;
    44 
    44 
    45 void GCTracer::send_garbage_collection_event() const {
    45 void GCTracer::send_garbage_collection_event() const {
    46   EventGCGarbageCollection event(UNTIMED);
    46   EventGarbageCollection event(UNTIMED);
    47   if (event.should_commit()) {
    47   if (event.should_commit()) {
    48     event.set_gcId(GCId::current());
    48     event.set_gcId(GCId::current());
    49     event.set_name(_shared_gc_info.name());
    49     event.set_name(_shared_gc_info.name());
    50     event.set_cause((u2) _shared_gc_info.cause());
    50     event.set_cause((u2) _shared_gc_info.cause());
    51     event.set_sumOfPauses(_shared_gc_info.sum_of_pauses());
    51     event.set_sumOfPauses(_shared_gc_info.sum_of_pauses());
    89     e.commit();
    89     e.commit();
    90   }
    90   }
    91 }
    91 }
    92 
    92 
    93 void ParallelOldTracer::send_parallel_old_event() const {
    93 void ParallelOldTracer::send_parallel_old_event() const {
    94   EventGCParallelOld e(UNTIMED);
    94   EventParallelOldGarbageCollection e(UNTIMED);
    95   if (e.should_commit()) {
    95   if (e.should_commit()) {
    96     e.set_gcId(GCId::current());
    96     e.set_gcId(GCId::current());
    97     e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix());
    97     e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix());
    98     e.set_starttime(_shared_gc_info.start_timestamp());
    98     e.set_starttime(_shared_gc_info.start_timestamp());
    99     e.set_endtime(_shared_gc_info.end_timestamp());
    99     e.set_endtime(_shared_gc_info.end_timestamp());
   100     e.commit();
   100     e.commit();
   101   }
   101   }
   102 }
   102 }
   103 
   103 
   104 void YoungGCTracer::send_young_gc_event() const {
   104 void YoungGCTracer::send_young_gc_event() const {
   105   EventGCYoungGarbageCollection e(UNTIMED);
   105   EventYoungGarbageCollection e(UNTIMED);
   106   if (e.should_commit()) {
   106   if (e.should_commit()) {
   107     e.set_gcId(GCId::current());
   107     e.set_gcId(GCId::current());
   108     e.set_tenuringThreshold(_tenuring_threshold);
   108     e.set_tenuringThreshold(_tenuring_threshold);
   109     e.set_starttime(_shared_gc_info.start_timestamp());
   109     e.set_starttime(_shared_gc_info.start_timestamp());
   110     e.set_endtime(_shared_gc_info.end_timestamp());
   110     e.set_endtime(_shared_gc_info.end_timestamp());
   125                                                      size_t plab_size) const {
   125                                                      size_t plab_size) const {
   126 
   126 
   127   EventPromoteObjectInNewPLAB event;
   127   EventPromoteObjectInNewPLAB event;
   128   if (event.should_commit()) {
   128   if (event.should_commit()) {
   129     event.set_gcId(GCId::current());
   129     event.set_gcId(GCId::current());
   130     event.set_class(klass);
   130     event.set_objectClass(klass);
   131     event.set_objectSize(obj_size);
   131     event.set_objectSize(obj_size);
   132     event.set_tenured(tenured);
   132     event.set_tenured(tenured);
   133     event.set_tenuringAge(age);
   133     event.set_tenuringAge(age);
   134     event.set_plabSize(plab_size);
   134     event.set_plabSize(plab_size);
   135     event.commit();
   135     event.commit();
   140                                                       uint age, bool tenured) const {
   140                                                       uint age, bool tenured) const {
   141 
   141 
   142   EventPromoteObjectOutsidePLAB event;
   142   EventPromoteObjectOutsidePLAB event;
   143   if (event.should_commit()) {
   143   if (event.should_commit()) {
   144     event.set_gcId(GCId::current());
   144     event.set_gcId(GCId::current());
   145     event.set_class(klass);
   145     event.set_objectClass(klass);
   146     event.set_objectSize(obj_size);
   146     event.set_objectSize(obj_size);
   147     event.set_tenured(tenured);
   147     event.set_tenured(tenured);
   148     event.set_tenuringAge(age);
   148     event.set_tenuringAge(age);
   149     event.commit();
   149     event.commit();
   150   }
   150   }
   151 }
   151 }
   152 
   152 
   153 void OldGCTracer::send_old_gc_event() const {
   153 void OldGCTracer::send_old_gc_event() const {
   154   EventGCOldGarbageCollection e(UNTIMED);
   154   EventOldGarbageCollection e(UNTIMED);
   155   if (e.should_commit()) {
   155   if (e.should_commit()) {
   156     e.set_gcId(GCId::current());
   156     e.set_gcId(GCId::current());
   157     e.set_starttime(_shared_gc_info.start_timestamp());
   157     e.set_starttime(_shared_gc_info.start_timestamp());
   158     e.set_endtime(_shared_gc_info.end_timestamp());
   158     e.set_endtime(_shared_gc_info.end_timestamp());
   159     e.commit();
   159     e.commit();
   171 
   171 
   172 void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const {
   172 void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const {
   173   EventPromotionFailed e;
   173   EventPromotionFailed e;
   174   if (e.should_commit()) {
   174   if (e.should_commit()) {
   175     e.set_gcId(GCId::current());
   175     e.set_gcId(GCId::current());
   176     e.set_data(to_trace_struct(pf_info));
   176     e.set_promotionFailed(to_trace_struct(pf_info));
   177     e.set_thread(pf_info.thread_trace_id());
   177     e.set_thread(pf_info.thread_trace_id());
   178     e.commit();
   178     e.commit();
   179   }
   179   }
   180 }
   180 }
   181 
   181 
   188   }
   188   }
   189 }
   189 }
   190 
   190 
   191 #if INCLUDE_ALL_GCS
   191 #if INCLUDE_ALL_GCS
   192 void G1NewTracer::send_g1_young_gc_event() {
   192 void G1NewTracer::send_g1_young_gc_event() {
   193   EventGCG1GarbageCollection e(UNTIMED);
   193   EventG1GarbageCollection e(UNTIMED);
   194   if (e.should_commit()) {
   194   if (e.should_commit()) {
   195     e.set_gcId(GCId::current());
   195     e.set_gcId(GCId::current());
   196     e.set_type(_g1_young_gc_info.type());
   196     e.set_type(_g1_young_gc_info.type());
   197     e.set_starttime(_shared_gc_info.start_timestamp());
   197     e.set_starttime(_shared_gc_info.start_timestamp());
   198     e.set_endtime(_shared_gc_info.end_timestamp());
   198     e.set_endtime(_shared_gc_info.end_timestamp());
   199     e.commit();
   199     e.commit();
   200   }
   200   }
   201 }
   201 }
   202 
   202 
   203 void G1MMUTracer::send_g1_mmu_event(double timeSlice, double gcTime, double maxTime) {
   203 void G1MMUTracer::send_g1_mmu_event(double timeSlice, double gcTime, double maxTime) {
   204   EventGCG1MMU e;
   204   EventG1MMU e;
   205   if (e.should_commit()) {
   205   if (e.should_commit()) {
   206     e.set_gcId(GCId::current());
   206     e.set_gcId(GCId::current());
   207     e.set_timeSlice(timeSlice);
   207     e.set_timeSlice(timeSlice);
   208     e.set_gcTime(gcTime);
   208     e.set_gcTime(gcTime);
   209     e.set_maxGcTime(maxTime);
   209     e.set_maxGcTime(maxTime);
   210     e.commit();
   210     e.commit();
   211   }
   211   }
   212 }
   212 }
   213 
   213 
   214 void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) {
   214 void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) {
   215   EventEvacuationInfo e;
   215   EventEvacuationInformation e;
   216   if (e.should_commit()) {
   216   if (e.should_commit()) {
   217     e.set_gcId(GCId::current());
   217     e.set_gcId(GCId::current());
   218     e.set_cSetRegions(info->collectionset_regions());
   218     e.set_cSetRegions(info->collectionset_regions());
   219     e.set_cSetUsedBefore(info->collectionset_used_before());
   219     e.set_cSetUsedBefore(info->collectionset_used_before());
   220     e.set_cSetUsedAfter(info->collectionset_used_after());
   220     e.set_cSetUsedAfter(info->collectionset_used_after());
   221     e.set_allocationRegions(info->allocation_regions());
   221     e.set_allocationRegions(info->allocation_regions());
   222     e.set_allocRegionsUsedBefore(info->alloc_regions_used_before());
   222     e.set_allocationRegionsUsedBefore(info->alloc_regions_used_before());
   223     e.set_allocRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied());
   223     e.set_allocationRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied());
   224     e.set_bytesCopied(info->bytes_copied());
   224     e.set_bytesCopied(info->bytes_copied());
   225     e.set_regionsFreed(info->regions_freed());
   225     e.set_regionsFreed(info->regions_freed());
   226     e.commit();
   226     e.commit();
   227   }
   227   }
   228 }
   228 }
   229 
   229 
   230 void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const {
   230 void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const {
   231   EventEvacuationFailed e;
   231   EventEvacuationFailed e;
   232   if (e.should_commit()) {
   232   if (e.should_commit()) {
   233     e.set_gcId(GCId::current());
   233     e.set_gcId(GCId::current());
   234     e.set_data(to_trace_struct(ef_info));
   234     e.set_evacuationFailed(to_trace_struct(ef_info));
   235     e.commit();
   235     e.commit();
   236   }
   236   }
   237 }
   237 }
   238 
   238 
   239 static TraceStructG1EvacStats create_g1_evacstats(unsigned gcid, const G1EvacSummary& summary) {
   239 static TraceStructG1EvacuationStatistics
   240   TraceStructG1EvacStats s;
   240 create_g1_evacstats(unsigned gcid, const G1EvacSummary& summary) {
       
   241   TraceStructG1EvacuationStatistics s;
   241   s.set_gcId(gcid);
   242   s.set_gcId(gcid);
   242   s.set_allocated(summary.allocated() * HeapWordSize);
   243   s.set_allocated(summary.allocated() * HeapWordSize);
   243   s.set_wasted(summary.wasted() * HeapWordSize);
   244   s.set_wasted(summary.wasted() * HeapWordSize);
   244   s.set_used(summary.used() * HeapWordSize);
   245   s.set_used(summary.used() * HeapWordSize);
   245   s.set_undoWaste(summary.undo_wasted() * HeapWordSize);
   246   s.set_undoWaste(summary.undo_wasted() * HeapWordSize);
   250   s.set_failureWaste(summary.failure_waste() * HeapWordSize);
   251   s.set_failureWaste(summary.failure_waste() * HeapWordSize);
   251   return s;
   252   return s;
   252 }
   253 }
   253 
   254 
   254 void G1NewTracer::send_young_evacuation_statistics(const G1EvacSummary& summary) const {
   255 void G1NewTracer::send_young_evacuation_statistics(const G1EvacSummary& summary) const {
   255   EventGCG1EvacuationYoungStatistics surv_evt;
   256   EventG1EvacuationYoungStatistics surv_evt;
   256   if (surv_evt.should_commit()) {
   257   if (surv_evt.should_commit()) {
   257     surv_evt.set_stats(create_g1_evacstats(GCId::current(), summary));
   258     surv_evt.set_statistics(create_g1_evacstats(GCId::current(), summary));
   258     surv_evt.commit();
   259     surv_evt.commit();
   259   }
   260   }
   260 }
   261 }
   261 
   262 
   262 void G1NewTracer::send_old_evacuation_statistics(const G1EvacSummary& summary) const {
   263 void G1NewTracer::send_old_evacuation_statistics(const G1EvacSummary& summary) const {
   263   EventGCG1EvacuationOldStatistics old_evt;
   264   EventG1EvacuationOldStatistics old_evt;
   264   if (old_evt.should_commit()) {
   265   if (old_evt.should_commit()) {
   265     old_evt.set_stats(create_g1_evacstats(GCId::current(), summary));
   266     old_evt.set_statistics(create_g1_evacstats(GCId::current(), summary));
   266     old_evt.commit();
   267     old_evt.commit();
   267   }
   268   }
   268 }
   269 }
   269 
   270 
   270 void G1NewTracer::send_basic_ihop_statistics(size_t threshold,
   271 void G1NewTracer::send_basic_ihop_statistics(size_t threshold,
   271                                              size_t target_occupancy,
   272                                              size_t target_occupancy,
   272                                              size_t current_occupancy,
   273                                              size_t current_occupancy,
   273                                              size_t last_allocation_size,
   274                                              size_t last_allocation_size,
   274                                              double last_allocation_duration,
   275                                              double last_allocation_duration,
   275                                              double last_marking_length) {
   276                                              double last_marking_length) {
   276   EventGCG1BasicIHOP evt;
   277   EventG1BasicIHOP evt;
   277   if (evt.should_commit()) {
   278   if (evt.should_commit()) {
   278     evt.set_gcId(GCId::current());
   279     evt.set_gcId(GCId::current());
   279     evt.set_threshold(threshold);
   280     evt.set_threshold(threshold);
   280     evt.set_targetOccupancy(target_occupancy);
   281     evt.set_targetOccupancy(target_occupancy);
   281     evt.set_thresholdPercentage(target_occupancy > 0 ? ((double)threshold / target_occupancy) : 0.0);
   282     evt.set_thresholdPercentage(target_occupancy > 0 ? ((double)threshold / target_occupancy) : 0.0);
   293                                                 size_t current_occupancy,
   294                                                 size_t current_occupancy,
   294                                                 size_t additional_buffer_size,
   295                                                 size_t additional_buffer_size,
   295                                                 double predicted_allocation_rate,
   296                                                 double predicted_allocation_rate,
   296                                                 double predicted_marking_length,
   297                                                 double predicted_marking_length,
   297                                                 bool prediction_active) {
   298                                                 bool prediction_active) {
   298   EventGCG1AdaptiveIHOP evt;
   299   EventG1AdaptiveIHOP evt;
   299   if (evt.should_commit()) {
   300   if (evt.should_commit()) {
   300     evt.set_gcId(GCId::current());
   301     evt.set_gcId(GCId::current());
   301     evt.set_threshold(threshold);
   302     evt.set_threshold(threshold);
   302     evt.set_thresholdPercentage(internal_target_occupancy > 0 ? ((double)threshold / internal_target_occupancy) : 0.0);
   303     evt.set_thresholdPercentage(internal_target_occupancy > 0 ? ((double)threshold / internal_target_occupancy) : 0.0);
   303     evt.set_internalTargetOccupancy(internal_target_occupancy);
   304     evt.set_internalTargetOccupancy(internal_target_occupancy);