1.1 --- a/src/share/vm/gc_implementation/shared/generationCounters.cpp Thu Sep 22 10:57:37 2011 -0700 1.2 +++ b/src/share/vm/gc_implementation/shared/generationCounters.cpp Fri Sep 23 16:07:49 2011 -0400 1.3 @@ -26,14 +26,10 @@ 1.4 #include "gc_implementation/shared/generationCounters.hpp" 1.5 #include "memory/resourceArea.hpp" 1.6 1.7 - 1.8 -GenerationCounters::GenerationCounters(const char* name, 1.9 - int ordinal, int spaces, 1.10 - VirtualSpace* v): 1.11 - _virtual_space(v) { 1.12 - 1.13 +void GenerationCounters::initialize(const char* name, int ordinal, int spaces, 1.14 + size_t min_capacity, size_t max_capacity, 1.15 + size_t curr_capacity) { 1.16 if (UsePerfData) { 1.17 - 1.18 EXCEPTION_MARK; 1.19 ResourceMark rm; 1.20 1.21 @@ -51,18 +47,37 @@ 1.22 1.23 cname = PerfDataManager::counter_name(_name_space, "minCapacity"); 1.24 PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes, 1.25 - _virtual_space == NULL ? 0 : 1.26 - _virtual_space->committed_size(), CHECK); 1.27 + min_capacity, CHECK); 1.28 1.29 cname = PerfDataManager::counter_name(_name_space, "maxCapacity"); 1.30 PerfDataManager::create_constant(SUN_GC, cname, PerfData::U_Bytes, 1.31 - _virtual_space == NULL ? 0 : 1.32 - _virtual_space->reserved_size(), CHECK); 1.33 + max_capacity, CHECK); 1.34 1.35 cname = PerfDataManager::counter_name(_name_space, "capacity"); 1.36 - _current_size = PerfDataManager::create_variable(SUN_GC, cname, 1.37 - PerfData::U_Bytes, 1.38 - _virtual_space == NULL ? 0 : 1.39 - _virtual_space->committed_size(), CHECK); 1.40 + _current_size = 1.41 + PerfDataManager::create_variable(SUN_GC, cname, PerfData::U_Bytes, 1.42 + curr_capacity, CHECK); 1.43 } 1.44 } 1.45 + 1.46 +GenerationCounters::GenerationCounters(const char* name, 1.47 + int ordinal, int spaces, 1.48 + VirtualSpace* v) 1.49 + : _virtual_space(v) { 1.50 + assert(v != NULL, "don't call this constructor if v == NULL"); 1.51 + initialize(name, ordinal, spaces, 1.52 + v->committed_size(), v->reserved_size(), v->committed_size()); 1.53 +} 1.54 + 1.55 +GenerationCounters::GenerationCounters(const char* name, 1.56 + int ordinal, int spaces, 1.57 + size_t min_capacity, size_t max_capacity, 1.58 + size_t curr_capacity) 1.59 + : _virtual_space(NULL) { 1.60 + initialize(name, ordinal, spaces, min_capacity, max_capacity, curr_capacity); 1.61 +} 1.62 + 1.63 +void GenerationCounters::update_all() { 1.64 + assert(_virtual_space != NULL, "otherwise, override this method"); 1.65 + _current_size->set_value(_virtual_space->committed_size()); 1.66 +}