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

Print this page


   1 /*
   2  * Copyright (c) 2001, 2009, 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  *
  23  */
  24 






  25 // Keeps track of the GC work and decides when it is OK to do GC work
  26 // and for how long so that the MMU invariants are maintained.
  27 
  28 /***** ALL TIMES ARE IN SECS!!!!!!! *****/
  29 
  30 // this is the "interface"
  31 class G1MMUTracker: public CHeapObj {
  32 protected:
  33   double          _time_slice;
  34   double          _max_gc_time; // this is per time slice
  35 
  36 public:
  37   G1MMUTracker(double time_slice, double max_gc_time);
  38 
  39   virtual void add_pause(double start, double end, bool gc_thread) = 0;
  40   virtual double longest_pause(double current_time) = 0;
  41   virtual double when_sec(double current_time, double pause_time) = 0;
  42 
  43   double max_gc_time() {
  44     return _max_gc_time;


 110   int                   _no_entries;
 111 
 112   inline int trim_index(int index) {
 113     return (index + QueueLength) % QueueLength;
 114   }
 115 
 116   void remove_expired_entries(double current_time);
 117   double calculate_gc_time(double current_time);
 118 
 119   double longest_pause_internal(double current_time);
 120   double when_internal(double current_time, double pause_time);
 121 
 122 public:
 123   G1MMUTrackerQueue(double time_slice, double max_gc_time);
 124 
 125   virtual void add_pause(double start, double end, bool gc_thread);
 126 
 127   virtual double longest_pause(double current_time);
 128   virtual double when_sec(double current_time, double pause_time);
 129 };


   1 /*
   2  * Copyright (c) 2001, 2010, 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  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1MMUTRACKER_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1MMUTRACKER_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "utilities/debug.hpp"
  30 
  31 // Keeps track of the GC work and decides when it is OK to do GC work
  32 // and for how long so that the MMU invariants are maintained.
  33 
  34 /***** ALL TIMES ARE IN SECS!!!!!!! *****/
  35 
  36 // this is the "interface"
  37 class G1MMUTracker: public CHeapObj {
  38 protected:
  39   double          _time_slice;
  40   double          _max_gc_time; // this is per time slice
  41 
  42 public:
  43   G1MMUTracker(double time_slice, double max_gc_time);
  44 
  45   virtual void add_pause(double start, double end, bool gc_thread) = 0;
  46   virtual double longest_pause(double current_time) = 0;
  47   virtual double when_sec(double current_time, double pause_time) = 0;
  48 
  49   double max_gc_time() {
  50     return _max_gc_time;


 116   int                   _no_entries;
 117 
 118   inline int trim_index(int index) {
 119     return (index + QueueLength) % QueueLength;
 120   }
 121 
 122   void remove_expired_entries(double current_time);
 123   double calculate_gc_time(double current_time);
 124 
 125   double longest_pause_internal(double current_time);
 126   double when_internal(double current_time, double pause_time);
 127 
 128 public:
 129   G1MMUTrackerQueue(double time_slice, double max_gc_time);
 130 
 131   virtual void add_pause(double start, double end, bool gc_thread);
 132 
 133   virtual double longest_pause(double current_time);
 134   virtual double when_sec(double current_time, double pause_time);
 135 };
 136 
 137 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1MMUTRACKER_HPP