258 (Abstract_VM_Version::vm_build_number() & 0xFF);
259 }
260
261
262 void VM_Version_init() {
263 VM_Version::initialize();
264
265 #ifndef PRODUCT
266 if (PrintMiscellaneous && Verbose) {
267 char buf[512];
268 os::print_cpu_info(tty, buf, sizeof(buf));
269 }
270 #endif
271 }
272
273 unsigned int Abstract_VM_Version::nof_parallel_worker_threads(
274 unsigned int num,
275 unsigned int den,
276 unsigned int switch_pt) {
277 if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
278 assert(ParallelGCThreads == 0, "Default ParallelGCThreads is not 0");
279 // For very large machines, there are diminishing returns
280 // for large numbers of worker threads. Instead of
281 // hogging the whole system, use a fraction of the workers for every
282 // processor after the first 8. For example, on a 72 cpu machine
283 // and a chosen fraction of 5/8
284 // use 8 + (72 - 8) * (5/8) == 48 worker threads.
285 unsigned int ncpus = (unsigned int) os::active_processor_count();
286 return (ncpus <= switch_pt) ?
287 ncpus :
288 (switch_pt + ((ncpus - switch_pt) * num) / den);
289 } else {
290 return ParallelGCThreads;
291 }
292 }
293
294 unsigned int Abstract_VM_Version::calc_parallel_worker_threads() {
295 return nof_parallel_worker_threads(5, 8, 8);
296 }
297
298
299 // Does not set the _initialized flag since it is
300 // a global flag.
301 unsigned int Abstract_VM_Version::parallel_worker_threads() {
302 if (!_parallel_worker_threads_initialized) {
303 if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
304 _parallel_worker_threads = VM_Version::calc_parallel_worker_threads();
305 } else {
306 _parallel_worker_threads = ParallelGCThreads;
307 }
308 _parallel_worker_threads_initialized = true;
309 }
310 return _parallel_worker_threads;
311 }
|
258 (Abstract_VM_Version::vm_build_number() & 0xFF);
259 }
260
261
262 void VM_Version_init() {
263 VM_Version::initialize();
264
265 #ifndef PRODUCT
266 if (PrintMiscellaneous && Verbose) {
267 char buf[512];
268 os::print_cpu_info(tty, buf, sizeof(buf));
269 }
270 #endif
271 }
272
273 unsigned int Abstract_VM_Version::nof_parallel_worker_threads(
274 unsigned int num,
275 unsigned int den,
276 unsigned int switch_pt) {
277 if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
278 assert(_parallel_worker_threads_initialized ||
279 ParallelGCThreads == 0, "Default ParallelGCThreads is not 0");
280 // For very large machines, there are diminishing returns
281 // for large numbers of worker threads. Instead of
282 // hogging the whole system, use a fraction of the workers for every
283 // processor after the first 8. For example, on a 72 cpu machine
284 // and a chosen fraction of 5/8
285 // use 8 + (72 - 8) * (5/8) == 48 worker threads.
286 unsigned int ncpus = (unsigned int) os::active_processor_count();
287 return (ncpus <= switch_pt) ?
288 ncpus :
289 (switch_pt + ((ncpus - switch_pt) * num) / den);
290 } else {
291 return ParallelGCThreads;
292 }
293 }
294
295 unsigned int Abstract_VM_Version::calc_parallel_worker_threads() {
296 return nof_parallel_worker_threads(5, 8, 8);
297 }
298
299
300 // Does not set the _initialized flag since it is
301 // a global flag.
302 unsigned int Abstract_VM_Version::parallel_worker_threads() {
303 if (!_parallel_worker_threads_initialized) {
304 if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
305 _parallel_worker_threads = VM_Version::calc_parallel_worker_threads();
306 } else {
307 _parallel_worker_threads = ParallelGCThreads;
308 }
309 _parallel_worker_threads_initialized = true;
310 }
311 return _parallel_worker_threads;
312 }
313
314 void Abstract_VM_Version::FinalParallelGCThreads_test() {
315 // This consistency check should only be made if the user has not set
316 // a value on the command line and a ergonomically determined value
317 // is used (i.e., _parallel_worker_threads_initialized is true).
318 if (FLAG_IS_DEFAULT(ParallelGCThreads) && _parallel_worker_threads_initialized) {
319 assert(ParallelGCThreads == VM_Version::calc_parallel_worker_threads(),
320 "ParallelGCThreads %u is different than that calculated after full VM initialization %u.",
321 ParallelGCThreads, VM_Version::calc_parallel_worker_threads());
322 }
323 }
324
|