85 } |
85 } |
86 |
86 |
87 // Compute desired plab size and latch result for later |
87 // Compute desired plab size and latch result for later |
88 // use. This should be called once at the end of parallel |
88 // use. This should be called once at the end of parallel |
89 // scavenge; it clears the sensor accumulators. |
89 // scavenge; it clears the sensor accumulators. |
90 void PLABStats::adjust_desired_plab_sz() { |
90 void PLABStats::adjust_desired_plab_sz(uint no_of_gc_workers) { |
91 assert(ResizePLAB, "Not set"); |
91 assert(ResizePLAB, "Not set"); |
92 if (_allocated == 0) { |
92 if (_allocated == 0) { |
93 assert(_unused == 0, |
93 assert(_unused == 0, |
94 err_msg("Inconsistency in PLAB stats: " |
94 err_msg("Inconsistency in PLAB stats: " |
95 "_allocated: "SIZE_FORMAT", " |
95 "_allocated: "SIZE_FORMAT", " |
105 TargetPLABWastePct); |
105 TargetPLABWastePct); |
106 if (target_refills == 0) { |
106 if (target_refills == 0) { |
107 target_refills = 1; |
107 target_refills = 1; |
108 } |
108 } |
109 _used = _allocated - _wasted - _unused; |
109 _used = _allocated - _wasted - _unused; |
110 size_t plab_sz = _used/(target_refills*ParallelGCThreads); |
110 size_t plab_sz = _used/(target_refills*no_of_gc_workers); |
111 if (PrintPLAB) gclog_or_tty->print(" (plab_sz = %d ", plab_sz); |
111 if (PrintPLAB) gclog_or_tty->print(" (plab_sz = %d ", plab_sz); |
112 // Take historical weighted average |
112 // Take historical weighted average |
113 _filter.sample(plab_sz); |
113 _filter.sample(plab_sz); |
114 // Clip from above and below, and align to object boundary |
114 // Clip from above and below, and align to object boundary |
115 plab_sz = MAX2(min_size(), (size_t)_filter.average()); |
115 plab_sz = MAX2(min_size(), (size_t)_filter.average()); |