Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/shared/hSpaceCounters.hpp @ 10147:cc70cbbd422e
8012695: Assertion message displays %u and %s text instead of actual values
Summary: USe err_msg() to create a proper assertion message.
Reviewed-by: twisti, coleenp, iklam
author | hseigel |
---|---|
date | Wed, 24 Apr 2013 09:00:04 -0400 |
parents | db9981fd3124 |
children | de88570fabfc |
rev | line source |
---|---|
3289 | 1 /* |
6842
b9a9ed0f8eeb
7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents:
6197
diff
changeset
|
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
3289 | 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_IMPLEMENTATION_SHARED_HSPACECOUNTERS_HPP | |
26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_HSPACECOUNTERS_HPP | |
27 | |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6842
diff
changeset
|
28 #include "utilities/macros.hpp" |
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6842
diff
changeset
|
29 #if INCLUDE_ALL_GCS |
3289 | 30 #include "gc_implementation/shared/generationCounters.hpp" |
31 #include "memory/generation.hpp" | |
32 #include "runtime/perfData.hpp" | |
8001
db9981fd3124
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
6842
diff
changeset
|
33 #endif // INCLUDE_ALL_GCS |
3289 | 34 |
35 // A HSpaceCounter is a holder class for performance counters | |
36 // that track a collections (logical spaces) in a heap; | |
37 | |
38 class HeapSpaceUsedHelper; | |
39 class G1SpaceMonitoringSupport; | |
40 | |
6197 | 41 class HSpaceCounters: public CHeapObj<mtGC> { |
3289 | 42 friend class VMStructs; |
43 | |
44 private: | |
45 PerfVariable* _capacity; | |
46 PerfVariable* _used; | |
47 | |
48 // Constant PerfData types don't need to retain a reference. | |
49 // However, it's a good idea to document them here. | |
50 | |
51 char* _name_space; | |
52 | |
53 public: | |
54 | |
55 HSpaceCounters(const char* name, int ordinal, size_t max_size, | |
56 size_t initial_capacity, GenerationCounters* gc); | |
57 | |
58 ~HSpaceCounters() { | |
6197 | 59 if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC); |
3289 | 60 } |
61 | |
62 inline void update_capacity(size_t v) { | |
63 _capacity->set_value(v); | |
64 } | |
65 | |
66 inline void update_used(size_t v) { | |
67 _used->set_value(v); | |
68 } | |
69 | |
70 debug_only( | |
71 // for security reasons, we do not allow arbitrary reads from | |
72 // the counters as they may live in shared memory. | |
73 jlong used() { | |
74 return _used->get_value(); | |
75 } | |
76 jlong capacity() { | |
77 return _used->get_value(); | |
78 } | |
79 ) | |
80 | |
81 inline void update_all(size_t capacity, size_t used) { | |
82 update_capacity(capacity); | |
83 update_used(used); | |
84 } | |
85 | |
86 const char* name_space() const { return _name_space; } | |
87 }; | |
88 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_HSPACECOUNTERS_HPP |