提交 1375f8c8 编写于 作者: T tamao

Merge

......@@ -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();
......
......@@ -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 {
......
......@@ -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);
......
/*
* 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
......@@ -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
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册