< prev index next >

src/share/vm/gc/g1/g1EvacStats.cpp

Print this page
rev 8978 : imported patch remove_err_msg


  28 #include "trace/tracing.hpp"
  29 
  30 void G1EvacStats::adjust_desired_plab_sz() {
  31   if (PrintPLAB) {
  32     gclog_or_tty->print(" (allocated = " SIZE_FORMAT " wasted = " SIZE_FORMAT " "
  33                         "unused = " SIZE_FORMAT " used = " SIZE_FORMAT " "
  34                         "undo_waste = " SIZE_FORMAT " region_end_waste = " SIZE_FORMAT " "
  35                         "regions filled = %u direct_allocated = " SIZE_FORMAT " "
  36                         "failure_used = " SIZE_FORMAT " failure_waste = " SIZE_FORMAT ") ",
  37                         _allocated, _wasted, _unused, used(), _undo_wasted, _region_end_waste,
  38                         _regions_filled, _direct_allocated, _failure_used, _failure_waste);
  39   }
  40 
  41   if (ResizePLAB) {
  42 
  43     assert(is_object_aligned(max_size()) && min_size() <= max_size(),
  44            "PLAB clipping computation may be incorrect");
  45 
  46     if (_allocated == 0) {
  47       assert((_unused == 0),
  48              err_msg("Inconsistency in PLAB stats: "
  49                      "_allocated: " SIZE_FORMAT ", "
  50                      "_wasted: " SIZE_FORMAT ", "
  51                      "_region_end_waste: " SIZE_FORMAT ", "
  52                      "_unused: " SIZE_FORMAT ", "
  53                      "_used  : " SIZE_FORMAT,
  54                      _allocated, _wasted, _region_end_waste, _unused, used()));
  55       _allocated = 1;
  56     }
  57     // The size of the PLAB caps the amount of space that can be wasted at the
  58     // end of the collection. In the worst case the last PLAB could be completely
  59     // empty.
  60     // This allows us to calculate the new PLAB size to achieve the
  61     // TargetPLABWastePct given the latest memory usage and that the last buffer
  62     // will be G1LastPLABAverageOccupancy full.
  63     //
  64     // E.g. assume that if in the current GC 100 words were allocated and a
  65     // TargetPLABWastePct of 10 had been set.
  66     //
  67     // So we could waste up to 10 words to meet that percentage. Given that we
  68     // also assume that that buffer is typically half-full, the new desired PLAB
  69     // size is set to 20 words.
  70     //
  71     // The amount of allocation performed should be independent of the number of
  72     // threads, so should the maximum waste we can spend in total. So if
  73     // we used n threads to allocate, each of them can spend maximum waste/n words in
  74     // a first rough approximation. The number of threads only comes into play later




  28 #include "trace/tracing.hpp"
  29 
  30 void G1EvacStats::adjust_desired_plab_sz() {
  31   if (PrintPLAB) {
  32     gclog_or_tty->print(" (allocated = " SIZE_FORMAT " wasted = " SIZE_FORMAT " "
  33                         "unused = " SIZE_FORMAT " used = " SIZE_FORMAT " "
  34                         "undo_waste = " SIZE_FORMAT " region_end_waste = " SIZE_FORMAT " "
  35                         "regions filled = %u direct_allocated = " SIZE_FORMAT " "
  36                         "failure_used = " SIZE_FORMAT " failure_waste = " SIZE_FORMAT ") ",
  37                         _allocated, _wasted, _unused, used(), _undo_wasted, _region_end_waste,
  38                         _regions_filled, _direct_allocated, _failure_used, _failure_waste);
  39   }
  40 
  41   if (ResizePLAB) {
  42 
  43     assert(is_object_aligned(max_size()) && min_size() <= max_size(),
  44            "PLAB clipping computation may be incorrect");
  45 
  46     if (_allocated == 0) {
  47       assert((_unused == 0),
  48              "Inconsistency in PLAB stats: "
  49              "_allocated: " SIZE_FORMAT ", "
  50              "_wasted: " SIZE_FORMAT ", "
  51              "_region_end_waste: " SIZE_FORMAT ", "
  52              "_unused: " SIZE_FORMAT ", "
  53              "_used  : " SIZE_FORMAT,
  54              _allocated, _wasted, _region_end_waste, _unused, used());
  55       _allocated = 1;
  56     }
  57     // The size of the PLAB caps the amount of space that can be wasted at the
  58     // end of the collection. In the worst case the last PLAB could be completely
  59     // empty.
  60     // This allows us to calculate the new PLAB size to achieve the
  61     // TargetPLABWastePct given the latest memory usage and that the last buffer
  62     // will be G1LastPLABAverageOccupancy full.
  63     //
  64     // E.g. assume that if in the current GC 100 words were allocated and a
  65     // TargetPLABWastePct of 10 had been set.
  66     //
  67     // So we could waste up to 10 words to meet that percentage. Given that we
  68     // also assume that that buffer is typically half-full, the new desired PLAB
  69     // size is set to 20 words.
  70     //
  71     // The amount of allocation performed should be independent of the number of
  72     // threads, so should the maximum waste we can spend in total. So if
  73     // we used n threads to allocate, each of them can spend maximum waste/n words in
  74     // a first rough approximation. The number of threads only comes into play later


< prev index next >