hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp
changeset 25350 6423a57e5451
parent 23470 ff2a7ea4225d
child 27684 e0391b2bf625
equal deleted inserted replaced
25076:7b684cdb7411 25350:6423a57e5451
    25 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP
    25 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP
    26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP
    26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP
    27 
    27 
    28 #include "gc_interface/gcCause.hpp"
    28 #include "gc_interface/gcCause.hpp"
    29 #include "gc_interface/gcName.hpp"
    29 #include "gc_interface/gcName.hpp"
       
    30 #include "gc_implementation/shared/gcId.hpp"
    30 #include "gc_implementation/shared/gcWhen.hpp"
    31 #include "gc_implementation/shared/gcWhen.hpp"
    31 #include "gc_implementation/shared/copyFailedInfo.hpp"
    32 #include "gc_implementation/shared/copyFailedInfo.hpp"
    32 #include "memory/allocation.hpp"
    33 #include "memory/allocation.hpp"
    33 #include "memory/metaspace.hpp"
    34 #include "memory/metaspace.hpp"
    34 #include "memory/referenceType.hpp"
    35 #include "memory/referenceType.hpp"
    36 #include "gc_implementation/g1/g1YCTypes.hpp"
    37 #include "gc_implementation/g1/g1YCTypes.hpp"
    37 #endif
    38 #endif
    38 #include "utilities/macros.hpp"
    39 #include "utilities/macros.hpp"
    39 #include "utilities/ticks.hpp"
    40 #include "utilities/ticks.hpp"
    40 
    41 
    41 typedef uint GCId;
       
    42 
    42 
    43 class EvacuationInfo;
    43 class EvacuationInfo;
    44 class GCHeapSummary;
    44 class GCHeapSummary;
    45 class MetaspaceChunkFreeListSummary;
    45 class MetaspaceChunkFreeListSummary;
    46 class MetaspaceSummary;
    46 class MetaspaceSummary;
    48 class ReferenceProcessorStats;
    48 class ReferenceProcessorStats;
    49 class TimePartitions;
    49 class TimePartitions;
    50 class BoolObjectClosure;
    50 class BoolObjectClosure;
    51 
    51 
    52 class SharedGCInfo VALUE_OBJ_CLASS_SPEC {
    52 class SharedGCInfo VALUE_OBJ_CLASS_SPEC {
    53  public:
    53  private:
    54   static const GCId UNSET_GCID = (GCId)-1;
    54   GCId _gc_id;
    55 
       
    56  private:
       
    57   GCId _id;
       
    58   GCName _name;
    55   GCName _name;
    59   GCCause::Cause _cause;
    56   GCCause::Cause _cause;
    60   Ticks     _start_timestamp;
    57   Ticks     _start_timestamp;
    61   Ticks     _end_timestamp;
    58   Ticks     _end_timestamp;
    62   Tickspan  _sum_of_pauses;
    59   Tickspan  _sum_of_pauses;
    63   Tickspan  _longest_pause;
    60   Tickspan  _longest_pause;
    64 
    61 
    65  public:
    62  public:
    66   SharedGCInfo(GCName name) :
    63   SharedGCInfo(GCName name) :
    67     _id(UNSET_GCID),
    64     _gc_id(GCId::undefined()),
    68     _name(name),
    65     _name(name),
    69     _cause(GCCause::_last_gc_cause),
    66     _cause(GCCause::_last_gc_cause),
    70     _start_timestamp(),
    67     _start_timestamp(),
    71     _end_timestamp(),
    68     _end_timestamp(),
    72     _sum_of_pauses(),
    69     _sum_of_pauses(),
    73     _longest_pause() {
    70     _longest_pause() {
    74   }
    71   }
    75 
    72 
    76   void set_id(GCId id) { _id = id; }
    73   void set_gc_id(GCId gc_id) { _gc_id = gc_id; }
    77   GCId id() const { return _id; }
    74   const GCId& gc_id() const { return _gc_id; }
    78 
    75 
    79   void set_start_timestamp(const Ticks& timestamp) { _start_timestamp = timestamp; }
    76   void set_start_timestamp(const Ticks& timestamp) { _start_timestamp = timestamp; }
    80   const Ticks start_timestamp() const { return _start_timestamp; }
    77   const Ticks start_timestamp() const { return _start_timestamp; }
    81 
    78 
    82   void set_end_timestamp(const Ticks& timestamp) { _end_timestamp = timestamp; }
    79   void set_end_timestamp(const Ticks& timestamp) { _end_timestamp = timestamp; }
   129   void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
   126   void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
   130   void report_metaspace_summary(GCWhen::Type when, const MetaspaceSummary& metaspace_summary) const;
   127   void report_metaspace_summary(GCWhen::Type when, const MetaspaceSummary& metaspace_summary) const;
   131   void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
   128   void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
   132   void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN;
   129   void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN;
   133   bool has_reported_gc_start() const;
   130   bool has_reported_gc_start() const;
       
   131   const GCId& gc_id() { return _shared_gc_info.gc_id(); }
   134 
   132 
   135  protected:
   133  protected:
   136   GCTracer(GCName name) : _shared_gc_info(name) {}
   134   GCTracer(GCName name) : _shared_gc_info(name) {}
   137   virtual void report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp);
   135   void report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp);
   138   virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
   136   virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
   139 
   137 
   140  private:
   138  private:
   141   void send_garbage_collection_event() const;
   139   void send_garbage_collection_event() const;
   142   void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
   140   void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const;