445
446 static hrtime_t first_hrtime = 0;
447 static const hrtime_t hrtime_hz = 1000*1000*1000;
448 const int LOCK_BUSY = 1;
449 const int LOCK_FREE = 0;
450 const int LOCK_INVALID = -1;
451 static volatile hrtime_t max_hrtime = 0;
452 static volatile int max_hrtime_lock = LOCK_FREE; // Update counter with LSB as lock-in-progress
453
454
455 void os::Solaris::initialize_system_info() {
456 _processor_count = sysconf(_SC_NPROCESSORS_CONF);
457 _processors_online = sysconf (_SC_NPROCESSORS_ONLN);
458 _physical_memory = (julong)sysconf(_SC_PHYS_PAGES) * (julong)sysconf(_SC_PAGESIZE);
459 }
460
461 int os::active_processor_count() {
462 int online_cpus = sysconf(_SC_NPROCESSORS_ONLN);
463 pid_t pid = getpid();
464 psetid_t pset = PS_NONE;
465 // Are we running in a processor set?
466 if (pset_bind(PS_QUERY, P_PID, pid, &pset) == 0) {
467 if (pset != PS_NONE) {
468 uint_t pset_cpus;
469 // Query number of cpus in processor set
470 if (pset_info(pset, NULL, &pset_cpus, NULL) == 0) {
471 assert(pset_cpus > 0 && pset_cpus <= online_cpus, "sanity check");
472 _processors_online = pset_cpus;
473 return pset_cpus;
474 }
475 }
476 }
477 // Otherwise return number of online cpus
478 return online_cpus;
479 }
480
481 static bool find_processors_in_pset(psetid_t pset,
482 processorid_t** id_array,
483 uint_t* id_length) {
484 bool result = false;
485 // Find the number of processors in the processor set.
486 if (pset_info(pset, NULL, id_length, NULL) == 0) {
487 // Make up an array to hold their ids.
488 *id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length);
489 // Fill in the array with their processor ids.
490 if (pset_info(pset, NULL, id_length, *id_array) == 0) {
491 result = true;
492 }
493 }
494 return result;
495 }
496
|
445
446 static hrtime_t first_hrtime = 0;
447 static const hrtime_t hrtime_hz = 1000*1000*1000;
448 const int LOCK_BUSY = 1;
449 const int LOCK_FREE = 0;
450 const int LOCK_INVALID = -1;
451 static volatile hrtime_t max_hrtime = 0;
452 static volatile int max_hrtime_lock = LOCK_FREE; // Update counter with LSB as lock-in-progress
453
454
455 void os::Solaris::initialize_system_info() {
456 _processor_count = sysconf(_SC_NPROCESSORS_CONF);
457 _processors_online = sysconf (_SC_NPROCESSORS_ONLN);
458 _physical_memory = (julong)sysconf(_SC_PHYS_PAGES) * (julong)sysconf(_SC_PAGESIZE);
459 }
460
461 int os::active_processor_count() {
462 int online_cpus = sysconf(_SC_NPROCESSORS_ONLN);
463 pid_t pid = getpid();
464 psetid_t pset = PS_NONE;
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) {
467 uint_t pset_cpus;
468 // Query the number of cpus available to us.
469 if (pset_info(pset, NULL, &pset_cpus, NULL) == 0) {
470 assert(pset_cpus > 0 && pset_cpus <= online_cpus, "sanity check");
471 _processors_online = pset_cpus;
472 return pset_cpus;
473 }
474 }
475 // Otherwise return number of online cpus
476 return online_cpus;
477 }
478
479 static bool find_processors_in_pset(psetid_t pset,
480 processorid_t** id_array,
481 uint_t* id_length) {
482 bool result = false;
483 // Find the number of processors in the processor set.
484 if (pset_info(pset, NULL, id_length, NULL) == 0) {
485 // Make up an array to hold their ids.
486 *id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length);
487 // Fill in the array with their processor ids.
488 if (pset_info(pset, NULL, id_length, *id_array) == 0) {
489 result = true;
490 }
491 }
492 return result;
493 }
494
|