src/hotspot/share/gc/shared/collectorCounters.hpp
changeset 48115 d8ec0640616c
parent 47216 71c04702a3d5
child 53244 9807daeb47c4
equal deleted inserted replaced
48114:e6b643827037 48115:d8ec0640616c
    47 
    47 
    48   public:
    48   public:
    49 
    49 
    50     CollectorCounters(const char* name, int ordinal);
    50     CollectorCounters(const char* name, int ordinal);
    51 
    51 
    52     ~CollectorCounters() {
    52     ~CollectorCounters();
    53       if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
       
    54     }
       
    55 
    53 
    56     inline PerfCounter* invocation_counter() const  { return _invocations; }
    54     inline PerfCounter* invocation_counter() const  { return _invocations; }
    57 
    55 
    58     inline PerfCounter* time_counter() const        { return _time; }
    56     inline PerfCounter* time_counter() const        { return _time; }
    59 
    57 
    68 
    66 
    69   protected:
    67   protected:
    70     CollectorCounters* _c;
    68     CollectorCounters* _c;
    71 
    69 
    72   public:
    70   public:
    73     inline TraceCollectorStats(CollectorCounters* c) :
    71     TraceCollectorStats(CollectorCounters* c);
    74            PerfTraceTimedEvent(c->time_counter(), c->invocation_counter()),
       
    75            _c(c) {
       
    76 
    72 
    77       if (UsePerfData) {
    73     ~TraceCollectorStats();
    78          _c->last_entry_counter()->set_value(os::elapsed_counter());
       
    79       }
       
    80     }
       
    81 
       
    82     inline ~TraceCollectorStats() {
       
    83       if (UsePerfData) _c->last_exit_counter()->set_value(os::elapsed_counter());
       
    84     }
       
    85 };
    74 };
    86 
    75 
    87 #endif // SHARE_VM_GC_SHARED_COLLECTORCOUNTERS_HPP
    76 #endif // SHARE_VM_GC_SHARED_COLLECTORCOUNTERS_HPP