| 1 | /* |
| 2 | * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 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 | #ifndef SHARE_GC_G1_G1EVACUATIONINFO_HPP |
| 26 | #define SHARE_GC_G1_G1EVACUATIONINFO_HPP |
| 27 | |
| 28 | #include "memory/allocation.hpp" |
| 29 | |
| 30 | class G1EvacuationInfo : public StackObj { |
| 31 | uint _collectionset_regions; |
| 32 | uint _allocation_regions; |
| 33 | size_t _collectionset_used_before; |
| 34 | size_t _collectionset_used_after; |
| 35 | size_t _alloc_regions_used_before; |
| 36 | size_t _bytes_copied; |
| 37 | uint _regions_freed; |
| 38 | |
| 39 | public: |
| 40 | G1EvacuationInfo() : _collectionset_regions(0), _allocation_regions(0), _collectionset_used_before(0), |
| 41 | _collectionset_used_after(0), _alloc_regions_used_before(0), |
| 42 | _bytes_copied(0), _regions_freed(0) { } |
| 43 | |
| 44 | void set_collectionset_regions(uint collectionset_regions) { |
| 45 | _collectionset_regions = collectionset_regions; |
| 46 | } |
| 47 | |
| 48 | void set_allocation_regions(uint allocation_regions) { |
| 49 | _allocation_regions = allocation_regions; |
| 50 | } |
| 51 | |
| 52 | void set_collectionset_used_before(size_t used) { |
| 53 | _collectionset_used_before = used; |
| 54 | } |
| 55 | |
| 56 | void increment_collectionset_used_after(size_t used) { |
| 57 | _collectionset_used_after += used; |
| 58 | } |
| 59 | |
| 60 | void set_alloc_regions_used_before(size_t used) { |
| 61 | _alloc_regions_used_before = used; |
| 62 | } |
| 63 | |
| 64 | void set_bytes_copied(size_t copied) { |
| 65 | _bytes_copied = copied; |
| 66 | } |
| 67 | |
| 68 | void set_regions_freed(uint freed) { |
| 69 | _regions_freed += freed; |
| 70 | } |
| 71 | |
| 72 | uint collectionset_regions() { return _collectionset_regions; } |
| 73 | uint allocation_regions() { return _allocation_regions; } |
| 74 | size_t collectionset_used_before() { return _collectionset_used_before; } |
| 75 | size_t collectionset_used_after() { return _collectionset_used_after; } |
| 76 | size_t alloc_regions_used_before() { return _alloc_regions_used_before; } |
| 77 | size_t bytes_copied() { return _bytes_copied; } |
| 78 | uint regions_freed() { return _regions_freed; } |
| 79 | }; |
| 80 | |
| 81 | #endif // SHARE_GC_G1_G1EVACUATIONINFO_HPP |
| 82 | |