6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/shared/threadLocalAllocBuffer.inline.hpp"
27 #include "logging/log.hpp"
28 #include "memory/resourceArea.hpp"
29 #include "memory/universe.hpp"
30 #include "oops/oop.inline.hpp"
31 #include "runtime/thread.inline.hpp"
32 #include "runtime/threadSMR.hpp"
33 #include "utilities/copy.hpp"
34
35 size_t ThreadLocalAllocBuffer::_max_size = 0;
36 int ThreadLocalAllocBuffer::_reserve_for_allocation_prefetch = 0;
37 unsigned int ThreadLocalAllocBuffer::_target_refills = 0;
38
39 size_t ThreadLocalAllocBuffer::remaining() {
40 if (end() == NULL) {
41 return 0;
42 }
43
44 return pointer_delta(hard_end(), top());
45 }
443 _allocating_threads, _total_refills, _max_refills,
444 _total_slow_allocations, _max_slow_allocations, waste_percent,
445 _total_gc_waste * HeapWordSize, _max_gc_waste * HeapWordSize,
446 _total_slow_refill_waste * HeapWordSize, _max_slow_refill_waste * HeapWordSize,
447 _total_fast_refill_waste * HeapWordSize, _max_fast_refill_waste * HeapWordSize);
448
449 if (UsePerfData) {
450 _perf_allocating_threads ->set_value(_allocating_threads);
451 _perf_total_refills ->set_value(_total_refills);
452 _perf_max_refills ->set_value(_max_refills);
453 _perf_total_allocations ->set_value(_total_allocations);
454 _perf_total_gc_waste ->set_value(_total_gc_waste);
455 _perf_max_gc_waste ->set_value(_max_gc_waste);
456 _perf_total_slow_refill_waste ->set_value(_total_slow_refill_waste);
457 _perf_max_slow_refill_waste ->set_value(_max_slow_refill_waste);
458 _perf_total_fast_refill_waste ->set_value(_total_fast_refill_waste);
459 _perf_max_fast_refill_waste ->set_value(_max_fast_refill_waste);
460 _perf_total_slow_allocations ->set_value(_total_slow_allocations);
461 _perf_max_slow_allocations ->set_value(_max_slow_allocations);
462 }
463 }
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/shared/collectedHeap.hpp"
27 #include "gc/shared/threadLocalAllocBuffer.inline.hpp"
28 #include "logging/log.hpp"
29 #include "memory/resourceArea.hpp"
30 #include "memory/universe.hpp"
31 #include "oops/oop.inline.hpp"
32 #include "runtime/thread.inline.hpp"
33 #include "runtime/threadSMR.hpp"
34 #include "utilities/copy.hpp"
35
36 size_t ThreadLocalAllocBuffer::_max_size = 0;
37 int ThreadLocalAllocBuffer::_reserve_for_allocation_prefetch = 0;
38 unsigned int ThreadLocalAllocBuffer::_target_refills = 0;
39
40 size_t ThreadLocalAllocBuffer::remaining() {
41 if (end() == NULL) {
42 return 0;
43 }
44
45 return pointer_delta(hard_end(), top());
46 }
444 _allocating_threads, _total_refills, _max_refills,
445 _total_slow_allocations, _max_slow_allocations, waste_percent,
446 _total_gc_waste * HeapWordSize, _max_gc_waste * HeapWordSize,
447 _total_slow_refill_waste * HeapWordSize, _max_slow_refill_waste * HeapWordSize,
448 _total_fast_refill_waste * HeapWordSize, _max_fast_refill_waste * HeapWordSize);
449
450 if (UsePerfData) {
451 _perf_allocating_threads ->set_value(_allocating_threads);
452 _perf_total_refills ->set_value(_total_refills);
453 _perf_max_refills ->set_value(_max_refills);
454 _perf_total_allocations ->set_value(_total_allocations);
455 _perf_total_gc_waste ->set_value(_total_gc_waste);
456 _perf_max_gc_waste ->set_value(_max_gc_waste);
457 _perf_total_slow_refill_waste ->set_value(_total_slow_refill_waste);
458 _perf_max_slow_refill_waste ->set_value(_max_slow_refill_waste);
459 _perf_total_fast_refill_waste ->set_value(_total_fast_refill_waste);
460 _perf_max_fast_refill_waste ->set_value(_max_fast_refill_waste);
461 _perf_total_slow_allocations ->set_value(_total_slow_allocations);
462 _perf_max_slow_allocations ->set_value(_max_slow_allocations);
463 }
464 }
465
466 size_t ThreadLocalAllocBuffer::end_reserve() {
467 size_t reserve_size = Universe::heap()->tlab_alloc_reserve();
468 return MAX2(reserve_size, (size_t)_reserve_for_allocation_prefetch);
469 }
|