112 result = true;
113 if (PrintGC && Verbose) {
114 gclog_or_tty->print_cr("TenuredGeneration::should_collect: because"
115 "_capacity_at_prologue: " SIZE_FORMAT " < capacity(): " SIZE_FORMAT,
116 _capacity_at_prologue, capacity());
117 }
118 }
119 return result;
120 }
121
122 void TenuredGeneration::compute_new_size() {
123 assert_locked_or_safepoint(Heap_lock);
124
125 // Compute some numbers about the state of the heap.
126 const size_t used_after_gc = used();
127 const size_t capacity_after_gc = capacity();
128
129 CardGeneration::compute_new_size();
130
131 assert(used() == used_after_gc && used_after_gc <= capacity(),
132 err_msg("used: " SIZE_FORMAT " used_after_gc: " SIZE_FORMAT
133 " capacity: " SIZE_FORMAT, used(), used_after_gc, capacity()));
134 }
135
136 void TenuredGeneration::update_gc_stats(Generation* current_generation,
137 bool full) {
138 // If the young generation has been collected, gather any statistics
139 // that are of interest at this point.
140 bool current_is_young = GenCollectedHeap::heap()->is_young_gen(current_generation);
141 if (!full && current_is_young) {
142 // Calculate size of data promoted from the young generation
143 // before doing the collection.
144 size_t used_before_gc = used();
145
146 // If the young gen collection was skipped, then the
147 // number of promoted bytes will be 0 and adding it to the
148 // average will incorrectly lessen the average. It is, however,
149 // also possible that no promotion was needed.
150 if (used_before_gc >= _used_at_prologue) {
151 size_t promoted_in_bytes = used_before_gc - _used_at_prologue;
152 gc_stats()->avg_promoted()->sample(promoted_in_bytes);
153 }
|
112 result = true;
113 if (PrintGC && Verbose) {
114 gclog_or_tty->print_cr("TenuredGeneration::should_collect: because"
115 "_capacity_at_prologue: " SIZE_FORMAT " < capacity(): " SIZE_FORMAT,
116 _capacity_at_prologue, capacity());
117 }
118 }
119 return result;
120 }
121
122 void TenuredGeneration::compute_new_size() {
123 assert_locked_or_safepoint(Heap_lock);
124
125 // Compute some numbers about the state of the heap.
126 const size_t used_after_gc = used();
127 const size_t capacity_after_gc = capacity();
128
129 CardGeneration::compute_new_size();
130
131 assert(used() == used_after_gc && used_after_gc <= capacity(),
132 "used: " SIZE_FORMAT " used_after_gc: " SIZE_FORMAT
133 " capacity: " SIZE_FORMAT, used(), used_after_gc, capacity());
134 }
135
136 void TenuredGeneration::update_gc_stats(Generation* current_generation,
137 bool full) {
138 // If the young generation has been collected, gather any statistics
139 // that are of interest at this point.
140 bool current_is_young = GenCollectedHeap::heap()->is_young_gen(current_generation);
141 if (!full && current_is_young) {
142 // Calculate size of data promoted from the young generation
143 // before doing the collection.
144 size_t used_before_gc = used();
145
146 // If the young gen collection was skipped, then the
147 // number of promoted bytes will be 0 and adding it to the
148 // average will incorrectly lessen the average. It is, however,
149 // also possible that no promotion was needed.
150 if (used_before_gc >= _used_at_prologue) {
151 size_t promoted_in_bytes = used_before_gc - _used_at_prologue;
152 gc_stats()->avg_promoted()->sample(promoted_in_bytes);
153 }
|