comparison src/share/vm/gc_implementation/shared/gcTrace.cpp @ 11115:6aa440bc1125

8015683: object_count_after_gc should have the same timestamp for all events Reviewed-by: mgerdin, stefank
author ehelin
date Wed, 12 Jun 2013 15:21:41 +0200
parents 63cffb381adc
children 86e6d691f2e1
comparison
equal deleted inserted replaced
11114:63cffb381adc 11115:6aa440bc1125
28 #include "gc_implementation/shared/gcTimer.hpp" 28 #include "gc_implementation/shared/gcTimer.hpp"
29 #include "gc_implementation/shared/gcTrace.hpp" 29 #include "gc_implementation/shared/gcTrace.hpp"
30 #include "gc_implementation/shared/objectCountEventSender.hpp" 30 #include "gc_implementation/shared/objectCountEventSender.hpp"
31 #include "memory/heapInspection.hpp" 31 #include "memory/heapInspection.hpp"
32 #include "memory/referenceProcessorStats.hpp" 32 #include "memory/referenceProcessorStats.hpp"
33 #include "runtime/os.hpp"
33 #include "utilities/globalDefinitions.hpp" 34 #include "utilities/globalDefinitions.hpp"
34 35
35 #if INCLUDE_ALL_GCS 36 #if INCLUDE_ALL_GCS
36 #include "gc_implementation/g1/evacuationInfo.hpp" 37 #include "gc_implementation/g1/evacuationInfo.hpp"
37 #endif 38 #endif
94 #if INCLUDE_SERVICES 95 #if INCLUDE_SERVICES
95 class ObjectCountEventSenderClosure : public KlassInfoClosure { 96 class ObjectCountEventSenderClosure : public KlassInfoClosure {
96 const GCId _gc_id; 97 const GCId _gc_id;
97 const double _size_threshold_percentage; 98 const double _size_threshold_percentage;
98 const size_t _total_size_in_words; 99 const size_t _total_size_in_words;
100 const jlong _timestamp;
99 101
100 public: 102 public:
101 ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words) : 103 ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words, jlong timestamp) :
102 _gc_id(gc_id), 104 _gc_id(gc_id),
103 _size_threshold_percentage(ObjectCountCutOffPercent / 100), 105 _size_threshold_percentage(ObjectCountCutOffPercent / 100),
104 _total_size_in_words(total_size_in_words) 106 _total_size_in_words(total_size_in_words),
107 _timestamp(timestamp)
105 {} 108 {}
106 109
107 virtual void do_cinfo(KlassInfoEntry* entry) { 110 virtual void do_cinfo(KlassInfoEntry* entry) {
108 if (should_send_event(entry)) { 111 if (should_send_event(entry)) {
109 ObjectCountEventSender::send(entry, _gc_id); 112 ObjectCountEventSender::send(entry, _gc_id, _timestamp);
110 } 113 }
111 } 114 }
112 115
113 private: 116 private:
114 bool should_send_event(const KlassInfoEntry* entry) const { 117 bool should_send_event(const KlassInfoEntry* entry) const {
127 KlassInfoTable cit(false); 130 KlassInfoTable cit(false);
128 if (!cit.allocation_failed()) { 131 if (!cit.allocation_failed()) {
129 HeapInspection hi(false, false, false, NULL); 132 HeapInspection hi(false, false, false, NULL);
130 hi.populate_table(&cit, is_alive_cl); 133 hi.populate_table(&cit, is_alive_cl);
131 134
132 ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words()); 135 jlong timestamp = os::elapsed_counter();
136 ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words(), timestamp);
133 cit.iterate(&event_sender); 137 cit.iterate(&event_sender);
134 } 138 }
135 } 139 }
136 } 140 }
137 #endif // INCLUDE_SERVICES 141 #endif // INCLUDE_SERVICES