49 double recent_gc_overhead = _analytics->recent_avg_pause_time_ratio() * 100.0; |
49 double recent_gc_overhead = _analytics->recent_avg_pause_time_ratio() * 100.0; |
50 double last_gc_overhead = _analytics->last_pause_time_ratio() * 100.0; |
50 double last_gc_overhead = _analytics->last_pause_time_ratio() * 100.0; |
51 assert(GCTimeRatio > 0, |
51 assert(GCTimeRatio > 0, |
52 "we should have set it to a default value set_g1_gc_flags() " |
52 "we should have set it to a default value set_g1_gc_flags() " |
53 "if a user set it to 0"); |
53 "if a user set it to 0"); |
54 const double gc_overhead_perc = 100.0 * (1.0 / (1.0 + GCTimeRatio)); |
54 const double gc_overhead_percent = 100.0 * (1.0 / (1.0 + GCTimeRatio)); |
55 |
55 |
56 double threshold = gc_overhead_perc; |
56 double threshold = gc_overhead_percent; |
57 size_t expand_bytes = 0; |
57 size_t expand_bytes = 0; |
58 |
58 |
59 // If the heap is at less than half its maximum size, scale the threshold down, |
59 // If the heap is at less than half its maximum size, scale the threshold down, |
60 // to a limit of 1. Thus the smaller the heap is, the more likely it is to expand, |
60 // to a limit of 1. Thus the smaller the heap is, the more likely it is to expand, |
61 // though the scaling code will likely keep the increase small. |
61 // though the scaling code will likely keep the increase small. |
105 if (committed_bytes < InitialHeapSize / 4) { |
105 if (committed_bytes < InitialHeapSize / 4) { |
106 expand_bytes = (InitialHeapSize - committed_bytes) / 2; |
106 expand_bytes = (InitialHeapSize - committed_bytes) / 2; |
107 } else { |
107 } else { |
108 double const MinScaleDownFactor = 0.2; |
108 double const MinScaleDownFactor = 0.2; |
109 double const MaxScaleUpFactor = 2; |
109 double const MaxScaleUpFactor = 2; |
110 double const StartScaleDownAt = gc_overhead_perc; |
110 double const StartScaleDownAt = gc_overhead_percent; |
111 double const StartScaleUpAt = gc_overhead_perc * 1.5; |
111 double const StartScaleUpAt = gc_overhead_percent * 1.5; |
112 double const ScaleUpRange = gc_overhead_perc * 2.0; |
112 double const ScaleUpRange = gc_overhead_percent * 2.0; |
113 |
113 |
114 double ratio_delta; |
114 double ratio_delta; |
115 if (filled_history_buffer) { |
115 if (filled_history_buffer) { |
116 ratio_delta = recent_gc_overhead - threshold; |
116 ratio_delta = recent_gc_overhead - threshold; |
117 } else { |
117 } else { |