src/share/vm/gc_implementation/shared/gcTrace.hpp
Print this page
rev 4462 : 8012086: The object count event should only send events for instances occupying more than 0.5% of the heap
@@ -28,10 +28,11 @@
#include "gc_interface/gcCause.hpp"
#include "gc_interface/gcName.hpp"
#include "gc_implementation/shared/gcWhen.hpp"
#include "gc_implementation/shared/copyFailedInfo.hpp"
#include "memory/allocation.hpp"
+#include "memory/klassInfoClosure.hpp"
#include "memory/referenceType.hpp"
#ifndef SERIALGC
#include "gc_implementation/g1/g1YCTypes.hpp"
#endif
@@ -108,10 +109,37 @@
G1YCType type() const { return _type; }
};
#endif // SERIALGC
+class ObjectCountEventSenderClosure : public KlassInfoClosure {
+ GCTracer* _gc_tracer;
+ const double _size_threshold_percentage;
+ const size_t _used_heap_in_words;
+ public:
+ ObjectCountEventSenderClosure(GCTracer* gc_tracer, size_t used_heap_in_words) :
+ _gc_tracer(gc_tracer),
+ _size_threshold_percentage(0.05),
+ _used_heap_in_words(used_heap_in_words)
+ {}
+ virtual void do_cinfo(KlassInfoEntry* entry);
+ protected:
+ virtual void send_event(KlassInfoEntry* entry);
+ private:
+ bool should_send_event(KlassInfoEntry* entry) const;
+};
+
+class ObjectCountFilter : public BoolObjectClosure {
+ BoolObjectClosure* _is_alive;
+ public:
+ ObjectCountFilter(BoolObjectClosure* is_alive = NULL) : _is_alive(is_alive) {}
+ bool do_object_b(oop obj);
+ void do_object(oop obj) { ShouldNotReachHere(); }
+ private:
+ bool is_externally_visible_klass(klassOop k) const;
+};
+
class GCTracer : public ResourceObj {
friend class ObjectCountEventSenderClosure;
protected:
SharedGCInfo _shared_gc_info;