< prev index next >

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

Print this page




  26 #define SHARE_VM_GC_G1_G1MMUTRACKER_HPP
  27 
  28 #include "gc/shared/gcId.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "utilities/debug.hpp"
  31 
  32 // Keeps track of the GC work and decides when it is OK to do GC work
  33 // and for how long so that the MMU invariants are maintained.
  34 
  35 /***** ALL TIMES ARE IN SECS!!!!!!! *****/
  36 
  37 // this is the "interface"
  38 class G1MMUTracker: public CHeapObj<mtGC> {
  39 protected:
  40   double          _time_slice;
  41   double          _max_gc_time; // this is per time slice
  42 
  43 public:
  44   G1MMUTracker(double time_slice, double max_gc_time);
  45 
  46   virtual void add_pause(double start, double end, const GCId& gcId) = 0;
  47   virtual double when_sec(double current_time, double pause_time) = 0;
  48 
  49   double max_gc_time() {
  50     return _max_gc_time;
  51   }
  52 
  53   inline bool now_max_gc(double current_time) {
  54     return when_sec(current_time, max_gc_time()) < 0.00001;
  55   }
  56 
  57   inline double when_max_gc_sec(double current_time) {
  58     return when_sec(current_time, max_gc_time());
  59   }
  60 
  61   inline jlong when_max_gc_ms(double current_time) {
  62     double when = when_max_gc_sec(current_time);
  63     return (jlong) (when * 1000.0);
  64   }
  65 
  66   inline jlong when_ms(double current_time, double pause_time) {


 110   // the oldest entry in the event that +G1UseFixedWindowMMUTracker, thus
 111   // potentially violating MMU specs for some time thereafter.
 112 
 113   G1MMUTrackerQueueElem _array[QueueLength];
 114   int                   _head_index;
 115   int                   _tail_index;
 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 when_internal(double current_time, double pause_time);
 126 
 127 public:
 128   G1MMUTrackerQueue(double time_slice, double max_gc_time);
 129 
 130   virtual void add_pause(double start, double end, const GCId& gcId);
 131 
 132   virtual double when_sec(double current_time, double pause_time);
 133 };
 134 
 135 #endif // SHARE_VM_GC_G1_G1MMUTRACKER_HPP


  26 #define SHARE_VM_GC_G1_G1MMUTRACKER_HPP
  27 
  28 #include "gc/shared/gcId.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "utilities/debug.hpp"
  31 
  32 // Keeps track of the GC work and decides when it is OK to do GC work
  33 // and for how long so that the MMU invariants are maintained.
  34 
  35 /***** ALL TIMES ARE IN SECS!!!!!!! *****/
  36 
  37 // this is the "interface"
  38 class G1MMUTracker: public CHeapObj<mtGC> {
  39 protected:
  40   double          _time_slice;
  41   double          _max_gc_time; // this is per time slice
  42 
  43 public:
  44   G1MMUTracker(double time_slice, double max_gc_time);
  45 
  46   virtual void add_pause(double start, double end) = 0;
  47   virtual double when_sec(double current_time, double pause_time) = 0;
  48 
  49   double max_gc_time() {
  50     return _max_gc_time;
  51   }
  52 
  53   inline bool now_max_gc(double current_time) {
  54     return when_sec(current_time, max_gc_time()) < 0.00001;
  55   }
  56 
  57   inline double when_max_gc_sec(double current_time) {
  58     return when_sec(current_time, max_gc_time());
  59   }
  60 
  61   inline jlong when_max_gc_ms(double current_time) {
  62     double when = when_max_gc_sec(current_time);
  63     return (jlong) (when * 1000.0);
  64   }
  65 
  66   inline jlong when_ms(double current_time, double pause_time) {


 110   // the oldest entry in the event that +G1UseFixedWindowMMUTracker, thus
 111   // potentially violating MMU specs for some time thereafter.
 112 
 113   G1MMUTrackerQueueElem _array[QueueLength];
 114   int                   _head_index;
 115   int                   _tail_index;
 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 when_internal(double current_time, double pause_time);
 126 
 127 public:
 128   G1MMUTrackerQueue(double time_slice, double max_gc_time);
 129 
 130   virtual void add_pause(double start, double end);
 131 
 132   virtual double when_sec(double current_time, double pause_time);
 133 };
 134 
 135 #endif // SHARE_VM_GC_G1_G1MMUTRACKER_HPP
< prev index next >