comparison src/share/vm/gc_implementation/g1/concurrentMark.hpp @ 2435:371bbc844bf1

7027766: G1: introduce flag to dump the liveness information per region at the end of marking Summary: Repurpose the existing flag G1PrintRegionLivenessInfo to print out the liveness distribution across the regions in the heap at the end of marking. Reviewed-by: iveresov, jwilhelm
author tonyp
date Mon, 04 Apr 2011 14:23:17 -0400
parents 234761c55641
children cd8e33b2a8ad
comparison
equal deleted inserted replaced
2434:c84ee870e0b9 2435:371bbc844bf1
1147 #if _MARKING_STATS_ 1147 #if _MARKING_STATS_
1148 void increase_objs_found_on_bitmap() { ++_objs_found_on_bitmap; } 1148 void increase_objs_found_on_bitmap() { ++_objs_found_on_bitmap; }
1149 #endif // _MARKING_STATS_ 1149 #endif // _MARKING_STATS_
1150 }; 1150 };
1151 1151
1152 // Class that's used to to print out per-region liveness
1153 // information. It's currently used at the end of marking and also
1154 // after we sort the old regions at the end of the cleanup operation.
1155 class G1PrintRegionLivenessInfoClosure: public HeapRegionClosure {
1156 private:
1157 outputStream* _out;
1158
1159 // Accumulators for these values.
1160 size_t _total_used_bytes;
1161 size_t _total_capacity_bytes;
1162 size_t _total_prev_live_bytes;
1163 size_t _total_next_live_bytes;
1164
1165 // These are set up when we come across a "stars humongous" region
1166 // (as this is where most of this information is stored, not in the
1167 // subsequent "continues humongous" regions). After that, for every
1168 // region in a given humongous region series we deduce the right
1169 // values for it by simply subtracting the appropriate amount from
1170 // these fields. All these values should reach 0 after we've visited
1171 // the last region in the series.
1172 size_t _hum_used_bytes;
1173 size_t _hum_capacity_bytes;
1174 size_t _hum_prev_live_bytes;
1175 size_t _hum_next_live_bytes;
1176
1177 static double perc(size_t val, size_t total) {
1178 if (total == 0) {
1179 return 0.0;
1180 } else {
1181 return 100.0 * ((double) val / (double) total);
1182 }
1183 }
1184
1185 static double bytes_to_mb(size_t val) {
1186 return (double) val / (double) M;
1187 }
1188
1189 // See the .cpp file.
1190 size_t get_hum_bytes(size_t* hum_bytes);
1191 void get_hum_bytes(size_t* used_bytes, size_t* capacity_bytes,
1192 size_t* prev_live_bytes, size_t* next_live_bytes);
1193
1194 public:
1195 // The header and footer are printed in the constructor and
1196 // destructor respectively.
1197 G1PrintRegionLivenessInfoClosure(outputStream* out, const char* phase_name);
1198 virtual bool doHeapRegion(HeapRegion* r);
1199 ~G1PrintRegionLivenessInfoClosure();
1200 };
1201
1152 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_HPP 1202 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_HPP