src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/gc_implementation/g1

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

Print this page




 119 // everytime the heap size changes.
 120 //
 121 // NewSize and MaxNewSize override NewRatio. So, NewRatio is ignored if it is
 122 // combined with either NewSize or MaxNewSize. (A warning message is printed.)
 123 class G1YoungGenSizer : public CHeapObj<mtGC> {
 124 private:
 125   enum SizerKind {
 126     SizerDefaults,
 127     SizerNewSizeOnly,
 128     SizerMaxNewSizeOnly,
 129     SizerMaxAndNewSize,
 130     SizerNewRatio
 131   };
 132   SizerKind _sizer_kind;
 133   uint _min_desired_young_length;
 134   uint _max_desired_young_length;
 135   bool _adaptive_size;
 136   uint calculate_default_min_length(uint new_number_of_heap_regions);
 137   uint calculate_default_max_length(uint new_number_of_heap_regions);
 138 




 139 public:
 140   G1YoungGenSizer();




 141   void heap_size_changed(uint new_number_of_heap_regions);
 142   uint min_desired_young_length() {
 143     return _min_desired_young_length;
 144   }
 145   uint max_desired_young_length() {
 146     return _max_desired_young_length;
 147   }
 148   bool adaptive_young_list_length() {
 149     return _adaptive_size;
 150   }
 151 };
 152 
 153 class G1CollectorPolicy: public CollectorPolicy {
 154 private:
 155   // either equal to the number of parallel threads, if ParallelGCThreads
 156   // has been set, or 1 otherwise
 157   int _parallel_gc_threads;
 158 
 159   // The number of GC threads currently active.
 160   uintx _no_of_gc_threads;
 161 
 162   enum SomePrivateConstants {
 163     NumPrevPausesForHeuristics = 10
 164   };
 165 
 166   G1MMUTracker* _mmu_tracker;
 167 

 168   void initialize_flags();
 169 
 170   void initialize_all() {
 171     initialize_flags();
 172     initialize_size_info();
 173   }
 174 
 175   CollectionSetChooser* _collectionSetChooser;
 176 
 177   double _full_collection_start_sec;
 178   uint   _cur_collection_pause_used_regions_at_start;
 179 
 180   // These exclude marking times.
 181   TruncatedSeq* _recent_gc_times_ms;
 182 
 183   TruncatedSeq* _concurrent_mark_remark_times_ms;
 184   TruncatedSeq* _concurrent_mark_cleanup_times_ms;
 185 
 186   TraceGen0TimeData _trace_gen0_time_data;
 187   TraceGen1TimeData _trace_gen1_time_data;
 188 
 189   double _stop_world_start;
 190 
 191   // indicates whether we are in young or mixed GC mode
 192   bool _gcs_are_young;
 193 
 194   uint _young_list_target_length;


 914                                HeapRegion* head,
 915                                HeapRegion* tail) {
 916     _recorded_survivor_regions = regions;
 917     _recorded_survivor_head    = head;
 918     _recorded_survivor_tail    = tail;
 919   }
 920 
 921   uint recorded_survivor_regions() {
 922     return _recorded_survivor_regions;
 923   }
 924 
 925   void record_thread_age_table(ageTable* age_table) {
 926     _survivors_age_table.merge_par(age_table);
 927   }
 928 
 929   void update_max_gc_locker_expansion();
 930 
 931   // Calculates survivor space parameters.
 932   void update_survivors_policy();
 933 

 934 };
 935 
 936 // This should move to some place more general...
 937 
 938 // If we have "n" measurements, and we've kept track of their "sum" and the
 939 // "sum_of_squares" of the measurements, this returns the variance of the
 940 // sequence.
 941 inline double variance(int n, double sum_of_squares, double sum) {
 942   double n_d = (double)n;
 943   double avg = sum/n_d;
 944   return (sum_of_squares - 2.0 * avg * sum + n_d * avg * avg) / n_d;
 945 }
 946 
 947 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP


 119 // everytime the heap size changes.
 120 //
 121 // NewSize and MaxNewSize override NewRatio. So, NewRatio is ignored if it is
 122 // combined with either NewSize or MaxNewSize. (A warning message is printed.)
 123 class G1YoungGenSizer : public CHeapObj<mtGC> {
 124 private:
 125   enum SizerKind {
 126     SizerDefaults,
 127     SizerNewSizeOnly,
 128     SizerMaxNewSizeOnly,
 129     SizerMaxAndNewSize,
 130     SizerNewRatio
 131   };
 132   SizerKind _sizer_kind;
 133   uint _min_desired_young_length;
 134   uint _max_desired_young_length;
 135   bool _adaptive_size;
 136   uint calculate_default_min_length(uint new_number_of_heap_regions);
 137   uint calculate_default_max_length(uint new_number_of_heap_regions);
 138 
 139   // Update the given values for minimum and maximum young gen length in regions
 140   // given the number of heap regions depending on the kind of sizing algorithm.
 141   void recalculate_min_max_young_length(uint number_of_heap_regions, uint* min_young_length, uint* max_young_length);
 142 
 143 public:
 144   G1YoungGenSizer();
 145   // Calculate the maximum length of the young gen given the number of regions
 146   // depending on the sizing algorithm.
 147   uint max_young_length(uint number_of_heap_regions);
 148 
 149   void heap_size_changed(uint new_number_of_heap_regions);
 150   uint min_desired_young_length() {
 151     return _min_desired_young_length;
 152   }
 153   uint max_desired_young_length() {
 154     return _max_desired_young_length;
 155   }
 156   bool adaptive_young_list_length() {
 157     return _adaptive_size;
 158   }
 159 };
 160 
 161 class G1CollectorPolicy: public CollectorPolicy {
 162 private:
 163   // either equal to the number of parallel threads, if ParallelGCThreads
 164   // has been set, or 1 otherwise
 165   int _parallel_gc_threads;
 166 
 167   // The number of GC threads currently active.
 168   uintx _no_of_gc_threads;
 169 
 170   enum SomePrivateConstants {
 171     NumPrevPausesForHeuristics = 10
 172   };
 173 
 174   G1MMUTracker* _mmu_tracker;
 175 
 176   void initialize_alignments();
 177   void initialize_flags();
 178 





 179   CollectionSetChooser* _collectionSetChooser;
 180 
 181   double _full_collection_start_sec;
 182   uint   _cur_collection_pause_used_regions_at_start;
 183 
 184   // These exclude marking times.
 185   TruncatedSeq* _recent_gc_times_ms;
 186 
 187   TruncatedSeq* _concurrent_mark_remark_times_ms;
 188   TruncatedSeq* _concurrent_mark_cleanup_times_ms;
 189 
 190   TraceGen0TimeData _trace_gen0_time_data;
 191   TraceGen1TimeData _trace_gen1_time_data;
 192 
 193   double _stop_world_start;
 194 
 195   // indicates whether we are in young or mixed GC mode
 196   bool _gcs_are_young;
 197 
 198   uint _young_list_target_length;


 918                                HeapRegion* head,
 919                                HeapRegion* tail) {
 920     _recorded_survivor_regions = regions;
 921     _recorded_survivor_head    = head;
 922     _recorded_survivor_tail    = tail;
 923   }
 924 
 925   uint recorded_survivor_regions() {
 926     return _recorded_survivor_regions;
 927   }
 928 
 929   void record_thread_age_table(ageTable* age_table) {
 930     _survivors_age_table.merge_par(age_table);
 931   }
 932 
 933   void update_max_gc_locker_expansion();
 934 
 935   // Calculates survivor space parameters.
 936   void update_survivors_policy();
 937 
 938   virtual void post_heap_initialize();
 939 };
 940 
 941 // This should move to some place more general...
 942 
 943 // If we have "n" measurements, and we've kept track of their "sum" and the
 944 // "sum_of_squares" of the measurements, this returns the variance of the
 945 // sequence.
 946 inline double variance(int n, double sum_of_squares, double sum) {
 947   double n_d = (double)n;
 948   double avg = sum/n_d;
 949   return (sum_of_squares - 2.0 * avg * sum + n_d * avg * avg) / n_d;
 950 }
 951 
 952 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP
src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File