< prev index next >

src/share/vm/gc/shared/plab.hpp

Print this page
rev 10336 : [mq]: 8141141-young-and-old-gen-stats-are-similar-in-output
   1 /*
   2  * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 129     _hard_end = _bottom + word_sz();
 130     _end      = _hard_end - AlignmentReserve;
 131     assert(_end >= _top, "Negative buffer");
 132     // In support of ergonomic sizing
 133     _allocated += word_sz();
 134   }
 135 
 136   // Flush allocation statistics into the given PLABStats supporting ergonomic
 137   // sizing of PLAB's and retire the current buffer. To be called at the end of
 138   // GC.
 139   virtual void flush_and_retire_stats(PLABStats* stats);
 140 
 141   // Fills in the unallocated portion of the buffer with a garbage object and updates
 142   // statistics. To be called during GC.
 143   virtual void retire();
 144 };
 145 
 146 // PLAB book-keeping.
 147 class PLABStats : public CHeapObj<mtGC> {
 148  protected:


 149   size_t _allocated;          // Total allocated
 150   size_t _wasted;             // of which wasted (internal fragmentation)
 151   size_t _undo_wasted;        // of which wasted on undo (is not used for calculation of PLAB size)
 152   size_t _unused;             // Unused in last buffer
 153   size_t _desired_net_plab_sz;// Output of filter (below), suitably trimmed and quantized
 154   AdaptiveWeightedAverage
 155          _filter;             // Integrator with decay
 156 
 157   virtual void reset() {
 158     _allocated   = 0;
 159     _wasted      = 0;
 160     _undo_wasted = 0;
 161     _unused      = 0;
 162   }



 163  public:
 164   PLABStats(size_t desired_net_plab_sz_, unsigned wt) :

 165     _allocated(0),
 166     _wasted(0),
 167     _undo_wasted(0),
 168     _unused(0),
 169     _desired_net_plab_sz(desired_net_plab_sz_),
 170     _filter(wt)
 171   { }
 172 
 173   virtual ~PLABStats() { }






 174 
 175   static const size_t min_size() {
 176     return PLAB::min_size();
 177   }
 178 
 179   static const size_t max_size() {
 180     return PLAB::max_size();
 181   }
 182 
 183   // Calculates plab size for current number of gc worker threads.
 184   size_t desired_plab_sz(uint no_of_gc_workers);
 185 
 186   // Updates the current desired PLAB size. Computes the new desired PLAB size with one gc worker thread,
 187   // updates _desired_plab_sz and clears sensor accumulators.
 188   virtual void adjust_desired_plab_sz();
 189 
 190   inline void add_allocated(size_t v);
 191 
 192   inline void add_unused(size_t v);
 193 
   1 /*
   2  * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 129     _hard_end = _bottom + word_sz();
 130     _end      = _hard_end - AlignmentReserve;
 131     assert(_end >= _top, "Negative buffer");
 132     // In support of ergonomic sizing
 133     _allocated += word_sz();
 134   }
 135 
 136   // Flush allocation statistics into the given PLABStats supporting ergonomic
 137   // sizing of PLAB's and retire the current buffer. To be called at the end of
 138   // GC.
 139   virtual void flush_and_retire_stats(PLABStats* stats);
 140 
 141   // Fills in the unallocated portion of the buffer with a garbage object and updates
 142   // statistics. To be called during GC.
 143   virtual void retire();
 144 };
 145 
 146 // PLAB book-keeping.
 147 class PLABStats : public CHeapObj<mtGC> {
 148  protected:
 149   const char* _description;   // Identifying string.
 150 
 151   size_t _allocated;          // Total allocated
 152   size_t _wasted;             // of which wasted (internal fragmentation)
 153   size_t _undo_wasted;        // of which wasted on undo (is not used for calculation of PLAB size)
 154   size_t _unused;             // Unused in last buffer
 155   size_t _desired_net_plab_sz;// Output of filter (below), suitably trimmed and quantized
 156   AdaptiveWeightedAverage
 157          _filter;             // Integrator with decay
 158 
 159   virtual void reset() {
 160     _allocated   = 0;
 161     _wasted      = 0;
 162     _undo_wasted = 0;
 163     _unused      = 0;
 164   }
 165 
 166   virtual void log_plab_allocation();
 167   virtual void log_sizing(size_t calculated, size_t net_desired);
 168  public:
 169   PLABStats(const char* description, size_t desired_net_plab_sz_, unsigned wt) :
 170     _description(description),
 171     _allocated(0),
 172     _wasted(0),
 173     _undo_wasted(0),
 174     _unused(0),
 175     _desired_net_plab_sz(desired_net_plab_sz_),
 176     _filter(wt)
 177   { }
 178 
 179   virtual ~PLABStats() { }
 180 
 181   size_t allocated() const { return _allocated; }
 182   size_t wasted() const { return _wasted; }
 183   size_t unused() const { return _unused; }
 184   size_t used() const { return allocated() - (wasted() + unused()); }
 185   size_t undo_wasted() const { return _undo_wasted; }
 186 
 187   static const size_t min_size() {
 188     return PLAB::min_size();
 189   }
 190 
 191   static const size_t max_size() {
 192     return PLAB::max_size();
 193   }
 194 
 195   // Calculates plab size for current number of gc worker threads.
 196   size_t desired_plab_sz(uint no_of_gc_workers);
 197 
 198   // Updates the current desired PLAB size. Computes the new desired PLAB size with one gc worker thread,
 199   // updates _desired_plab_sz and clears sensor accumulators.
 200   virtual void adjust_desired_plab_sz();
 201 
 202   inline void add_allocated(size_t v);
 203 
 204   inline void add_unused(size_t v);
 205 
< prev index next >