< prev index next >
src/share/vm/gc_implementation/shared/gcTraceSend.cpp
Print this page
@@ -21,11 +21,13 @@
* questions.
*
*/
#include "precompiled.hpp"
+#if INCLUDE_JFR
#include "jfr/jfrEvents.hpp"
+#endif
#include "gc_implementation/shared/gcHeapSummary.hpp"
#include "gc_implementation/shared/gcTimer.hpp"
#include "gc_implementation/shared/gcTrace.hpp"
#include "gc_implementation/shared/gcWhen.hpp"
#include "gc_implementation/shared/copyFailedInfo.hpp"
@@ -38,10 +40,11 @@
// All GC dependencies against the trace framework is contained within this file.
typedef uintptr_t TraceAddress;
void GCTracer::send_garbage_collection_event() const {
+#if INCLUDE_JFR
EventGarbageCollection event(UNTIMED);
if (event.should_commit()) {
event.set_gcId(_shared_gc_info.gc_id().id());
event.set_name(_shared_gc_info.name());
event.set_cause((u2) _shared_gc_info.cause());
@@ -49,24 +52,28 @@
event.set_longestPause(_shared_gc_info.longest_pause());
event.set_starttime(_shared_gc_info.start_timestamp());
event.set_endtime(_shared_gc_info.end_timestamp());
event.commit();
}
+#endif
}
void GCTracer::send_reference_stats_event(ReferenceType type, size_t count) const {
+#if INCLUDE_JFR
EventGCReferenceStatistics e;
if (e.should_commit()) {
e.set_gcId(_shared_gc_info.gc_id().id());
e.set_type((u1)type);
e.set_count(count);
e.commit();
}
+#endif
}
void GCTracer::send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspace::MetadataType mdtype,
const MetaspaceChunkFreeListSummary& summary) const {
+#if INCLUDE_JFR
EventMetaspaceChunkFreeListSummary e;
if (e.should_commit()) {
e.set_gcId(_shared_gc_info.gc_id().id());
e.set_when(when);
e.set_metadataType(mdtype);
@@ -83,134 +90,162 @@
e.set_humongousChunks(summary.num_humongous_chunks());
e.set_humongousChunksTotalSize(summary.humongous_chunks_size_in_bytes());
e.commit();
}
+#endif
}
void ParallelOldTracer::send_parallel_old_event() const {
+#if INCLUDE_JFR
EventParallelOldGarbageCollection e(UNTIMED);
if (e.should_commit()) {
e.set_gcId(_shared_gc_info.gc_id().id());
e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix());
e.set_starttime(_shared_gc_info.start_timestamp());
e.set_endtime(_shared_gc_info.end_timestamp());
e.commit();
}
+#endif
}
void YoungGCTracer::send_young_gc_event() const {
+#if INCLUDE_JFR
EventYoungGarbageCollection e(UNTIMED);
if (e.should_commit()) {
e.set_gcId(_shared_gc_info.gc_id().id());
e.set_tenuringThreshold(_tenuring_threshold);
e.set_starttime(_shared_gc_info.start_timestamp());
e.set_endtime(_shared_gc_info.end_timestamp());
e.commit();
}
+#endif
}
bool YoungGCTracer::should_send_promotion_in_new_plab_event() const {
+#if INCLUDE_JFR
return EventPromoteObjectInNewPLAB::is_enabled();
+ #else
+ return false;
+#endif
}
bool YoungGCTracer::should_send_promotion_outside_plab_event() const {
+#if INCLUDE_JFR
return EventPromoteObjectOutsidePLAB::is_enabled();
+#else
+ return false;
+#endif
}
void YoungGCTracer::send_promotion_in_new_plab_event(Klass* klass, size_t obj_size,
uint age, bool tenured,
size_t plab_size) const {
-
+#if INCLUDE_JFR
EventPromoteObjectInNewPLAB event;
if (event.should_commit()) {
event.set_gcId(_shared_gc_info.gc_id().id());
event.set_objectClass(klass);
event.set_objectSize(obj_size);
event.set_tenured(tenured);
event.set_tenuringAge(age);
event.set_plabSize(plab_size);
event.commit();
}
+#endif
}
void YoungGCTracer::send_promotion_outside_plab_event(Klass* klass, size_t obj_size,
uint age, bool tenured) const {
-
+#if INCLUDE_JFR
EventPromoteObjectOutsidePLAB event;
if (event.should_commit()) {
event.set_gcId(_shared_gc_info.gc_id().id());
event.set_objectClass(klass);
event.set_objectSize(obj_size);
event.set_tenured(tenured);
event.set_tenuringAge(age);
event.commit();
}
+#endif
}
void OldGCTracer::send_old_gc_event() const {
+#if INCLUDE_JFR
EventOldGarbageCollection e(UNTIMED);
if (e.should_commit()) {
e.set_gcId(_shared_gc_info.gc_id().id());
e.set_starttime(_shared_gc_info.start_timestamp());
e.set_endtime(_shared_gc_info.end_timestamp());
e.commit();
}
+#endif
}
+#if INCLUDE_JFR
static JfrStructCopyFailed to_struct(const CopyFailedInfo& cf_info) {
JfrStructCopyFailed failed_info;
failed_info.set_objectCount(cf_info.failed_count());
failed_info.set_firstSize(cf_info.first_size());
failed_info.set_smallestSize(cf_info.smallest_size());
failed_info.set_totalSize(cf_info.total_size());
return failed_info;
}
+#endif
void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const {
+#if INCLUDE_JFR
EventPromotionFailed e;
if (e.should_commit()) {
e.set_gcId(_shared_gc_info.gc_id().id());
e.set_promotionFailed(to_struct(pf_info));
e.set_thread(pf_info.thread()->thread_id());
e.commit();
}
+#endif
}
// Common to CMS and G1
void OldGCTracer::send_concurrent_mode_failure_event() {
+#if INCLUDE_JFR
EventConcurrentModeFailure e;
if (e.should_commit()) {
e.set_gcId(_shared_gc_info.gc_id().id());
e.commit();
}
+#endif
}
#if INCLUDE_ALL_GCS
void G1NewTracer::send_g1_young_gc_event() {
+#if INCLUDE_JFR
EventG1GarbageCollection e(UNTIMED);
if (e.should_commit()) {
e.set_gcId(_shared_gc_info.gc_id().id());
e.set_type(_g1_young_gc_info.type());
e.set_starttime(_shared_gc_info.start_timestamp());
e.set_endtime(_shared_gc_info.end_timestamp());
e.commit();
}
+#endif
}
void G1MMUTracer::send_g1_mmu_event(double time_slice_ms, double gc_time_ms, double max_time_ms) {
+#if INCLUDE_JFR
EventG1MMU e;
if (e.should_commit()) {
e.set_gcId(GCId::peek().id());
e.set_timeSlice((s8)time_slice_ms);
e.set_gcTime((s8)gc_time_ms);
e.set_pauseTarget((s8)max_time_ms);
e.commit();
}
+#endif
}
void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) {
+#if INCLUDE_JFR
EventEvacuationInformation e;
if (e.should_commit()) {
e.set_gcId(_shared_gc_info.gc_id().id());
e.set_cSetRegions(info->collectionset_regions());
e.set_cSetUsedBefore(info->collectionset_used_before());
@@ -220,19 +255,22 @@
e.set_allocationRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied());
e.set_bytesCopied(info->bytes_copied());
e.set_regionsFreed(info->regions_freed());
e.commit();
}
+#endif
}
void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const {
+#if INCLUDE_JFR
EventEvacuationFailed e;
if (e.should_commit()) {
e.set_gcId(_shared_gc_info.gc_id().id());
e.set_evacuationFailed(to_struct(ef_info));
e.commit();
}
+#endif
}
// XXX
//static JfrStructG1EvacuationStatistics
//create_g1_evacstats(unsigned gcid, const G1EvacSummary& summary) {
@@ -309,10 +347,11 @@
// }
//}
#endif // INCLUDE_ALL_GCS
+#if INCLUDE_JFR
static JfrStructVirtualSpace to_struct(const VirtualSpaceSummary& summary) {
JfrStructVirtualSpace space;
space.set_start((TraceAddress)summary.start());
space.set_committedEnd((TraceAddress)summary.committed_end());
space.set_committedSize(summary.committed_size());
@@ -327,31 +366,35 @@
space.set_end((TraceAddress)summary.end());
space.set_used(summary.used());
space.set_size(summary.size());
return space;
}
+#endif
class GCHeapSummaryEventSender : public GCHeapSummaryVisitor {
GCId _gc_id;
GCWhen::Type _when;
public:
GCHeapSummaryEventSender(GCId gc_id, GCWhen::Type when) : _gc_id(gc_id), _when(when) {}
void visit(const GCHeapSummary* heap_summary) const {
+#if INCLUDE_JFR
const VirtualSpaceSummary& heap_space = heap_summary->heap();
EventGCHeapSummary e;
if (e.should_commit()) {
e.set_gcId(_gc_id.id());
e.set_when((u1)_when);
e.set_heapSpace(to_struct(heap_space));
e.set_heapUsed(heap_summary->used());
e.commit();
}
+#endif
}
void visit(const G1HeapSummary* g1_heap_summary) const {
+#if INCLUDE_JFR
visit((GCHeapSummary*)g1_heap_summary);
EventG1HeapSummary e;
if (e.should_commit()) {
e.set_gcId(_gc_id.id());
@@ -360,13 +403,15 @@
e.set_edenTotalSize(g1_heap_summary->edenCapacity());
e.set_survivorUsedSize(g1_heap_summary->survivorUsed());
e.set_numberOfRegions(g1_heap_summary->numberOfRegions());
e.commit();
}
+#endif
}
void visit(const PSHeapSummary* ps_heap_summary) const {
+#if INCLUDE_JFR
visit((GCHeapSummary*)ps_heap_summary);
const VirtualSpaceSummary& old_summary = ps_heap_summary->old();
const SpaceSummary& old_space = ps_heap_summary->old_space();
const VirtualSpaceSummary& young_summary = ps_heap_summary->young();
@@ -385,70 +430,79 @@
e.set_edenSpace(to_struct(ps_heap_summary->eden()));
e.set_fromSpace(to_struct(ps_heap_summary->from()));
e.set_toSpace(to_struct(ps_heap_summary->to()));
e.commit();
}
+#endif
}
};
void GCTracer::send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const {
GCHeapSummaryEventSender visitor(_shared_gc_info.gc_id(), when);
heap_summary.accept(&visitor);
}
+#if INCLUDE_JFR
static JfrStructMetaspaceSizes to_struct(const MetaspaceSizes& sizes) {
JfrStructMetaspaceSizes meta_sizes;
meta_sizes.set_committed(sizes.committed());
meta_sizes.set_used(sizes.used());
meta_sizes.set_reserved(sizes.reserved());
return meta_sizes;
}
+#endif
void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const {
+#if INCLUDE_JFR
EventMetaspaceSummary e;
if (e.should_commit()) {
e.set_gcId(_shared_gc_info.gc_id().id());
e.set_when((u1) when);
e.set_gcThreshold(meta_space_summary.capacity_until_GC());
e.set_metaspace(to_struct(meta_space_summary.meta_space()));
e.set_dataSpace(to_struct(meta_space_summary.data_space()));
e.set_classSpace(to_struct(meta_space_summary.class_space()));
e.commit();
}
+#endif
}
class PhaseSender : public PhaseVisitor {
GCId _gc_id;
public:
PhaseSender(GCId gc_id) : _gc_id(gc_id) {}
template<typename T>
void send_phase(GCPhase* phase) {
+#if INCLUDE_JFR
T event(UNTIMED);
if (event.should_commit()) {
event.set_gcId(_gc_id.id());
event.set_name(phase->name());
event.set_starttime(phase->start());
event.set_endtime(phase->end());
event.commit();
}
+#endif
}
void visit(GCPhase* pause) { ShouldNotReachHere(); }
void visit(ConcurrentPhase* pause) { Unimplemented(); }
void visit(PausePhase* pause) {
assert(PhasesStack::PHASE_LEVELS == 5, "Need more event types");
+#if INCLUDE_JFR
switch (pause->level()) {
case 0: send_phase<EventGCPhasePause>(pause); break;
case 1: send_phase<EventGCPhasePauseLevel1>(pause); break;
case 2: send_phase<EventGCPhasePauseLevel2>(pause); break;
case 3: send_phase<EventGCPhasePauseLevel3>(pause); break;
default: /* Ignore sending this phase */ break;
}
+#endif
}
};
void GCTracer::send_phase_events(TimePartitions* time_partitions) const {
PhaseSender phase_reporter(_shared_gc_info.gc_id());
< prev index next >