1 /*
2  * Copyright (c) 2013, 2015, 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_VM_GC_G1_EVACUATIONINFO_HPP
26 #define SHARE_VM_GC_G1_EVACUATIONINFO_HPP
27 
28 #include "memory/allocation.hpp"
29 
30 class EvacuationInfo : 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:
EvacuationInfo()40   EvacuationInfo() : _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 
set_collectionset_regions(uint collectionset_regions)44   void set_collectionset_regions(uint collectionset_regions) {
45     _collectionset_regions = collectionset_regions;
46   }
47 
set_allocation_regions(uint allocation_regions)48   void set_allocation_regions(uint allocation_regions) {
49     _allocation_regions = allocation_regions;
50   }
51 
set_collectionset_used_before(size_t used)52   void set_collectionset_used_before(size_t used) {
53     _collectionset_used_before = used;
54   }
55 
increment_collectionset_used_after(size_t used)56   void increment_collectionset_used_after(size_t used) {
57     _collectionset_used_after += used;
58   }
59 
set_alloc_regions_used_before(size_t used)60   void set_alloc_regions_used_before(size_t used) {
61     _alloc_regions_used_before = used;
62   }
63 
set_bytes_copied(size_t copied)64   void set_bytes_copied(size_t copied) {
65     _bytes_copied = copied;
66   }
67 
set_regions_freed(uint freed)68   void set_regions_freed(uint freed) {
69     _regions_freed += freed;
70   }
71 
collectionset_regions()72   uint   collectionset_regions()     { return _collectionset_regions; }
allocation_regions()73   uint   allocation_regions()        { return _allocation_regions; }
collectionset_used_before()74   size_t collectionset_used_before() { return _collectionset_used_before; }
collectionset_used_after()75   size_t collectionset_used_after()  { return _collectionset_used_after; }
alloc_regions_used_before()76   size_t alloc_regions_used_before() { return _alloc_regions_used_before; }
bytes_copied()77   size_t bytes_copied()              { return _bytes_copied; }
regions_freed()78   uint   regions_freed()             { return _regions_freed; }
79 };
80 
81 #endif // SHARE_VM_GC_G1_EVACUATIONINFO_HPP
82