Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp
38920 views
/*1* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP25#define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP2627#include "gc_interface/gcCause.hpp"28#include "gc_interface/gcName.hpp"29#include "gc_implementation/shared/gcId.hpp"30#include "gc_implementation/shared/gcWhen.hpp"31#include "gc_implementation/shared/copyFailedInfo.hpp"32#include "memory/allocation.hpp"33#include "memory/metaspace.hpp"34#include "memory/referenceType.hpp"35#if INCLUDE_ALL_GCS36#include "gc_implementation/g1/g1YCTypes.hpp"37#endif38#include "utilities/macros.hpp"39#include "utilities/ticks.hpp"404142class EvacuationInfo;43class GCHeapSummary;44class MetaspaceChunkFreeListSummary;45class MetaspaceSummary;46class PSHeapSummary;47class ReferenceProcessorStats;48class TimePartitions;49class BoolObjectClosure;5051class SharedGCInfo VALUE_OBJ_CLASS_SPEC {52private:53GCId _gc_id;54GCName _name;55GCCause::Cause _cause;56Ticks _start_timestamp;57Ticks _end_timestamp;58Tickspan _sum_of_pauses;59Tickspan _longest_pause;6061public:62SharedGCInfo(GCName name) :63_gc_id(GCId::undefined()),64_name(name),65_cause(GCCause::_last_gc_cause),66_start_timestamp(),67_end_timestamp(),68_sum_of_pauses(),69_longest_pause() {70}7172void set_gc_id(GCId gc_id) { _gc_id = gc_id; }73const GCId& gc_id() const { return _gc_id; }7475void set_start_timestamp(const Ticks& timestamp) { _start_timestamp = timestamp; }76const Ticks start_timestamp() const { return _start_timestamp; }7778void set_end_timestamp(const Ticks& timestamp) { _end_timestamp = timestamp; }79const Ticks end_timestamp() const { return _end_timestamp; }8081void set_name(GCName name) { _name = name; }82GCName name() const { return _name; }8384void set_cause(GCCause::Cause cause) { _cause = cause; }85GCCause::Cause cause() const { return _cause; }8687void set_sum_of_pauses(const Tickspan& duration) { _sum_of_pauses = duration; }88const Tickspan sum_of_pauses() const { return _sum_of_pauses; }8990void set_longest_pause(const Tickspan& duration) { _longest_pause = duration; }91const Tickspan longest_pause() const { return _longest_pause; }92};9394class ParallelOldGCInfo VALUE_OBJ_CLASS_SPEC {95void* _dense_prefix;96public:97ParallelOldGCInfo() : _dense_prefix(NULL) {}98void report_dense_prefix(void* addr) {99_dense_prefix = addr;100}101void* dense_prefix() const { return _dense_prefix; }102};103104#if INCLUDE_ALL_GCS105106class G1YoungGCInfo VALUE_OBJ_CLASS_SPEC {107G1YCType _type;108public:109G1YoungGCInfo() : _type(G1YCTypeEndSentinel) {}110void set_type(G1YCType type) {111_type = type;112}113G1YCType type() const { return _type; }114};115116#endif // INCLUDE_ALL_GCS117118class GCTracer : public ResourceObj {119protected:120SharedGCInfo _shared_gc_info;121122public:123void report_gc_start(GCCause::Cause cause, const Ticks& timestamp);124void report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions);125void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary) const;126void report_metaspace_summary(GCWhen::Type when, const MetaspaceSummary& metaspace_summary) const;127void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;128void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN;129bool has_reported_gc_start() const;130const GCId& gc_id() { return _shared_gc_info.gc_id(); }131132protected:133GCTracer(GCName name) : _shared_gc_info(name) {}134void report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp);135virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);136137private:138void send_garbage_collection_event() const;139void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const;140void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const;141void send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspace::MetadataType mdtype, const MetaspaceChunkFreeListSummary& summary) const;142void send_reference_stats_event(ReferenceType type, size_t count) const;143void send_phase_events(TimePartitions* time_partitions) const;144};145146class YoungGCTracer : public GCTracer {147static const uint UNSET_TENURING_THRESHOLD = (uint) -1;148149uint _tenuring_threshold;150151protected:152YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {}153virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);154155public:156void report_promotion_failed(const PromotionFailedInfo& pf_info);157void report_tenuring_threshold(const uint tenuring_threshold);158/*159* Methods for reporting Promotion in new or outside PLAB Events.160*161* The object age is always required as it is not certain that the mark word162* of the oop can be trusted at this stage.163*164* obj_size is the size of the promoted object in bytes.165*166* tenured should be true if the object has been promoted to the old167* space during this GC, if the object is copied to survivor space168* from young space or survivor space (aging) tenured should be false.169*170* plab_size is the size of the newly allocated PLAB in bytes.171*/172bool should_report_promotion_events() const;173bool should_report_promotion_in_new_plab_event() const;174bool should_report_promotion_outside_plab_event() const;175void report_promotion_in_new_plab_event(Klass* klass, size_t obj_size,176uint age, bool tenured,177size_t plab_size) const;178void report_promotion_outside_plab_event(Klass* klass, size_t obj_size,179uint age, bool tenured) const;180181private:182void send_young_gc_event() const;183void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const;184bool should_send_promotion_in_new_plab_event() const;185bool should_send_promotion_outside_plab_event() const;186void send_promotion_in_new_plab_event(Klass* klass, size_t obj_size,187uint age, bool tenured,188size_t plab_size) const;189void send_promotion_outside_plab_event(Klass* klass, size_t obj_size,190uint age, bool tenured) const;191};192193class OldGCTracer : public GCTracer {194protected:195OldGCTracer(GCName name) : GCTracer(name) {}196virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);197198public:199void report_concurrent_mode_failure();200201private:202void send_old_gc_event() const;203void send_concurrent_mode_failure_event();204};205206class ParallelOldTracer : public OldGCTracer {207ParallelOldGCInfo _parallel_old_gc_info;208209public:210ParallelOldTracer() : OldGCTracer(ParallelOld) {}211void report_dense_prefix(void* dense_prefix);212213protected:214void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);215216private:217void send_parallel_old_event() const;218};219220class SerialOldTracer : public OldGCTracer {221public:222SerialOldTracer() : OldGCTracer(SerialOld) {}223};224225class ParallelScavengeTracer : public YoungGCTracer {226public:227ParallelScavengeTracer() : YoungGCTracer(ParallelScavenge) {}228};229230class DefNewTracer : public YoungGCTracer {231public:232DefNewTracer() : YoungGCTracer(DefNew) {}233};234235class ParNewTracer : public YoungGCTracer {236public:237ParNewTracer() : YoungGCTracer(ParNew) {}238};239240#if INCLUDE_ALL_GCS241class G1MMUTracer : public AllStatic {242static void send_g1_mmu_event(double time_slice_ms, double gc_time_ms, double max_time_ms);243244public:245static void report_mmu(double time_slice_sec, double gc_time_sec, double max_time_sec);246};247248class G1NewTracer : public YoungGCTracer {249G1YoungGCInfo _g1_young_gc_info;250251public:252G1NewTracer() : YoungGCTracer(G1New) {}253254void report_yc_type(G1YCType type);255void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);256void report_evacuation_info(EvacuationInfo* info);257void report_evacuation_failed(EvacuationFailedInfo& ef_info);258259private:260void send_g1_young_gc_event();261void send_evacuation_info_event(EvacuationInfo* info);262void send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const;263};264#endif265266class CMSTracer : public OldGCTracer {267public:268CMSTracer() : OldGCTracer(ConcurrentMarkSweep) {}269};270271class G1OldTracer : public OldGCTracer {272public:273G1OldTracer() : OldGCTracer(G1Old) {}274};275276#endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP277278279