src/share/vm/gc_implementation/g1/concurrentMark.hpp

changeset 2717
371bbc844bf1
parent 2494
234761c55641
child 2848
cd8e33b2a8ad
     1.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Mon Apr 04 13:18:35 2011 -0400
     1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Mon Apr 04 14:23:17 2011 -0400
     1.3 @@ -1149,4 +1149,54 @@
     1.4  #endif // _MARKING_STATS_
     1.5  };
     1.6  
     1.7 +// Class that's used to to print out per-region liveness
     1.8 +// information. It's currently used at the end of marking and also
     1.9 +// after we sort the old regions at the end of the cleanup operation.
    1.10 +class G1PrintRegionLivenessInfoClosure: public HeapRegionClosure {
    1.11 +private:
    1.12 +  outputStream* _out;
    1.13 +
    1.14 +  // Accumulators for these values.
    1.15 +  size_t _total_used_bytes;
    1.16 +  size_t _total_capacity_bytes;
    1.17 +  size_t _total_prev_live_bytes;
    1.18 +  size_t _total_next_live_bytes;
    1.19 +
    1.20 +  // These are set up when we come across a "stars humongous" region
    1.21 +  // (as this is where most of this information is stored, not in the
    1.22 +  // subsequent "continues humongous" regions). After that, for every
    1.23 +  // region in a given humongous region series we deduce the right
    1.24 +  // values for it by simply subtracting the appropriate amount from
    1.25 +  // these fields. All these values should reach 0 after we've visited
    1.26 +  // the last region in the series.
    1.27 +  size_t _hum_used_bytes;
    1.28 +  size_t _hum_capacity_bytes;
    1.29 +  size_t _hum_prev_live_bytes;
    1.30 +  size_t _hum_next_live_bytes;
    1.31 +
    1.32 +  static double perc(size_t val, size_t total) {
    1.33 +    if (total == 0) {
    1.34 +      return 0.0;
    1.35 +    } else {
    1.36 +      return 100.0 * ((double) val / (double) total);
    1.37 +    }
    1.38 +  }
    1.39 +
    1.40 +  static double bytes_to_mb(size_t val) {
    1.41 +    return (double) val / (double) M;
    1.42 +  }
    1.43 +
    1.44 +  // See the .cpp file.
    1.45 +  size_t get_hum_bytes(size_t* hum_bytes);
    1.46 +  void get_hum_bytes(size_t* used_bytes, size_t* capacity_bytes,
    1.47 +                     size_t* prev_live_bytes, size_t* next_live_bytes);
    1.48 +
    1.49 +public:
    1.50 +  // The header and footer are printed in the constructor and
    1.51 +  // destructor respectively.
    1.52 +  G1PrintRegionLivenessInfoClosure(outputStream* out, const char* phase_name);
    1.53 +  virtual bool doHeapRegion(HeapRegion* r);
    1.54 +  ~G1PrintRegionLivenessInfoClosure();
    1.55 +};
    1.56 +
    1.57  #endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_HPP

mercurial