8015683: object_count_after_gc should have the same timestamp for all events
authorehelin
Wed, 12 Jun 2013 15:21:41 +0200
changeset 18706 2d278f82253d
parent 18705 8ab1fa795124
child 18707 c0b77e8d3037
8015683: object_count_after_gc should have the same timestamp for all events Reviewed-by: mgerdin, stefank
hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp
hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp
hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.hpp
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp	Wed Jun 12 15:50:14 2013 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp	Wed Jun 12 15:21:41 2013 +0200
@@ -30,6 +30,7 @@
 #include "gc_implementation/shared/objectCountEventSender.hpp"
 #include "memory/heapInspection.hpp"
 #include "memory/referenceProcessorStats.hpp"
+#include "runtime/os.hpp"
 #include "utilities/globalDefinitions.hpp"
 
 #if INCLUDE_ALL_GCS
@@ -96,17 +97,19 @@
   const GCId _gc_id;
   const double _size_threshold_percentage;
   const size_t _total_size_in_words;
+  const jlong _timestamp;
 
  public:
-  ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words) :
+  ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words, jlong timestamp) :
     _gc_id(gc_id),
     _size_threshold_percentage(ObjectCountCutOffPercent / 100),
-    _total_size_in_words(total_size_in_words)
+    _total_size_in_words(total_size_in_words),
+    _timestamp(timestamp)
   {}
 
   virtual void do_cinfo(KlassInfoEntry* entry) {
     if (should_send_event(entry)) {
-      ObjectCountEventSender::send(entry, _gc_id);
+      ObjectCountEventSender::send(entry, _gc_id, _timestamp);
     }
   }
 
@@ -129,7 +132,8 @@
       HeapInspection hi(false, false, false, NULL);
       hi.populate_table(&cit, is_alive_cl);
 
-      ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words());
+      jlong timestamp = os::elapsed_counter();
+      ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words(), timestamp);
       cit.iterate(&event_sender);
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp	Wed Jun 12 15:50:14 2013 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp	Wed Jun 12 15:21:41 2013 +0200
@@ -31,15 +31,16 @@
 
 #if INCLUDE_SERVICES
 
-void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id) {
+void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp) {
   assert(Tracing::is_event_enabled(EventObjectCountAfterGC::eventId),
          "Only call this method if the event is enabled");
 
-  EventObjectCountAfterGC event;
+  EventObjectCountAfterGC event(UNTIMED);
   event.set_gcId(gc_id);
   event.set_class(entry->klass());
   event.set_count(entry->count());
   event.set_totalSize(entry->words() * BytesPerWord);
+  event.set_endtime(timestamp);
   event.commit();
 }
 
--- a/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.hpp	Wed Jun 12 15:50:14 2013 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.hpp	Wed Jun 12 15:21:41 2013 +0200
@@ -35,7 +35,7 @@
 
 class ObjectCountEventSender : public AllStatic {
  public:
-  static void send(const KlassInfoEntry* entry, GCId gc_id);
+  static void send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp);
   static bool should_send_event();
 };