os::active_processor_count()

  • プロセッサのホットプラグイン/アウトに対応して、アクティブなCPUを取得する
//Linux版(jdk7/hotspot/src/os/linux/vm/os_linux.cpp)
int os::active_processor_count() {
  // Linux doesn't yet have a (official) notion of processor sets,
  // so just return the number of online processors.
  int online_cpus = ::sysconf(_SC_NPROCESSORS_ONLN);
  assert(online_cpus > 0 && online_cpus <= processor_count(), "sanity check");
  return online_cpus;
}