Thu, 19 Jun 2014 13:31:14 +0200
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
Reviewed-by: jwilhelm, ehelin, tschatzl
sla@5237 | 1 | /* |
sla@5237 | 2 | * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
sla@5237 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
sla@5237 | 4 | * |
sla@5237 | 5 | * This code is free software; you can redistribute it and/or modify it |
sla@5237 | 6 | * under the terms of the GNU General Public License version 2 only, as |
sla@5237 | 7 | * published by the Free Software Foundation. |
sla@5237 | 8 | * |
sla@5237 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
sla@5237 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
sla@5237 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
sla@5237 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
sla@5237 | 13 | * accompanied this code). |
sla@5237 | 14 | * |
sla@5237 | 15 | * You should have received a copy of the GNU General Public License version |
sla@5237 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
sla@5237 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
sla@5237 | 18 | * |
sla@5237 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
sla@5237 | 20 | * or visit www.oracle.com if you need additional information or have any |
sla@5237 | 21 | * questions. |
sla@5237 | 22 | * |
sla@5237 | 23 | */ |
sla@5237 | 24 | |
sla@5237 | 25 | #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_GCHEAPSUMMARY_HPP |
sla@5237 | 26 | #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCHEAPSUMMARY_HPP |
sla@5237 | 27 | |
sla@5237 | 28 | #include "memory/allocation.hpp" |
ehelin@6420 | 29 | #include "memory/metaspaceChunkFreeListSummary.hpp" |
sla@5237 | 30 | |
sla@5237 | 31 | class VirtualSpaceSummary : public StackObj { |
sla@5237 | 32 | HeapWord* _start; |
sla@5237 | 33 | HeapWord* _committed_end; |
sla@5237 | 34 | HeapWord* _reserved_end; |
sla@5237 | 35 | public: |
sla@5237 | 36 | VirtualSpaceSummary() : |
sla@5237 | 37 | _start(NULL), _committed_end(NULL), _reserved_end(NULL) { } |
sla@5237 | 38 | VirtualSpaceSummary(HeapWord* start, HeapWord* committed_end, HeapWord* reserved_end) : |
sla@5237 | 39 | _start(start), _committed_end(committed_end), _reserved_end(reserved_end) { } |
sla@5237 | 40 | |
sla@5237 | 41 | HeapWord* start() const { return _start; } |
sla@5237 | 42 | HeapWord* committed_end() const { return _committed_end; } |
sla@5237 | 43 | HeapWord* reserved_end() const { return _reserved_end; } |
sla@5237 | 44 | size_t committed_size() const { return (uintptr_t)_committed_end - (uintptr_t)_start; } |
sla@5237 | 45 | size_t reserved_size() const { return (uintptr_t)_reserved_end - (uintptr_t)_start; } |
sla@5237 | 46 | }; |
sla@5237 | 47 | |
sla@5237 | 48 | class SpaceSummary : public StackObj { |
sla@5237 | 49 | HeapWord* _start; |
sla@5237 | 50 | HeapWord* _end; |
sla@5237 | 51 | size_t _used; |
sla@5237 | 52 | public: |
sla@5237 | 53 | SpaceSummary() : |
sla@5237 | 54 | _start(NULL), _end(NULL), _used(0) { } |
sla@5237 | 55 | SpaceSummary(HeapWord* start, HeapWord* end, size_t used) : |
sla@5237 | 56 | _start(start), _end(end), _used(used) { } |
sla@5237 | 57 | |
sla@5237 | 58 | HeapWord* start() const { return _start; } |
sla@5237 | 59 | HeapWord* end() const { return _end; } |
sla@5237 | 60 | size_t used() const { return _used; } |
sla@5237 | 61 | size_t size() const { return (uintptr_t)_end - (uintptr_t)_start; } |
sla@5237 | 62 | }; |
sla@5237 | 63 | |
sla@5237 | 64 | class MetaspaceSizes : public StackObj { |
ehelin@6608 | 65 | size_t _committed; |
sla@5237 | 66 | size_t _used; |
sla@5237 | 67 | size_t _reserved; |
sla@5237 | 68 | |
sla@5237 | 69 | public: |
ehelin@6608 | 70 | MetaspaceSizes() : _committed(0), _used(0), _reserved(0) {} |
ehelin@6608 | 71 | MetaspaceSizes(size_t committed, size_t used, size_t reserved) : |
ehelin@6608 | 72 | _committed(committed), _used(used), _reserved(reserved) {} |
sla@5237 | 73 | |
ehelin@6608 | 74 | size_t committed() const { return _committed; } |
sla@5237 | 75 | size_t used() const { return _used; } |
sla@5237 | 76 | size_t reserved() const { return _reserved; } |
sla@5237 | 77 | }; |
sla@5237 | 78 | |
sla@5237 | 79 | class GCHeapSummary; |
sla@5237 | 80 | class PSHeapSummary; |
sla@5237 | 81 | |
sla@5237 | 82 | class GCHeapSummaryVisitor { |
sla@5237 | 83 | public: |
sla@5237 | 84 | virtual void visit(const GCHeapSummary* heap_summary) const = 0; |
sla@5237 | 85 | virtual void visit(const PSHeapSummary* heap_summary) const {} |
sla@5237 | 86 | }; |
sla@5237 | 87 | |
sla@5237 | 88 | class GCHeapSummary : public StackObj { |
sla@5237 | 89 | VirtualSpaceSummary _heap; |
sla@5237 | 90 | size_t _used; |
sla@5237 | 91 | |
sla@5237 | 92 | public: |
sla@5237 | 93 | GCHeapSummary() : |
sla@5237 | 94 | _heap(), _used(0) { } |
sla@5237 | 95 | GCHeapSummary(VirtualSpaceSummary& heap_space, size_t used) : |
sla@5237 | 96 | _heap(heap_space), _used(used) { } |
sla@5237 | 97 | |
sla@5237 | 98 | const VirtualSpaceSummary& heap() const { return _heap; } |
sla@5237 | 99 | size_t used() const { return _used; } |
sla@5237 | 100 | |
sla@5237 | 101 | virtual void accept(GCHeapSummaryVisitor* visitor) const { |
sla@5237 | 102 | visitor->visit(this); |
sla@5237 | 103 | } |
sla@5237 | 104 | }; |
sla@5237 | 105 | |
sla@5237 | 106 | class PSHeapSummary : public GCHeapSummary { |
sla@5237 | 107 | VirtualSpaceSummary _old; |
sla@5237 | 108 | SpaceSummary _old_space; |
sla@5237 | 109 | VirtualSpaceSummary _young; |
sla@5237 | 110 | SpaceSummary _eden; |
sla@5237 | 111 | SpaceSummary _from; |
sla@5237 | 112 | SpaceSummary _to; |
sla@5237 | 113 | public: |
sla@5237 | 114 | PSHeapSummary(VirtualSpaceSummary& heap_space, size_t heap_used, VirtualSpaceSummary old, SpaceSummary old_space, VirtualSpaceSummary young, SpaceSummary eden, SpaceSummary from, SpaceSummary to) : |
sla@5237 | 115 | GCHeapSummary(heap_space, heap_used), _old(old), _old_space(old_space), _young(young), _eden(eden), _from(from), _to(to) { } |
sla@5237 | 116 | const VirtualSpaceSummary& old() const { return _old; } |
sla@5237 | 117 | const SpaceSummary& old_space() const { return _old_space; } |
sla@5237 | 118 | const VirtualSpaceSummary& young() const { return _young; } |
sla@5237 | 119 | const SpaceSummary& eden() const { return _eden; } |
sla@5237 | 120 | const SpaceSummary& from() const { return _from; } |
sla@5237 | 121 | const SpaceSummary& to() const { return _to; } |
sla@5237 | 122 | |
sla@5237 | 123 | virtual void accept(GCHeapSummaryVisitor* visitor) const { |
sla@5237 | 124 | visitor->visit(this); |
sla@5237 | 125 | } |
sla@5237 | 126 | }; |
sla@5237 | 127 | |
sla@5237 | 128 | class MetaspaceSummary : public StackObj { |
ehelin@6416 | 129 | size_t _capacity_until_GC; |
sla@5237 | 130 | MetaspaceSizes _meta_space; |
sla@5237 | 131 | MetaspaceSizes _data_space; |
sla@5237 | 132 | MetaspaceSizes _class_space; |
ehelin@6420 | 133 | MetaspaceChunkFreeListSummary _metaspace_chunk_free_list_summary; |
ehelin@6420 | 134 | MetaspaceChunkFreeListSummary _class_chunk_free_list_summary; |
sla@5237 | 135 | |
sla@5237 | 136 | public: |
ehelin@6420 | 137 | MetaspaceSummary() : |
ehelin@6420 | 138 | _capacity_until_GC(0), |
ehelin@6420 | 139 | _meta_space(), |
ehelin@6420 | 140 | _data_space(), |
ehelin@6420 | 141 | _class_space(), |
ehelin@6420 | 142 | _metaspace_chunk_free_list_summary(), |
ehelin@6420 | 143 | _class_chunk_free_list_summary() |
ehelin@6420 | 144 | {} |
ehelin@6420 | 145 | MetaspaceSummary(size_t capacity_until_GC, |
ehelin@6420 | 146 | const MetaspaceSizes& meta_space, |
ehelin@6420 | 147 | const MetaspaceSizes& data_space, |
ehelin@6420 | 148 | const MetaspaceSizes& class_space, |
ehelin@6420 | 149 | const MetaspaceChunkFreeListSummary& metaspace_chunk_free_list_summary, |
ehelin@6420 | 150 | const MetaspaceChunkFreeListSummary& class_chunk_free_list_summary) : |
ehelin@6420 | 151 | _capacity_until_GC(capacity_until_GC), |
ehelin@6420 | 152 | _meta_space(meta_space), |
ehelin@6420 | 153 | _data_space(data_space), |
ehelin@6420 | 154 | _class_space(class_space), |
ehelin@6420 | 155 | _metaspace_chunk_free_list_summary(metaspace_chunk_free_list_summary), |
ehelin@6420 | 156 | _class_chunk_free_list_summary(class_chunk_free_list_summary) |
ehelin@6420 | 157 | {} |
sla@5237 | 158 | |
ehelin@6416 | 159 | size_t capacity_until_GC() const { return _capacity_until_GC; } |
sla@5237 | 160 | const MetaspaceSizes& meta_space() const { return _meta_space; } |
sla@5237 | 161 | const MetaspaceSizes& data_space() const { return _data_space; } |
sla@5237 | 162 | const MetaspaceSizes& class_space() const { return _class_space; } |
ehelin@6420 | 163 | |
ehelin@6420 | 164 | const MetaspaceChunkFreeListSummary& metaspace_chunk_free_list_summary() const { |
ehelin@6420 | 165 | return _metaspace_chunk_free_list_summary; |
ehelin@6420 | 166 | } |
ehelin@6420 | 167 | |
ehelin@6420 | 168 | const MetaspaceChunkFreeListSummary& class_chunk_free_list_summary() const { |
ehelin@6420 | 169 | return _class_chunk_free_list_summary; |
ehelin@6420 | 170 | } |
ehelin@6420 | 171 | |
sla@5237 | 172 | }; |
sla@5237 | 173 | |
sla@5237 | 174 | #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GCHEAPSUMMARY_HPP |