hotspot/src/share/vm/gc/shared/gcTraceSend.cpp
changeset 33107 77bf0d2069a3
parent 32380 1dcdb686f0cb
child 34300 6075c1e0e913
--- a/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp	Tue Sep 29 17:44:58 2015 +0200
+++ b/hotspot/src/share/vm/gc/shared/gcTraceSend.cpp	Wed Sep 30 09:07:21 2015 +0200
@@ -44,7 +44,7 @@
 void GCTracer::send_garbage_collection_event() const {
   EventGCGarbageCollection event(UNTIMED);
   if (event.should_commit()) {
-    event.set_gcId(_shared_gc_info.gc_id().id());
+    event.set_gcId(GCId::current());
     event.set_name(_shared_gc_info.name());
     event.set_cause((u2) _shared_gc_info.cause());
     event.set_sumOfPauses(_shared_gc_info.sum_of_pauses());
@@ -58,7 +58,7 @@
 void GCTracer::send_reference_stats_event(ReferenceType type, size_t count) const {
   EventGCReferenceStatistics e;
   if (e.should_commit()) {
-      e.set_gcId(_shared_gc_info.gc_id().id());
+      e.set_gcId(GCId::current());
       e.set_type((u1)type);
       e.set_count(count);
       e.commit();
@@ -69,7 +69,7 @@
                                                       const MetaspaceChunkFreeListSummary& summary) const {
   EventMetaspaceChunkFreeListSummary e;
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.gc_id().id());
+    e.set_gcId(GCId::current());
     e.set_when(when);
     e.set_metadataType(mdtype);
 
@@ -92,7 +92,7 @@
 void ParallelOldTracer::send_parallel_old_event() const {
   EventGCParallelOld e(UNTIMED);
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.gc_id().id());
+    e.set_gcId(GCId::current());
     e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix());
     e.set_starttime(_shared_gc_info.start_timestamp());
     e.set_endtime(_shared_gc_info.end_timestamp());
@@ -103,7 +103,7 @@
 void YoungGCTracer::send_young_gc_event() const {
   EventGCYoungGarbageCollection e(UNTIMED);
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.gc_id().id());
+    e.set_gcId(GCId::current());
     e.set_tenuringThreshold(_tenuring_threshold);
     e.set_starttime(_shared_gc_info.start_timestamp());
     e.set_endtime(_shared_gc_info.end_timestamp());
@@ -125,7 +125,7 @@
 
   EventPromoteObjectInNewPLAB event;
   if (event.should_commit()) {
-    event.set_gcId(_shared_gc_info.gc_id().id());
+    event.set_gcId(GCId::current());
     event.set_class(klass);
     event.set_objectSize(obj_size);
     event.set_tenured(tenured);
@@ -140,7 +140,7 @@
 
   EventPromoteObjectOutsidePLAB event;
   if (event.should_commit()) {
-    event.set_gcId(_shared_gc_info.gc_id().id());
+    event.set_gcId(GCId::current());
     event.set_class(klass);
     event.set_objectSize(obj_size);
     event.set_tenured(tenured);
@@ -152,7 +152,7 @@
 void OldGCTracer::send_old_gc_event() const {
   EventGCOldGarbageCollection e(UNTIMED);
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.gc_id().id());
+    e.set_gcId(GCId::current());
     e.set_starttime(_shared_gc_info.start_timestamp());
     e.set_endtime(_shared_gc_info.end_timestamp());
     e.commit();
@@ -171,7 +171,7 @@
 void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const {
   EventPromotionFailed e;
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.gc_id().id());
+    e.set_gcId(GCId::current());
     e.set_data(to_trace_struct(pf_info));
     e.set_thread(pf_info.thread()->thread_id());
     e.commit();
@@ -182,7 +182,7 @@
 void OldGCTracer::send_concurrent_mode_failure_event() {
   EventConcurrentModeFailure e;
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.gc_id().id());
+    e.set_gcId(GCId::current());
     e.commit();
   }
 }
@@ -191,7 +191,7 @@
 void G1NewTracer::send_g1_young_gc_event() {
   EventGCG1GarbageCollection e(UNTIMED);
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.gc_id().id());
+    e.set_gcId(GCId::current());
     e.set_type(_g1_young_gc_info.type());
     e.set_starttime(_shared_gc_info.start_timestamp());
     e.set_endtime(_shared_gc_info.end_timestamp());
@@ -199,10 +199,10 @@
   }
 }
 
