提交 b3a4dd63 编写于 作者: E ehelin

8015683: object_count_after_gc should have the same timestamp for all events

Reviewed-by: mgerdin, stefank
上级 12ed5bd1
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "gc_implementation/shared/objectCountEventSender.hpp" #include "gc_implementation/shared/objectCountEventSender.hpp"
#include "memory/heapInspection.hpp" #include "memory/heapInspection.hpp"
#include "memory/referenceProcessorStats.hpp" #include "memory/referenceProcessorStats.hpp"
#include "runtime/os.hpp"
#include "utilities/globalDefinitions.hpp" #include "utilities/globalDefinitions.hpp"
#if INCLUDE_ALL_GCS #if INCLUDE_ALL_GCS
...@@ -96,17 +97,19 @@ class ObjectCountEventSenderClosure : public KlassInfoClosure { ...@@ -96,17 +97,19 @@ class ObjectCountEventSenderClosure : public KlassInfoClosure {
const GCId _gc_id; const GCId _gc_id;
const double _size_threshold_percentage; const double _size_threshold_percentage;
const size_t _total_size_in_words; const size_t _total_size_in_words;
const jlong _timestamp;
public: 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), _gc_id(gc_id),
_size_threshold_percentage(ObjectCountCutOffPercent / 100), _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) { virtual void do_cinfo(KlassInfoEntry* entry) {
if (should_send_event(entry)) { if (should_send_event(entry)) {
ObjectCountEventSender::send(entry, _gc_id); ObjectCountEventSender::send(entry, _gc_id, _timestamp);
} }
} }
...@@ -129,7 +132,8 @@ void GCTracer::report_object_count_after_gc(BoolObjectClosure* is_alive_cl) { ...@@ -129,7 +132,8 @@ void GCTracer::report_object_count_after_gc(BoolObjectClosure* is_alive_cl) {
HeapInspection hi(false, false, false, NULL); HeapInspection hi(false, false, false, NULL);
hi.populate_table(&cit, is_alive_cl); 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); cit.iterate(&event_sender);
} }
} }
......
...@@ -31,15 +31,16 @@ ...@@ -31,15 +31,16 @@
#if INCLUDE_SERVICES #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), assert(Tracing::is_event_enabled(EventObjectCountAfterGC::eventId),
"Only call this method if the event is enabled"); "Only call this method if the event is enabled");
EventObjectCountAfterGC event; EventObjectCountAfterGC event(UNTIMED);
event.set_gcId(gc_id); event.set_gcId(gc_id);
event.set_class(entry->klass()); event.set_class(entry->klass());
event.set_count(entry->count()); event.set_count(entry->count());
event.set_totalSize(entry->words() * BytesPerWord); event.set_totalSize(entry->words() * BytesPerWord);
event.set_endtime(timestamp);
event.commit(); event.commit();
} }
......
...@@ -35,7 +35,7 @@ class KlassInfoEntry; ...@@ -35,7 +35,7 @@ class KlassInfoEntry;
class ObjectCountEventSender : public AllStatic { class ObjectCountEventSender : public AllStatic {
public: 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(); static bool should_send_event();
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册