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_used;
37   uint   _regions_freed;
38 
39 public:
G1EvacuationInfo()40   G1EvacuationInfo() :
41     _collectionset_regions(0), _allocation_regions(0), _collectionset_used_before(0),
42     _collectionset_used_after(0), _alloc_regions_used_before(0),
43     _bytes_used(0), _regions_freed(0) { }
44 
set_collectionset_regions(uint collectionset_regions)45   void set_collectionset_regions(uint collectionset_regions) {
46     _collectionset_regions = collectionset_regions;
47   }
48 
set_allocation_regions(uint allocation_regions)49   void set_allocation_regions(uint allocation_regions) {
50     _allocation_regions = allocation_regions;
51   }
52 
set_collectionset_used_before(size_t used)53   void set_collectionset_used_before(size_t used) {
54     _collectionset_used_before = used;
55   }
56 
increment_collectionset_used_after(size_t used)57   void increment_collectionset_used_after(size_t used) {
58     _collectionset_used_after += used;
59   }
60 
set_alloc_regions_used_before(size_t used)61   void set_alloc_regions_used_before(size_t used) {
62     _alloc_regions_used_before = used;
63   }
64 
set_bytes_used(size_t used)65   void set_bytes_used(size_t used) {
66     _bytes_used = used;
67   }
68 
set_regions_freed(uint freed)69   void set_regions_freed(uint freed) {
70     _regions_freed += freed;
71   }
72 
collectionset_regions()73   uint   collectionset_regions()     { return _collectionset_regions; }
allocation_regions()74   uint   allocation_regions()        { return _allocation_regions; }
collectionset_used_before()75   size_t collectionset_used_before() { return _collectionset_used_before; }
collectionset_used_after()76   size_t collectionset_used_after()  { return _collectionset_used_after; }
alloc_regions_used_before()77   size_t alloc_regions_used_before() { return _alloc_regions_used_before; }
bytes_used()78   size_t bytes_used()                { return _bytes_used; }
regions_freed()79   uint   regions_freed()             { return _regions_freed; }
80 };
81 
82 #endif // SHARE_GC_G1_G1EVACUATIONINFO_HPP
83