diff src/share/vm/gc_implementation/shared/gcTrace.cpp @ 13400:86e6d691f2e1

8028128: Add a type safe alternative for working with counter based data Reviewed-by: dholmes, egahlin
author mgronlun
date Sat, 23 Nov 2013 12:25:13 +0100
parents 6aa440bc1125
children 9fdaa79b0c27
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/shared/gcTrace.cpp	Sat Nov 23 09:56:59 2013 +0100
+++ b/src/share/vm/gc_implementation/shared/gcTrace.cpp	Sat Nov 23 12:25:13 2013 +0100
@@ -32,6 +32,7 @@
 #include "memory/referenceProcessorStats.hpp"
 #include "runtime/os.hpp"
 #include "utilities/globalDefinitions.hpp"
+#include "utilities/ticks.inline.hpp"
 
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/g1/evacuationInfo.hpp"
@@ -45,7 +46,7 @@
   return GCTracer_next_gc_id++;
 }
 
-void GCTracer::report_gc_start_impl(GCCause::Cause cause, jlong timestamp) {
+void GCTracer::report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp) {
   assert_unset_gc_id();
 
   GCId gc_id = create_new_gc_id();
@@ -54,7 +55,7 @@
   _shared_gc_info.set_start_timestamp(timestamp);
 }
 
-void GCTracer::report_gc_start(GCCause::Cause cause, jlong timestamp) {
+void GCTracer::report_gc_start(GCCause::Cause cause, const Ticks& timestamp) {
   assert_unset_gc_id();
 
   report_gc_start_impl(cause, timestamp);
@@ -64,7 +65,7 @@
   return _shared_gc_info.id() != SharedGCInfo::UNSET_GCID;
 }
 
-void GCTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
+void GCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
   assert_set_gc_id();
 
   _shared_gc_info.set_sum_of_pauses(time_partitions->sum_of_pauses());
@@ -75,7 +76,7 @@
   send_garbage_collection_event();
 }
 
-void GCTracer::report_gc_end(jlong timestamp, TimePartitions* time_partitions) {
+void GCTracer::report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions) {
   assert_set_gc_id();
 
   report_gc_end_impl(timestamp, time_partitions);
@@ -97,10 +98,10 @@
   const GCId _gc_id;
   const double _size_threshold_percentage;
   const size_t _total_size_in_words;
-  const jlong _timestamp;
+  const Ticks _timestamp;
 
  public:
-  ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words, jlong timestamp) :
+  ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words, const Ticks& timestamp) :
     _gc_id(gc_id),
     _size_threshold_percentage(ObjectCountCutOffPercent / 100),
     _total_size_in_words(total_size_in_words),
@@ -131,9 +132,7 @@
     if (!cit.allocation_failed()) {
       HeapInspection hi(false, false, false, NULL);
       hi.populate_table(&cit, is_alive_cl);
-
-      jlong timestamp = os::elapsed_counter();
-      ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words(), timestamp);
+      ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words(), Ticks::now());
       cit.iterate(&event_sender);
     }
   }
@@ -147,7 +146,7 @@
   send_meta_space_summary_event(when, meta_space_summary);
 }
 
-void YoungGCTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
+void YoungGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
   assert_set_gc_id();
   assert(_tenuring_threshold != UNSET_TENURING_THRESHOLD, "Tenuring threshold has not been reported");
 
@@ -167,14 +166,14 @@
   _tenuring_threshold = tenuring_threshold;
 }
 
-void OldGCTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
+void OldGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
   assert_set_gc_id();
 
   GCTracer::report_gc_end_impl(timestamp, time_partitions);
   send_old_gc_event();
 }
 
-void ParallelOldTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
+void ParallelOldTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
   assert_set_gc_id();
 
   OldGCTracer::report_gc_end_impl(timestamp, time_partitions);
@@ -200,7 +199,7 @@
   _g1_young_gc_info.set_type(type);
 }
 
-void G1NewTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
+void G1NewTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
   assert_set_gc_id();
 
   YoungGCTracer::report_gc_end_impl(timestamp, time_partitions);