Closed
Bug 25981
Opened 25 years ago
Closed 24 years ago
Need a function to return the number of CPUs
Categories
(NSPR :: NSPR, enhancement, P3)
Tracking
(Not tracked)
RESOLVED
FIXED
4.1
People
(Reporter: wtc, Assigned: larryh)
Details
We should add a function that returns the number of CPUs in the system. Right now, one can obtain this information by calling the private function PR_GetThreadAffinityMask() and then counting the number of 1's in the returned mask. However, this is a private function and moreover this function is not implemented in the pthreads version. We can either add a new function or add a new command option to PR_GetSystemInfo().
Reporter | ||
Updated•25 years ago
|
Severity: normal → enhancement
Status: NEW → ASSIGNED
Adding an option to PR_GetSystemInfo should be fine. The precise meaning of "number of cpus" should be made clear. For example, the number of processors available to run user applications may be different from the number of physical processors online.
Reporter | ||
Comment 2•24 years ago
|
||
Reassigned to larryh as a NSPR 4.1 feature.
Status: ASSIGNED → NEW
QA Contact: srinivas → wtc
Target Milestone: --- → 4.1
Assignee | ||
Updated•24 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 4•24 years ago
|
||
Checking in parts: Checking in pr/include/prsystem.h; /cvsroot/mozilla/nsprpub/pr/include/prsystem.h,v <-- prsystem.h new revision: 3.5; previous revision: 3.4 done Checking in pr/src/misc/prsystem.c; /cvsroot/mozilla/nsprpub/pr/src/misc/prsystem.c,v <-- prsystem.c new revision: 3.7; previous revision: 3.6 done Checking in pr/tests/system.c; /cvsroot/mozilla/nsprpub/pr/tests/system.c,v <-- system.c new revision: 3.3; previous revision: 3.2 done
Assignee | ||
Comment 5•24 years ago
|
||
Fix my OS/2 implementation using fix inspired by Skip Nizinski <snizinski@us.ibm.com>. Thanks for the help, Skip Checking in prsystem.c; /cvsroot/mozilla/nsprpub/pr/src/misc/prsystem.c,v <-- prsystem.c new revision: 3.8; previous revision: 3.7
Reporter | ||
Comment 6•24 years ago
|
||
I changed _SC_NPROC_CONF to _SC_NPROC_ONLN (we want the number of online processors). Made the code compile on HP-UX 10 and SINIX. /cvsroot/mozilla/nsprpub/pr/src/misc/prsystem.c, revision 3.9 I found that sysconf(_SC_NPROC_ONLN) (and _SC_NPROC_CONF too) fails with EINVAL on SINIX-Z 5.42 and SINIX-N 5.43. I don't know why. So I backed out the SINIX (aka RELIANTUNIX) stuff. /cvsroot/mozilla/nsprpub/pr/src/misc/prsystem.c, revision 3.10
Comment 7•24 years ago
|
||
Ops, my linux compile died because a missing #endif in #ifndef ... (version 3.8): #if defined(OS2) #define INCL_DOS #include <os2.h> /* define the required constant if it is not already defined in the headers */ #ifndef QSV_NUMPROCESSORS #define QSV_NUMPROCESSORS 26 #endif ADD AN #endif HERE OR WE'RE IN TROUBLE ...
Assignee | ||
Comment 8•24 years ago
|
||
added missing #endif
Assignee | ||
Comment 9•24 years ago
|
||
marking as fixed.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 10•24 years ago
|
||
Hans Lambermont <hans@blender.nl> pointed out that BSD-derived systems (BSD/OS, FreeBSD, NetBSD, OpenBSD, and MacOS X) use sysctl() to get the number of processors. /cvsroot/mozilla/nsprpub/pr/src/misc/prsystem.c, revision 3.14
Assignee | ||
Comment 11•24 years ago
|
||
Hard code the returned value to 1 for MacOS.
You need to log in
before you can comment on or make changes to this bug.
Description
•