aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm
diff options
context:
space:
mode:
authortamao <none@none>2013-07-11 11:45:09 -0700
committertamao <none@none>2013-07-11 11:45:09 -0700
commitf596a93375d6f1528564bea1d35d9ecd9a21fd7b (patch)
treed21552d0411f2b0395cb2b9f99c73602094d703f /src/share/vm
parent970f146325ac764cb1b68e4eca65cfd85f00981c (diff)
parentbdeaadc83840c8d78090b89a8c17a16a44e39d7a (diff)
Merge
Diffstat (limited to 'src/share/vm')
-rw-r--r--src/share/vm/gc_implementation/shared/gcTrace.cpp51
-rw-r--r--src/share/vm/gc_implementation/shared/gcTrace.hpp22
-rw-r--r--src/share/vm/gc_implementation/shared/gcTraceSend.cpp21
-rw-r--r--src/share/vm/gc_implementation/shared/objectCountEventSender.cpp55
-rw-r--r--src/share/vm/gc_implementation/shared/objectCountEventSender.hpp (renamed from src/share/vm/memory/klassInfoClosure.hpp)20
-rw-r--r--src/share/vm/gc_interface/collectedHeap.cpp12
-rw-r--r--src/share/vm/memory/heapInspection.hpp7
7 files changed, 114 insertions, 74 deletions
diff --git a/src/share/vm/gc_implementation/shared/gcTrace.cpp b/src/share/vm/gc_implementation/shared/gcTrace.cpp
index 6c5367042..555e2ed9c 100644
--- a/src/share/vm/gc_implementation/shared/gcTrace.cpp
+++ b/src/share/vm/gc_implementation/shared/gcTrace.cpp
@@ -23,12 +23,14 @@
*/
#include "precompiled.hpp"
+#include "gc_implementation/shared/copyFailedInfo.hpp"
#include "gc_implementation/shared/gcHeapSummary.hpp"
#include "gc_implementation/shared/gcTimer.hpp"
#include "gc_implementation/shared/gcTrace.hpp"
-#include "gc_implementation/shared/copyFailedInfo.hpp"
+#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
@@ -38,7 +40,7 @@
#define assert_unset_gc_id() assert(_shared_gc_info.id() == SharedGCInfo::UNSET_GCID, "GC already started?")
#define assert_set_gc_id() assert(_shared_gc_info.id() != SharedGCInfo::UNSET_GCID, "GC not started?")
-static jlong GCTracer_next_gc_id = 0;
+static GCId GCTracer_next_gc_id = 0;
static GCId create_new_gc_id() {
return GCTracer_next_gc_id++;
}
@@ -91,26 +93,38 @@ void GCTracer::report_gc_reference_stats(const ReferenceProcessorStats& rps) con
}
#if INCLUDE_SERVICES
-void ObjectCountEventSenderClosure::do_cinfo(KlassInfoEntry* entry) {
- if (should_send_event(entry)) {
- send_event(entry);
+class ObjectCountEventSenderClosure : public KlassInfoClosure {
+ 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, jlong timestamp) :
+ _gc_id(gc_id),
+ _size_threshold_percentage(ObjectCountCutOffPercent / 100),
+ _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, _timestamp);
+ }
}
-}
-void ObjectCountEventSenderClosure::send_event(KlassInfoEntry* entry) {
- _gc_tracer->send_object_count_after_gc_event(entry->klass(), entry->count(),
- entry->words() * BytesPerWord);
-}
-
-bool ObjectCountEventSenderClosure::should_send_event(KlassInfoEntry* entry) const {
- double percentage_of_heap = ((double) entry->words()) / _total_size_in_words;
- return percentage_of_heap > _size_threshold_percentage;
-}
+ private:
+ bool should_send_event(const KlassInfoEntry* entry) const {
+ double percentage_of_heap = ((double) entry->words()) / _total_size_in_words;
+ return percentage_of_heap >= _size_threshold_percentage;
+ }
+};
void GCTracer::report_object_count_after_gc(BoolObjectClosure* is_alive_cl) {
assert_set_gc_id();
+ assert(is_alive_cl != NULL, "Must supply function to check liveness");
- if (should_send_object_count_after_gc_event()) {
+ if (ObjectCountEventSender::should_send_event()) {
ResourceMark rm;
KlassInfoTable cit(false);
@@ -118,12 +132,13 @@ void GCTracer::report_object_count_after_gc(BoolObjectClosure* is_alive_cl) {
HeapInspection hi(false, false, false, NULL);
hi.populate_table(&cit, is_alive_cl);
- ObjectCountEventSenderClosure event_sender(this, 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);
}
}
}
-#endif
+#endif // INCLUDE_SERVICES
void GCTracer::report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const MetaspaceSummary& meta_space_summary) const {
assert_set_gc_id();
diff --git a/src/share/vm/gc_implementation/shared/gcTrace.hpp b/src/share/vm/gc_implementation/shared/gcTrace.hpp
index 29ee55b68..c157d86e7 100644
--- a/src/share/vm/gc_implementation/shared/gcTrace.hpp
+++ b/src/share/vm/gc_implementation/shared/gcTrace.hpp
@@ -30,7 +30,6 @@
#include "gc_implementation/shared/gcWhen.hpp"
#include "gc_implementation/shared/copyFailedInfo.hpp"
#include "memory/allocation.hpp"
-#include "memory/klassInfoClosure.hpp"
#include "memory/referenceType.hpp"
#if INCLUDE_ALL_GCS
#include "gc_implementation/g1/g1YCTypes.hpp"
@@ -113,7 +112,6 @@ class G1YoungGCInfo VALUE_OBJ_CLASS_SPEC {
#endif // INCLUDE_ALL_GCS
class GCTracer : public ResourceObj {
- friend class ObjectCountEventSenderClosure;
protected:
SharedGCInfo _shared_gc_info;
@@ -123,7 +121,6 @@ class GCTracer : public ResourceObj {
void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const MetaspaceSummary& meta_space_summary) const;
void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN;
-
bool has_reported_gc_start() const;
protected:
@@ -137,25 +134,6 @@ class GCTracer : public ResourceObj {
void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const;
void send_reference_stats_event(ReferenceType type, size_t count) const;
void send_phase_events(TimePartitions* time_partitions) const;
- void send_object_count_after_gc_event(Klass* klass, jlong count, julong total_size) const NOT_SERVICES_RETURN;
- bool should_send_object_count_after_gc_event() const;
-};
-
-class ObjectCountEventSenderClosure : public KlassInfoClosure {
- GCTracer* _gc_tracer;
- const double _size_threshold_percentage;
- const size_t _total_size_in_words;
- public:
- ObjectCountEventSenderClosure(GCTracer* gc_tracer, size_t total_size_in_words) :
- _gc_tracer(gc_tracer),
- _size_threshold_percentage(ObjectCountCutOffPercent / 100),
- _total_size_in_words(total_size_in_words)
- {}
- virtual void do_cinfo(KlassInfoEntry* entry);
- protected:
- virtual void send_event(KlassInfoEntry* entry);
- private:
- bool should_send_event(KlassInfoEntry* entry) const;
};
class YoungGCTracer : public GCTracer {
diff --git a/src/share/vm/gc_implementation/shared/gcTraceSend.cpp b/src/share/vm/gc_implementation/shared/gcTraceSend.cpp
index 4af7e3c2f..da0c3856d 100644
--- a/src/share/vm/gc_implementation/shared/gcTraceSend.cpp
+++ b/src/share/vm/gc_implementation/shared/gcTraceSend.cpp
@@ -123,27 +123,6 @@ void OldGCTracer::send_concurrent_mode_failure_event() {
}
}
-#if INCLUDE_SERVICES
-void GCTracer::send_object_count_after_gc_event(Klass* klass, jlong count, julong total_size) const {
- EventObjectCountAfterGC e;
- if (e.should_commit()) {
- e.set_gcId(_shared_gc_info.id());
- e.set_class(klass);
- e.set_count(count);
- e.set_totalSize(total_size);
- e.commit();
- }
-}
-#endif
-
-bool GCTracer::should_send_object_count_after_gc_event() const {
-#if INCLUDE_TRACE
- return Tracing::is_event_enabled(EventObjectCountAfterGC::eventId);
-#else
- return false;
-#endif
-}
-
#if INCLUDE_ALL_GCS
void G1NewTracer::send_g1_young_gc_event() {
EventGCG1GarbageCollection e(UNTIMED);
diff --git a/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp b/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp
new file mode 100644
index 000000000..cf95bdd50
--- /dev/null
+++ b/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+
+#include "precompiled.hpp"
+#include "gc_implementation/shared/objectCountEventSender.hpp"
+#include "memory/heapInspection.hpp"
+#include "trace/tracing.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+#if INCLUDE_SERVICES
+
+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(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();
+}
+
+bool ObjectCountEventSender::should_send_event() {
+#if INCLUDE_TRACE
+ return Tracing::is_event_enabled(EventObjectCountAfterGC::eventId);
+#else
+ return false;
+#endif // INCLUDE_TRACE
+}
+
+#endif // INCLUDE_SERVICES
diff --git a/src/share/vm/memory/klassInfoClosure.hpp b/src/share/vm/gc_implementation/shared/objectCountEventSender.hpp
index b945a19e0..b83e1fa73 100644
--- a/src/share/vm/memory/klassInfoClosure.hpp
+++ b/src/share/vm/gc_implementation/shared/objectCountEventSender.hpp
@@ -22,15 +22,23 @@
*
*/
-#ifndef SHARE_VM_MEMORY_KLASSINFOCLOSURE_HPP
-#define SHARE_VM_MEMORY_KLASSINFOCLOSURE_HPP
+#ifndef SHARE_VM_OBJECT_COUNT_EVENT_SENDER_HPP
+#define SHARE_VM_OBJECT_COUNT_EVENT_SENDER_HPP
+
+#include "gc_implementation/shared/gcTrace.hpp"
+#include "memory/allocation.hpp"
+#include "utilities/macros.hpp"
+
+#if INCLUDE_SERVICES
class KlassInfoEntry;
-class KlassInfoClosure : public StackObj {
+class ObjectCountEventSender : public AllStatic {
public:
- // Called for each KlassInfoEntry.
- virtual void do_cinfo(KlassInfoEntry* cie) = 0;
+ static void send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp);
+ static bool should_send_event();
};
-#endif // SHARE_VM_MEMORY_KLASSINFOCLOSURE_HPP
+#endif // INCLUDE_SERVICES
+
+#endif // SHARE_VM_OBJECT_COUNT_EVENT_SENDER
diff --git a/src/share/vm/gc_interface/collectedHeap.cpp b/src/share/vm/gc_interface/collectedHeap.cpp
index 4c6c026e7..dfc963c3b 100644
--- a/src/share/vm/gc_interface/collectedHeap.cpp
+++ b/src/share/vm/gc_interface/collectedHeap.cpp
@@ -85,16 +85,16 @@ GCHeapSummary CollectedHeap::create_heap_summary() {
MetaspaceSummary CollectedHeap::create_metaspace_summary() {
const MetaspaceSizes meta_space(
- 0, /*MetaspaceAux::capacity_in_bytes(),*/
- 0, /*MetaspaceAux::used_in_bytes(),*/
+ MetaspaceAux::allocated_capacity_bytes(),
+ MetaspaceAux::allocated_used_bytes(),
MetaspaceAux::reserved_in_bytes());
const MetaspaceSizes data_space(
- 0, /*MetaspaceAux::capacity_in_bytes(Metaspace::NonClassType),*/
- 0, /*MetaspaceAux::used_in_bytes(Metaspace::NonClassType),*/
+ MetaspaceAux::allocated_capacity_bytes(Metaspace::NonClassType),
+ MetaspaceAux::allocated_used_bytes(Metaspace::NonClassType),
MetaspaceAux::reserved_in_bytes(Metaspace::NonClassType));
const MetaspaceSizes class_space(
- 0, /*MetaspaceAux::capacity_in_bytes(Metaspace::ClassType),*/
- 0, /*MetaspaceAux::used_in_bytes(Metaspace::ClassType),*/
+ MetaspaceAux::allocated_capacity_bytes(Metaspace::ClassType),
+ MetaspaceAux::allocated_used_bytes(Metaspace::ClassType),
MetaspaceAux::reserved_in_bytes(Metaspace::ClassType));
return MetaspaceSummary(meta_space, data_space, class_space);
diff --git a/src/share/vm/memory/heapInspection.hpp b/src/share/vm/memory/heapInspection.hpp
index c286e4865..09558b0a2 100644
--- a/src/share/vm/memory/heapInspection.hpp
+++ b/src/share/vm/memory/heapInspection.hpp
@@ -26,7 +26,6 @@
#define SHARE_VM_MEMORY_HEAPINSPECTION_HPP
#include "memory/allocation.inline.hpp"
-#include "memory/klassInfoClosure.hpp"
#include "oops/oop.inline.hpp"
#include "oops/annotations.hpp"
#include "utilities/macros.hpp"
@@ -204,6 +203,12 @@ class KlassInfoEntry: public CHeapObj<mtInternal> {
const char* name() const;
};
+class KlassInfoClosure : public StackObj {
+ public:
+ // Called for each KlassInfoEntry.
+ virtual void do_cinfo(KlassInfoEntry* cie) = 0;
+};
+
class KlassInfoBucket: public CHeapObj<mtInternal> {
private:
KlassInfoEntry* _list;