Mercurial > hg > truffle
comparison src/os/solaris/vm/os_solaris.cpp @ 387:fad66fdcb7fc
6673124: Runtime.availableProcessors / os::active_processor_count wrong if unused processor sets exist
Reviewed-by: acorn, dholmes
author | xlu |
---|---|
date | Mon, 06 Oct 2008 11:39:34 -0700 |
parents | 1ee8caae33af |
children | 67e8b4d06369 |
comparison
equal
deleted
inserted
replaced
386:f1ecf9191140 | 387:fad66fdcb7fc |
---|---|
460 | 460 |
461 int os::active_processor_count() { | 461 int os::active_processor_count() { |
462 int online_cpus = sysconf(_SC_NPROCESSORS_ONLN); | 462 int online_cpus = sysconf(_SC_NPROCESSORS_ONLN); |
463 pid_t pid = getpid(); | 463 pid_t pid = getpid(); |
464 psetid_t pset = PS_NONE; | 464 psetid_t pset = PS_NONE; |
465 // Are we running in a processor set? | 465 // Are we running in a processor set or is there any processor set around? |
466 if (pset_bind(PS_QUERY, P_PID, pid, &pset) == 0) { | 466 if (pset_bind(PS_QUERY, P_PID, pid, &pset) == 0) { |
467 if (pset != PS_NONE) { | 467 uint_t pset_cpus; |
468 uint_t pset_cpus; | 468 // Query the number of cpus available to us. |
469 // Query number of cpus in processor set | 469 if (pset_info(pset, NULL, &pset_cpus, NULL) == 0) { |
470 if (pset_info(pset, NULL, &pset_cpus, NULL) == 0) { | 470 assert(pset_cpus > 0 && pset_cpus <= online_cpus, "sanity check"); |
471 assert(pset_cpus > 0 && pset_cpus <= online_cpus, "sanity check"); | 471 _processors_online = pset_cpus; |
472 _processors_online = pset_cpus; | 472 return pset_cpus; |
473 return pset_cpus; | |
474 } | |
475 } | 473 } |
476 } | 474 } |
477 // Otherwise return number of online cpus | 475 // Otherwise return number of online cpus |
478 return online_cpus; | 476 return online_cpus; |
479 } | 477 } |