< prev index next >

src/hotspot/share/gc/g1/g1OldGenAllocationTracker.hpp

Print this page
rev 60584 : imported patch 8245511-ihop
rev 60585 : [mq]: 8245511-rev1


  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  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_G1OLDGENALLOCATIONTRACKER_HPP
  26 #define SHARE_VM_GC_G1_G1OLDGENALLOCATIONTRACKER_HPP
  27 
  28 #include "gc/g1/heapRegion.hpp"
  29 #include "memory/allocation.hpp"
  30 


  31 // Track allocation details in the old generation.
  32 class G1OldGenAllocationTracker : public CHeapObj<mtGC> {
  33   // New bytes allocated in old gen between the end of the last GC and
  34   // the end of the GC before that.
  35   size_t _last_cycle_old_bytes;
  36   // The number of seconds between the end of the last GC and
  37   // the end of the GC before that.
  38   double _last_cycle_duration;
  39 
  40   size_t _allocated_bytes_since_last_gc;

  41 
  42   void reset_cycle_after_gc() {
  43     _last_cycle_old_bytes = _allocated_bytes_since_last_gc;
  44     _allocated_bytes_since_last_gc = 0;
  45   }
  46 
  47 public:
  48   G1OldGenAllocationTracker();
  49   // Add the given number of bytes to the total number of allocated bytes in the old gen.
  50   void add_allocated_bytes_since_last_gc(size_t bytes) { _allocated_bytes_since_last_gc += bytes; }

  51 
  52   size_t last_cycle_old_bytes() { return _last_cycle_old_bytes; }




  53 
  54   double last_cycle_duration() { return _last_cycle_duration; }

  55 
  56   // Reset stats after a collection.
  57   void reset_after_full_gc();
  58   void reset_after_young_gc(double allocation_duration_s);
  59 };
  60 
  61 #endif // SHARE_VM_GC_G1_G1OLDGENALLOCATIONTRACKER_HPP


  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  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_G1_G1OLDGENALLOCATIONTRACKER_HPP
  26 #define SHARE_VM_GC_G1_G1OLDGENALLOCATIONTRACKER_HPP
  27 
  28 #include "gc/g1/heapRegion.hpp"
  29 #include "memory/allocation.hpp"
  30 
  31 class G1AdaptiveIHOPControl;
  32 
  33 // Track allocation details in the old generation.
  34 class G1OldGenAllocationTracker : public CHeapObj<mtGC> {
  35   // Total number of bytes allocated in the old generaton during
  36   // last mutator period.
  37   size_t _last_period_old_gen_bytes;
  38   // Total growth of the old geneneration for last mutator period,
  39   // taking eager reclaim into consideration.
  40   size_t _last_period_old_gen_growth;
  41 
  42   // Total size of humongous objects for last gc.
  43   size_t _humongous_bytes_after_last_gc;
  44 
  45   // Non-humongous old generation allocations during last mutator period.
  46   size_t _allocated_bytes_since_last_gc;
  47   // Humongous allocations during last mutator period.
  48   size_t _allocated_humongous_bytes_since_last_gc;
  49 
  50 public:
  51   G1OldGenAllocationTracker();
  52 
  53   void add_allocated_bytes_since_last_gc(size_t bytes) { _allocated_bytes_since_last_gc += bytes; }
  54   void add_allocated_humongous_bytes_since_last_gc(size_t bytes) { _allocated_humongous_bytes_since_last_gc += bytes; }
  55 
  56   // Record a humongous allocation in a collection pause. This allocation
  57   // is accounted to the previous mutator period.
  58   void record_collection_pause_humongous_allocation(size_t bytes) {
  59     _humongous_bytes_after_last_gc += bytes;
  60   }
  61 
  62   size_t last_period_old_gen_bytes() const { return _last_period_old_gen_bytes; }
  63   size_t last_period_old_gen_growth() const { return _last_period_old_gen_growth; };
  64 
  65   // Calculates and resets stats after a collection.
  66   void reset_after_gc(size_t humongous_bytes_after_gc);

  67 };
  68 
  69 #endif // SHARE_VM_GC_G1_G1OLDGENALLOCATIONTRACKER_HPP
< prev index next >