Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp @ 3285:49a67202bc67
7011855: G1: non-product flag to artificially grow the heap
Summary: It introduces non-product cmd line parameter G1DummyRegionsPerGC which indicates how many "dummy" regions to allocate at the end of each GC. This allows the G1 heap to grow artificially and makes concurrent marking cycles more frequent irrespective of what the application that is running is doing. The dummy regions will be found totally empty during cleanup so this parameter can also be used to stress the concurrent cleanup operation.
Reviewed-by: brutisso, johnc
author | tonyp |
---|---|
date | Tue, 19 Apr 2011 15:46:59 -0400 |
parents | a181f3a124dd |
children | f08d439fab8c |
rev | line source |
---|---|
0 | 1 /* |
2365
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CONCURRENTMARKSWEEPTHREAD_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CONCURRENTMARKSWEEPTHREAD_HPP | |
27 | |
28 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp" | |
29 #include "gc_implementation/shared/concurrentGCThread.hpp" | |
30 #ifdef TARGET_OS_FAMILY_linux | |
31 # include "thread_linux.inline.hpp" | |
32 #endif | |
33 #ifdef TARGET_OS_FAMILY_solaris | |
34 # include "thread_solaris.inline.hpp" | |
35 #endif | |
36 #ifdef TARGET_OS_FAMILY_windows | |
37 # include "thread_windows.inline.hpp" | |
38 #endif | |
39 | |
0 | 40 class ConcurrentMarkSweepGeneration; |
41 class CMSCollector; | |
42 | |
2365
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
43 // The Concurrent Mark Sweep GC Thread |
0 | 44 class ConcurrentMarkSweepThread: public ConcurrentGCThread { |
45 friend class VMStructs; | |
46 friend class ConcurrentMarkSweepGeneration; // XXX should remove friendship | |
47 friend class CMSCollector; | |
48 public: | |
49 virtual void run(); | |
50 | |
51 private: | |
52 static ConcurrentMarkSweepThread* _cmst; | |
53 static CMSCollector* _collector; | |
54 static SurrogateLockerThread* _slt; | |
55 static SurrogateLockerThread::SLT_msg_type _sltBuffer; | |
56 static Monitor* _sltMonitor; | |
57 | |
58 static bool _should_terminate; | |
59 | |
60 enum CMS_flag_type { | |
61 CMS_nil = NoBits, | |
62 CMS_cms_wants_token = nth_bit(0), | |
63 CMS_cms_has_token = nth_bit(1), | |
64 CMS_vm_wants_token = nth_bit(2), | |
65 CMS_vm_has_token = nth_bit(3) | |
66 }; | |
67 | |
68 static int _CMS_flag; | |
69 | |
70 static bool CMS_flag_is_set(int b) { return (_CMS_flag & b) != 0; } | |
71 static bool set_CMS_flag(int b) { return (_CMS_flag |= b) != 0; } | |
72 static bool clear_CMS_flag(int b) { return (_CMS_flag &= ~b) != 0; } | |
73 void sleepBeforeNextCycle(); | |
74 | |
75 // CMS thread should yield for a young gen collection, direct allocation, | |
76 // and iCMS activity. | |
77 static char _pad_1[64 - sizeof(jint)]; // prevent cache-line sharing | |
78 static volatile jint _pending_yields; | |
79 static volatile jint _pending_decrements; // decrements to _pending_yields | |
80 static char _pad_2[64 - sizeof(jint)]; // prevent cache-line sharing | |
81 | |
82 // Tracing messages, enabled by CMSTraceThreadState. | |
83 static inline void trace_state(const char* desc); | |
84 | |
2365
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
85 static volatile int _icms_disabled; // a counter to track #iCMS disable & enable |
0 | 86 static volatile bool _should_run; // iCMS may run |
87 static volatile bool _should_stop; // iCMS should stop | |
88 | |
89 // debugging | |
90 void verify_ok_to_terminate() const PRODUCT_RETURN; | |
91 | |
92 public: | |
93 // Constructor | |
94 ConcurrentMarkSweepThread(CMSCollector* collector); | |
95 | |
96 static void makeSurrogateLockerThread(TRAPS); | |
97 static SurrogateLockerThread* slt() { return _slt; } | |
98 | |
99 // Tester | |
100 bool is_ConcurrentGC_thread() const { return true; } | |
101 | |
102 static void threads_do(ThreadClosure* tc); | |
103 | |
104 // Printing | |
105 void print_on(outputStream* st) const; | |
106 void print() const { print_on(tty); } | |
107 static void print_all_on(outputStream* st); | |
108 static void print_all() { print_all_on(tty); } | |
109 | |
110 // Returns the CMS Thread | |
111 static ConcurrentMarkSweepThread* cmst() { return _cmst; } | |
112 static CMSCollector* collector() { return _collector; } | |
113 | |
114 // Create and start the CMS Thread, or stop it on shutdown | |
115 static ConcurrentMarkSweepThread* start(CMSCollector* collector); | |
116 static void stop(); | |
117 static bool should_terminate() { return _should_terminate; } | |
118 | |
119 // Synchronization using CMS token | |
120 static void synchronize(bool is_cms_thread); | |
121 static void desynchronize(bool is_cms_thread); | |
122 static bool vm_thread_has_cms_token() { | |
123 return CMS_flag_is_set(CMS_vm_has_token); | |
124 } | |
125 static bool cms_thread_has_cms_token() { | |
126 return CMS_flag_is_set(CMS_cms_has_token); | |
127 } | |
128 static bool vm_thread_wants_cms_token() { | |
129 return CMS_flag_is_set(CMS_vm_wants_token); | |
130 } | |
131 static bool cms_thread_wants_cms_token() { | |
132 return CMS_flag_is_set(CMS_cms_wants_token); | |
133 } | |
134 | |
135 // Wait on CMS lock until the next synchronous GC | |
1887
cd3ef3fd20dd
6992998: CMSWaitDuration=0 causes hangs with +ExplicitGCInvokesConcurrent
ysr
parents:
1837
diff
changeset
|
136 // or given timeout, whichever is earlier. A timeout value |
cd3ef3fd20dd
6992998: CMSWaitDuration=0 causes hangs with +ExplicitGCInvokesConcurrent
ysr
parents:
1837
diff
changeset
|
137 // of 0 indicates that there is no upper bound on the wait time. |
cd3ef3fd20dd
6992998: CMSWaitDuration=0 causes hangs with +ExplicitGCInvokesConcurrent
ysr
parents:
1837
diff
changeset
|
138 // A concurrent full gc request terminates the wait. |
cd3ef3fd20dd
6992998: CMSWaitDuration=0 causes hangs with +ExplicitGCInvokesConcurrent
ysr
parents:
1837
diff
changeset
|
139 void wait_on_cms_lock(long t_millis); |
0 | 140 |
1837
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
141 // The CMS thread will yield during the work portion of its cycle |
0 | 142 // only when requested to. Both synchronous and asychronous requests |
1837
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
143 // are provided: |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
144 // (1) A synchronous request is used for young gen collections and |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
145 // for direct allocations. The requesting thread increments |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
146 // _pending_yields at the beginning of an operation, and decrements |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
147 // _pending_yields when that operation is completed. |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
148 // In turn, the CMS thread yields when _pending_yields is positive, |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
149 // and continues to yield until the value reverts to 0. |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
150 // (2) An asynchronous request, on the other hand, is used by iCMS |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
151 // for the stop_icms() operation. A single yield satisfies all of |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
152 // the outstanding asynch yield requests, of which there may |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
153 // occasionally be several in close succession. To accomplish |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
154 // this, an asynch-requesting thread atomically increments both |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
155 // _pending_yields and _pending_decrements. An asynchr requesting |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
156 // thread does not wait and "acknowledge" completion of an operation |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
157 // and deregister the request, like the synchronous version described |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
158 // above does. In turn, after yielding, the CMS thread decrements both |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
159 // _pending_yields and _pending_decrements by the value seen in |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
160 // _pending_decrements before the decrement. |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
161 // NOTE: The above scheme is isomorphic to having two request counters, |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
162 // one for async requests and one for sync requests, and for the CMS thread |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
163 // to check the sum of the two counters to decide whether it should yield |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
164 // and to clear only the async counter when it yields. However, it turns out |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
165 // to be more efficient for CMS code to just check a single counter |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
166 // _pending_yields that holds the sum (of both sync and async requests), and |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
167 // a second counter _pending_decrements that only holds the async requests, |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
168 // for greater efficiency, since in a typical CMS run, there are many more |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
169 // pontential (i.e. static) yield points than there are actual |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
170 // (i.e. dynamic) yields because of requests, which are few and far between. |
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
171 // |
0 | 172 // Note that, while "_pending_yields >= _pending_decrements" is an invariant, |
173 // we cannot easily test that invariant, since the counters are manipulated via | |
174 // atomic instructions without explicit locking and we cannot read | |
175 // the two counters atomically together: one suggestion is to | |
176 // use (for example) 16-bit counters so as to be able to read the | |
177 // two counters atomically even on 32-bit platforms. Notice that | |
1837
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
178 // the second assert in acknowledge_yield_request() below does indeed |
0 | 179 // check a form of the above invariant, albeit indirectly. |
180 | |
181 static void increment_pending_yields() { | |
182 Atomic::inc(&_pending_yields); | |
183 assert(_pending_yields >= 0, "can't be negative"); | |
184 } | |
185 static void decrement_pending_yields() { | |
186 Atomic::dec(&_pending_yields); | |
187 assert(_pending_yields >= 0, "can't be negative"); | |
188 } | |
189 static void asynchronous_yield_request() { | |
1837
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
190 assert(CMSIncrementalMode, "Currently only used w/iCMS"); |
0 | 191 increment_pending_yields(); |
192 Atomic::inc(&_pending_decrements); | |
193 assert(_pending_decrements >= 0, "can't be negative"); | |
194 } | |
195 static void acknowledge_yield_request() { | |
196 jint decrement = _pending_decrements; | |
197 if (decrement > 0) { | |
1837
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
198 assert(CMSIncrementalMode, "Currently only used w/iCMS"); |
0 | 199 // Order important to preserve: _pending_yields >= _pending_decrements |
200 Atomic::add(-decrement, &_pending_decrements); | |
201 Atomic::add(-decrement, &_pending_yields); | |
202 assert(_pending_decrements >= 0, "can't be negative"); | |
203 assert(_pending_yields >= 0, "can't be negative"); | |
204 } | |
205 } | |
206 static bool should_yield() { return _pending_yields > 0; } | |
207 | |
208 // CMS incremental mode. | |
209 static void start_icms(); // notify thread to start a quantum of work | |
210 static void stop_icms(); // request thread to stop working | |
211 void icms_wait(); // if asked to stop, wait until notified to start | |
212 | |
213 // Incremental mode is enabled globally by the flag CMSIncrementalMode. It | |
214 // must also be enabled/disabled dynamically to allow foreground collections. | |
2365
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
215 #define ICMS_ENABLING_ASSERT \ |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
216 assert((CMSIncrementalMode && _icms_disabled >= 0) || \ |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
217 (!CMSIncrementalMode && _icms_disabled <= 0), "Error") |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
218 |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
219 static inline void enable_icms() { |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
220 ICMS_ENABLING_ASSERT; |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
221 Atomic::dec(&_icms_disabled); |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
222 } |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
223 static inline void disable_icms() { |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
224 ICMS_ENABLING_ASSERT; |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
225 Atomic::inc(&_icms_disabled); |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
226 } |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
227 static inline bool icms_is_disabled() { |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
228 ICMS_ENABLING_ASSERT; |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
229 return _icms_disabled > 0; |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
230 } |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
231 static inline bool icms_is_enabled() { |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
232 return !icms_is_disabled(); |
a181f3a124dd
6987703: iCMS: Intermittent hang with gc/gctests/CallGC/CallGC01 and +ExplicitGCInvokesConcurrent
ysr
parents:
1972
diff
changeset
|
233 } |
0 | 234 }; |
235 | |
236 inline void ConcurrentMarkSweepThread::trace_state(const char* desc) { | |
237 if (CMSTraceThreadState) { | |
238 char buf[128]; | |
239 TimeStamp& ts = gclog_or_tty->time_stamp(); | |
240 if (!ts.is_updated()) { | |
241 ts.update(); | |
242 } | |
243 jio_snprintf(buf, sizeof(buf), " [%.3f: CMSThread %s] ", | |
244 ts.seconds(), desc); | |
245 buf[sizeof(buf) - 1] = '\0'; | |
246 gclog_or_tty->print(buf); | |
247 } | |
248 } | |
249 | |
1837
c99c53f07c14
6692906: CMS: parallel concurrent marking may be prone to hanging or stalling mutators for periods of time
ysr
parents:
1552
diff
changeset
|
250 // For scoped increment/decrement of (synchronous) yield requests |
0 | 251 class CMSSynchronousYieldRequest: public StackObj { |
252 public: | |
253 CMSSynchronousYieldRequest() { | |
254 ConcurrentMarkSweepThread::increment_pending_yields(); | |
255 } | |
256 ~CMSSynchronousYieldRequest() { | |
257 ConcurrentMarkSweepThread::decrement_pending_yields(); | |
258 } | |
259 }; | |
260 | |
261 // Used to emit a warning in case of unexpectedly excessive | |
262 // looping (in "apparently endless loops") in CMS code. | |
263 class CMSLoopCountWarn: public StackObj { | |
264 private: | |
265 const char* _src; | |
266 const char* _msg; | |
267 const intx _threshold; | |
268 intx _ticks; | |
269 | |
270 public: | |
271 inline CMSLoopCountWarn(const char* src, const char* msg, | |
272 const intx threshold) : | |
273 _src(src), _msg(msg), _threshold(threshold), _ticks(0) { } | |
274 | |
275 inline void tick() { | |
276 _ticks++; | |
277 if (CMSLoopWarn && _ticks % _threshold == 0) { | |
278 warning("%s has looped %d times %s", _src, _ticks, _msg); | |
279 } | |
280 } | |
281 }; | |
1972 | 282 |
283 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CONCURRENTMARKSWEEPTHREAD_HPP |