< prev index next >

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

Print this page
rev 9402 : dihop-changes
rev 9403 : imported patch sihop-thomas-review
rev 9404 : [mq]: erik-jmasa-review

*** 24,78 **** #ifndef SHARE_VM_GC_G1_G1IHOPCONTROL_HPP #define SHARE_VM_GC_G1_G1IHOPCONTROL_HPP #include "memory/allocation.hpp" - #include "utilities/numberSeq.hpp" ! class G1Predictions; ! ! // Manages the decision about the threshold when concurrent marking should start. class G1IHOPControl : public CHeapObj<mtGC> { protected: ! double _ihop_percent; size_t _target_occupancy; // Initialize an instance with the initial IHOP value in percent and the target // occupancy. The target occupancy is the number of bytes when marking should // be finished and reclaim started. G1IHOPControl(double initial_ihop_percent, size_t target_occupancy); public: virtual ~G1IHOPControl() { } ! // Get the current marking threshold in bytes. virtual size_t get_conc_mark_start_threshold() = 0; ! // Update information about recent time during which allocations happened, ! // how many allocations happened and an additional safety buffer. virtual void update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) = 0; ! // Update the time from the end of initial mark to the first mixed gc. ! virtual void update_time_to_mixed(double marking_length_s) = 0; virtual void print() = 0; }; class G1StaticIHOPControl : public G1IHOPControl { double _last_allocation_time_s; size_t _last_allocated_bytes; double _last_marking_length_s; public: G1StaticIHOPControl(double ihop_percent, size_t target_occupancy); ! size_t get_conc_mark_start_threshold() { return (size_t) (_ihop_percent * _target_occupancy / 100.0); } virtual void update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) { assert(allocation_time_s >= 0.0, "Allocation time must be positive but is %.3f", allocation_time_s); _last_allocation_time_s = allocation_time_s; _last_allocated_bytes = allocated_bytes; } ! virtual void update_time_to_mixed(double marking_length_s) { assert(marking_length_s > 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s); _last_marking_length_s = marking_length_s; } virtual void print(); --- 24,92 ---- #ifndef SHARE_VM_GC_G1_G1IHOPCONTROL_HPP #define SHARE_VM_GC_G1_G1IHOPCONTROL_HPP #include "memory/allocation.hpp" ! // Base class for algorithms that calculate the heap occupancy at which ! // concurrent marking should start. This heap usage threshold should be relative ! // to old gen size. class G1IHOPControl : public CHeapObj<mtGC> { protected: ! // The initial IHOP value relative to the target occupancy. ! double _initial_ihop_percent; ! // The target maximum occupancy of the heap. size_t _target_occupancy; // Initialize an instance with the initial IHOP value in percent and the target // occupancy. The target occupancy is the number of bytes when marking should // be finished and reclaim started. G1IHOPControl(double initial_ihop_percent, size_t target_occupancy); public: virtual ~G1IHOPControl() { } ! // Get the current non-young occupancy at which concurrent marking should start. virtual size_t get_conc_mark_start_threshold() = 0; ! // Update information about time during which allocations in the Java heap occurred, ! // how large these allocations were in bytes, and an additional buffer. ! // The allocations should contain any amount of space made unusable for further ! // allocation, e.g. any waste caused by TLAB allocation, space at the end of ! // humongous objects that can not be used for allocation, etc. ! // Together with the target occupancy, this additional buffer should contain the ! // difference between old gen size and total heap size at the start of reclamation, ! // and space required for that reclamation. virtual void update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) = 0; ! // Update the time spent in the mutator beginning from the end of initial mark to ! // the first mixed gc. ! virtual void update_marking_length(double marking_length_s) = 0; virtual void print() = 0; }; + // The returned concurrent mark starting occupancy threshold is a fixed value + // relative to the maximum heap size. class G1StaticIHOPControl : public G1IHOPControl { + // Most recent complete mutator allocation period in seconds. double _last_allocation_time_s; + // Amount of bytes allocated during _last_allocation_time_s. size_t _last_allocated_bytes; + // Most recent mutator time between the end of initial mark to the start of the + // first mixed gc. double _last_marking_length_s; public: G1StaticIHOPControl(double ihop_percent, size_t target_occupancy); ! size_t get_conc_mark_start_threshold() { return (size_t) (_initial_ihop_percent * _target_occupancy / 100.0); } virtual void update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) { assert(allocation_time_s >= 0.0, "Allocation time must be positive but is %.3f", allocation_time_s); _last_allocation_time_s = allocation_time_s; _last_allocated_bytes = allocated_bytes; } ! virtual void update_marking_length(double marking_length_s) { assert(marking_length_s > 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s); _last_marking_length_s = marking_length_s; } virtual void print();
< prev index next >