Wed, 12 Jun 2013 15:21:41 +0200
8015683: object_count_after_gc should have the same timestamp for all events
Reviewed-by: mgerdin, stefank
1.1 --- a/src/share/vm/gc_implementation/shared/gcTrace.cpp Wed Jun 12 15:50:14 2013 +0200 1.2 +++ b/src/share/vm/gc_implementation/shared/gcTrace.cpp Wed Jun 12 15:21:41 2013 +0200 1.3 @@ -30,6 +30,7 @@ 1.4 #include "gc_implementation/shared/objectCountEventSender.hpp" 1.5 #include "memory/heapInspection.hpp" 1.6 #include "memory/referenceProcessorStats.hpp" 1.7 +#include "runtime/os.hpp" 1.8 #include "utilities/globalDefinitions.hpp" 1.9 1.10 #if INCLUDE_ALL_GCS 1.11 @@ -96,17 +97,19 @@ 1.12 const GCId _gc_id; 1.13 const double _size_threshold_percentage; 1.14 const size_t _total_size_in_words; 1.15 + const jlong _timestamp; 1.16 1.17 public: 1.18 - ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words) : 1.19 + ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words, jlong timestamp) : 1.20 _gc_id(gc_id), 1.21 _size_threshold_percentage(ObjectCountCutOffPercent / 100), 1.22 - _total_size_in_words(total_size_in_words) 1.23 + _total_size_in_words(total_size_in_words), 1.24 + _timestamp(timestamp) 1.25 {} 1.26 1.27 virtual void do_cinfo(KlassInfoEntry* entry) { 1.28 if (should_send_event(entry)) { 1.29 - ObjectCountEventSender::send(entry, _gc_id); 1.30 + ObjectCountEventSender::send(entry, _gc_id, _timestamp); 1.31 } 1.32 } 1.33 1.34 @@ -129,7 +132,8 @@ 1.35 HeapInspection hi(false, false, false, NULL); 1.36 hi.populate_table(&cit, is_alive_cl); 1.37 1.38 - ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words()); 1.39 + jlong timestamp = os::elapsed_counter(); 1.40 + ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words(), timestamp); 1.41 cit.iterate(&event_sender); 1.42 } 1.43 }
2.1 --- a/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp Wed Jun 12 15:50:14 2013 +0200 2.2 +++ b/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp Wed Jun 12 15:21:41 2013 +0200 2.3 @@ -31,15 +31,16 @@ 2.4 2.5 #if INCLUDE_SERVICES 2.6 2.7 -void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id) { 2.8 +void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp) { 2.9 assert(Tracing::is_event_enabled(EventObjectCountAfterGC::eventId), 2.10 "Only call this method if the event is enabled"); 2.11 2.12 - EventObjectCountAfterGC event; 2.13 + EventObjectCountAfterGC event(UNTIMED); 2.14 event.set_gcId(gc_id); 2.15 event.set_class(entry->klass()); 2.16 event.set_count(entry->count()); 2.17 event.set_totalSize(entry->words() * BytesPerWord); 2.18 + event.set_endtime(timestamp); 2.19 event.commit(); 2.20 } 2.21
3.1 --- a/src/share/vm/gc_implementation/shared/objectCountEventSender.hpp Wed Jun 12 15:50:14 2013 +0200 3.2 +++ b/src/share/vm/gc_implementation/shared/objectCountEventSender.hpp Wed Jun 12 15:21:41 2013 +0200 3.3 @@ -35,7 +35,7 @@ 3.4 3.5 class ObjectCountEventSender : public AllStatic { 3.6 public: 3.7 - static void send(const KlassInfoEntry* entry, GCId gc_id); 3.8 + static void send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp); 3.9 static bool should_send_event(); 3.10 }; 3.11