comparison src/share/vm/gc_implementation/shared/generationCounters.cpp @ 2741:8229bd737950

7075646: G1: fix inconsistencies in the monitoring data Summary: Fixed a few inconsistencies in the monitoring data, in particular when reported from jstat. Reviewed-by: jmasa, brutisso, johnc
author tonyp
date Fri, 23 Sep 2011 16:07:49 -0400
parents b52782ae3880
children d2a62e0f25eb
comparison
equal deleted inserted replaced
3:2d45a3aad998 4:6ae9020a5d9b
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "gc_implementation/shared/generationCounters.hpp" 26 #include "gc_implementation/shared/generationCounters.hpp"
27 #include "memory/resourceArea.hpp" 27 #include "memory/resourceArea.hpp"
28 28
29 29 void GenerationCounters::initialize(const char* name, int ordinal, int spaces,
30 GenerationCounters::GenerationCounters(const char* name, 30 size_t min_capacity, size_t max_capacity,
31 int ordinal, int spaces, 31 size_t curr_capacity) {
32 VirtualSpace* v):
33 _virtual_space(v) {
34
35 if (UsePerfData) { 32 if (UsePerfData) {
36
37 EXCEPTION_MARK; 33 EXCEPTION_MARK;
38 ResourceMark rm; 34 ResourceMark rm;
39 35
40 const char* cns = PerfDataManager::name_space("generation", ordinal); 36 const char* cns = PerfDataManager::name_space("generation", ordinal);
41 37
49 PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_None, 45 PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_None,
50 spaces, CHECK); 46 spaces, CHECK);
51 47
52 cname = PerfDataManager::counter_name(_name_space, "minCapacity"); 48 cname = PerfDataManager::counter_name(_name_space, "minCapacity");
53 PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes, 49 PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes,
54 _virtual_space == NULL ? 0 : 50 min_capacity, CHECK);
55 _virtual_space->committed_size(), CHECK);
56 51
57 cname = PerfDataManager::counter_name(_name_space, "maxCapacity"); 52 cname = PerfDataManager::counter_name(_name_space, "maxCapacity");
58 PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes, 53 PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes,
59 _virtual_space == NULL ? 0 : 54 max_capacity, CHECK);
60 _virtual_space->reserved_size(), CHECK);
61 55
62 cname = PerfDataManager::counter_name(_name_space, "capacity"); 56 cname = PerfDataManager::counter_name(_name_space, "capacity");
63 _current_size = PerfDataManager::create_variable(SUN_GC, cname, 57 _current_size =
64 PerfData::U_Bytes, 58 PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes,
65 _virtual_space == NULL ? 0 : 59 curr_capacity, CHECK);
66 _virtual_space->committed_size(), CHECK);
67 } 60 }
68 } 61 }
62
63 GenerationCounters::GenerationCounters(const char* name,
64 int ordinal, int spaces,
65 VirtualSpace* v)
66 : _virtual_space(v) {
67 assert(v != NULL, "don't call this constructor if v == NULL");
68 initialize(name, ordinal, spaces,
69 v->committed_size(), v->reserved_size(), v->committed_size());
70 }
71
72 GenerationCounters::GenerationCounters(const char* name,
73 int ordinal, int spaces,
74 size_t min_capacity, size_t max_capacity,
75 size_t curr_capacity)
76 : _virtual_space(NULL) {
77 initialize(name, ordinal, spaces, min_capacity, max_capacity, curr_capacity);
78 }
79
80 void GenerationCounters::update_all() {
81 assert(_virtual_space != NULL, "otherwise, override this method");
82 _current_size->set_value(_virtual_space->committed_size());
83 }