-void G1MMUTracer::send_g1_mmu_event(const GCId& gcId, double timeSlice, double gcTime, double maxTime) {
+void G1MMUTracer::send_g1_mmu_event(double timeSlice, double gcTime, double maxTime) {
   EventGCG1MMU e;
   if (e.should_commit()) {
-    e.set_gcId(gcId.id());
+    e.set_gcId(GCId::current());
     e.set_timeSlice(timeSlice);
     e.set_gcTime(gcTime);
     e.set_maxGcTime(maxTime);
@@ -213,7 +213,7 @@
 void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) {
   EventEvacuationInfo e;
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.gc_id().id());
+    e.set_gcId(GCId::current());
     e.set_cSetRegions(info->collectionset_regions());
     e.set_cSetUsedBefore(info->collectionset_used_before());
     e.set_cSetUsedAfter(info->collectionset_used_after());
@@ -229,7 +229,7 @@
 void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const {
   EventEvacuationFailed e;
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.gc_id().id());
+    e.set_gcId(GCId::current());
     e.set_data(to_trace_struct(ef_info));
     e.commit();
   }
@@ -253,7 +253,7 @@
 void G1NewTracer::send_young_evacuation_statistics(const G1EvacSummary& summary) const {
   EventGCG1EvacuationYoungStatistics surv_evt;
   if (surv_evt.should_commit()) {
-    surv_evt.set_stats(create_g1_evacstats(_shared_gc_info.gc_id().id(), summary));
+    surv_evt.set_stats(create_g1_evacstats(GCId::current(), summary));
     surv_evt.commit();
   }
 }
@@ -261,7 +261,7 @@
 void G1NewTracer::send_old_evacuation_statistics(const G1EvacSummary& summary) const {
   EventGCG1EvacuationOldStatistics old_evt;
   if (old_evt.should_commit()) {
-    old_evt.set_stats(create_g1_evacstats(_shared_gc_info.gc_id().id(), summary));
+    old_evt.set_stats(create_g1_evacstats(GCId::current(), summary));
     old_evt.commit();
   }
 }
@@ -287,17 +287,16 @@
 }
 
 class GCHeapSummaryEventSender : public GCHeapSummaryVisitor {
-  GCId _gc_id;
   GCWhen::Type _when;
  public:
-  GCHeapSummaryEventSender(GCId gc_id, GCWhen::Type when) : _gc_id(gc_id), _when(when) {}
+  GCHeapSummaryEventSender(GCWhen::Type when) : _when(when) {}
 
   void visit(const GCHeapSummary* heap_summary) const {
     const VirtualSpaceSummary& heap_space = heap_summary->heap();
 
     EventGCHeapSummary e;
     if (e.should_commit()) {
-      e.set_gcId(_gc_id.id());
+      e.set_gcId(GCId::current());
       e.set_when((u1)_when);
       e.set_heapSpace(to_trace_struct(heap_space));
       e.set_heapUsed(heap_summary->used());
@@ -310,7 +309,7 @@
 
     EventG1HeapSummary e;
     if (e.should_commit()) {
-      e.set_gcId(_gc_id.id());
+      e.set_gcId(GCId::current());
       e.set_when((u1)_when);
       e.set_edenUsedSize(g1_heap_summary->edenUsed());
       e.set_edenTotalSize(g1_heap_summary->edenCapacity());
@@ -331,7 +330,7 @@
 
     EventPSHeapSummary e;
     if (e.should_commit()) {
-      e.set_gcId(_gc_id.id());
+      e.set_gcId(GCId::current());
       e.set_when((u1)_when);
 
       e.set_oldSpace(to_trace_struct(ps_heap_summary->old()));
@@ -346,7 +345,7 @@
 };
 
 void GCTracer::send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const {
-  GCHeapSummaryEventSender visitor(_shared_gc_info.gc_id(), when);
+  GCHeapSummaryEventSender visitor(when);
   heap_summary.accept(&visitor);
 }
 
@@ -363,7 +362,7 @@
 void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const {
   EventMetaspaceSummary e;
   if (e.should_commit()) {
-    e.set_gcId(_shared_gc_info.gc_id().id());
+    e.set_gcId(GCId::current());
     e.set_when((u1) when);
     e.set_gcThreshold(meta_space_summary.capacity_until_GC());
     e.set_metaspace(to_trace_struct(meta_space_summary.meta_space()));
@@ -374,15 +373,12 @@
 }
 
 class PhaseSender : public PhaseVisitor {
-  GCId _gc_id;
  public:
-  PhaseSender(GCId gc_id) : _gc_id(gc_id) {}
-
   template<typename T>
   void send_phase(PausePhase* pause) {
     T event(UNTIMED);
     if (event.should_commit()) {
-      event.set_gcId(_gc_id.id());
+      event.set_gcId(GCId::current());
       event.set_name(pause->name());
       event.set_starttime(pause->start());
       event.set_endtime(pause->end());
@@ -406,7 +402,7 @@
 };
 
 void GCTracer::send_phase_events(TimePartitions* time_partitions) const {
-  PhaseSender phase_reporter(_shared_gc_info.gc_id());
+  PhaseSender phase_reporter;
 
   TimePartitionPhasesIterator iter(time_partitions);
   while (iter.has_next()) {