25
#include "precompiled.hpp"
26
#include "gc/shared/collectorCounters.hpp"
27
#include "memory/allocation.inline.hpp"
28
#include "memory/resourceArea.hpp"
29
#include "runtime/os.hpp"
31
CollectorCounters::CollectorCounters(const char* name, int ordinal) {
37
const char* cns = PerfDataManager::name_space("collector", ordinal);
39
_name_space = NEW_C_HEAP_ARRAY(char, strlen(cns)+1, mtGC);
40
strcpy(_name_space, cns);
42
char* cname = PerfDataManager::counter_name(_name_space, "name");
43
PerfDataManager::create_string_constant(SUN_GC, cname, name, CHECK);
45
cname = PerfDataManager::counter_name(_name_space, "invocations");
46
_invocations = PerfDataManager::create_counter(SUN_GC, cname,
47
PerfData::U_Events, CHECK);
49
cname = PerfDataManager::counter_name(_name_space, "time");
50
_time = PerfDataManager::create_counter(SUN_GC, cname, PerfData::U_Ticks,
53
cname = PerfDataManager::counter_name(_name_space, "lastEntryTime");
54
_last_entry_time = PerfDataManager::create_variable(SUN_GC, cname,
58
cname = PerfDataManager::counter_name(_name_space, "lastExitTime");
59
_last_exit_time = PerfDataManager::create_variable(SUN_GC, cname,
65
CollectorCounters::~CollectorCounters() {
66
FREE_C_HEAP_ARRAY(char, _name_space);
69
TraceCollectorStats::TraceCollectorStats(CollectorCounters* c) :
70
PerfTraceTimedEvent(c->time_counter(), c->invocation_counter()),
74
_c->last_entry_counter()->set_value(os::elapsed_counter());
78
TraceCollectorStats::~TraceCollectorStats() {
80
_c->last_exit_counter()->set_value(os::elapsed_counter());