< prev index next >

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

Print this page
rev 9416 : dihop-changes
rev 9417 : imported patch sihop-thomas-review
rev 9418 : imported patch erik-jmasa-review
rev 9419 : [mq]: fix-evac-failure-needs-stats


  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_G1IHOPCONTROL_HPP
  26 #define SHARE_VM_GC_G1_G1IHOPCONTROL_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 
  30 // Base class for algorithms that calculate the heap occupancy at which
  31 // concurrent marking should start. This heap usage threshold should be relative
  32 // to old gen size.
  33 class G1IHOPControl : public CHeapObj<mtGC> {
  34  protected:
  35   // The initial IHOP value relative to the target occupancy.
  36   double _initial_ihop_percent;
  37   // The target maximum occupancy of the heap.
  38   size_t _target_occupancy;
  39 





  40   // Initialize an instance with the initial IHOP value in percent and the target
  41   // occupancy. The target occupancy is the number of bytes when marking should
  42   // be finished and reclaim started.
  43   G1IHOPControl(double initial_ihop_percent, size_t target_occupancy);




  44  public:
  45   virtual ~G1IHOPControl() { }
  46 
  47   // Get the current non-young occupancy at which concurrent marking should start.
  48   virtual size_t get_conc_mark_start_threshold() = 0;
  49 
  50   // Update information about time during which allocations in the Java heap occurred,
  51   // how large these allocations were in bytes, and an additional buffer.
  52   // The allocations should contain any amount of space made unusable for further
  53   // allocation, e.g. any waste caused by TLAB allocation, space at the end of
  54   // humongous objects that can not be used for allocation, etc.
  55   // Together with the target occupancy, this additional buffer should contain the
  56   // difference between old gen size and total heap size at the start of reclamation,
  57   // and space required for that reclamation.
  58   virtual void update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) = 0;
  59   // Update the time spent in the mutator beginning from the end of initial mark to
  60   // the first mixed gc.
  61   virtual void update_marking_length(double marking_length_s) = 0;
  62 
  63   virtual void print() = 0;
  64 };
  65 
  66 // The returned concurrent mark starting occupancy threshold is a fixed value
  67 // relative to the maximum heap size.
  68 class G1StaticIHOPControl : public G1IHOPControl {
  69   // Most recent complete mutator allocation period in seconds.
  70   double _last_allocation_time_s;
  71   // Amount of bytes allocated during _last_allocation_time_s.
  72   size_t _last_allocated_bytes;
  73   // Most recent mutator time between the end of initial mark to the start of the
  74   // first mixed gc.
  75   double _last_marking_length_s;


  76  public:
  77   G1StaticIHOPControl(double ihop_percent, size_t target_occupancy);
  78 
  79   size_t get_conc_mark_start_threshold() { return (size_t) (_initial_ihop_percent * _target_occupancy / 100.0); }
  80 
  81   virtual void update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) {
  82     assert(allocation_time_s >= 0.0, "Allocation time must be positive but is %.3f", allocation_time_s);
  83     _last_allocation_time_s = allocation_time_s;
  84     _last_allocated_bytes = allocated_bytes;
  85   }
  86 
  87   virtual void update_marking_length(double marking_length_s) {
  88    assert(marking_length_s > 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s);
  89     _last_marking_length_s = marking_length_s;
  90   }
  91 
  92   virtual void print();
  93 #ifndef PRODUCT
  94   static void test();
  95 #endif
  96 };
  97 
  98 #endif // SHARE_VM_GC_G1_G1IHOPCONTROL_HPP


  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_G1IHOPCONTROL_HPP
  26 #define SHARE_VM_GC_G1_G1IHOPCONTROL_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 
  30 // Base class for algorithms that calculate the heap occupancy at which
  31 // concurrent marking should start. This heap usage threshold should be relative
  32 // to old gen size.
  33 class G1IHOPControl : public CHeapObj<mtGC> {
  34  protected:
  35   // The initial IHOP value relative to the target occupancy.
  36   double _initial_ihop_percent;
  37   // The target maximum occupancy of the heap.
  38   size_t _target_occupancy;
  39 
  40   // Most recent complete mutator allocation period in seconds.
  41   double _last_allocation_time_s;
  42   // Amount of bytes allocated during _last_allocation_time_s.
  43   size_t _last_allocated_bytes;
  44 
  45   // Initialize an instance with the initial IHOP value in percent and the target
  46   // occupancy. The target occupancy is the number of bytes when marking should
  47   // be finished and reclaim started.
  48   G1IHOPControl(double initial_ihop_percent, size_t target_occupancy);
  49 
  50   // Most recent time from the end of the initial mark to the start of the first
  51   // mixed gc.
  52   virtual double last_marking_length_s() const = 0;
  53  public:
  54   virtual ~G1IHOPControl() { }
  55 
  56   // Get the current non-young occupancy at which concurrent marking should start.
  57   virtual size_t get_conc_mark_start_threshold() = 0;
  58 
  59   // Update information about time during which allocations in the Java heap occurred,
  60   // how large these allocations were in bytes, and an additional buffer.
  61   // The allocations should contain any amount of space made unusable for further
  62   // allocation, e.g. any waste caused by TLAB allocation, space at the end of
  63   // humongous objects that can not be used for allocation, etc.
  64   // Together with the target occupancy, this additional buffer should contain the
  65   // difference between old gen size and total heap size at the start of reclamation,
  66   // and space required for that reclamation.
  67   virtual void update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size);
  68   // Update the time spent in the mutator beginning from the end of initial mark to
  69   // the first mixed gc.
  70   virtual void update_marking_length(double marking_length_s) = 0;
  71 
  72   virtual void print();
  73 };
  74 
  75 // The returned concurrent mark starting occupancy threshold is a fixed value
  76 // relative to the maximum heap size.
  77 class G1StaticIHOPControl : public G1IHOPControl {




  78   // Most recent mutator time between the end of initial mark to the start of the
  79   // first mixed gc.
  80   double _last_marking_length_s;
  81  protected:
  82   double last_marking_length_s() const { return _last_marking_length_s; }
  83  public:
  84   G1StaticIHOPControl(double ihop_percent, size_t target_occupancy);
  85 
  86   size_t get_conc_mark_start_threshold() { return (size_t) (_initial_ihop_percent * _target_occupancy / 100.0); }
  87 






  88   virtual void update_marking_length(double marking_length_s) {
  89    assert(marking_length_s > 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s);
  90     _last_marking_length_s = marking_length_s;
  91   }
  92 

  93 #ifndef PRODUCT
  94   static void test();
  95 #endif
  96 };
  97 
  98 #endif // SHARE_VM_GC_G1_G1IHOPCONTROL_HPP
< prev index next >