On 12/21/11 5:15 PM, Måns Rullgård wrote:
John Brooks<[email protected]>  writes:

On Wed, Dec 21, 2011 at 6:09 AM, Janne Grunau<[email protected]>  wrote:
On 2011-12-21 01:55:15 +0000, Måns Rullgård wrote:
Janne Grunau<[email protected]>  writes:

I'm using sched_getaffinity() now and will do some tests how threading
scales up to number of cores * 2. I can test on dualcore with and
without hyper threading and quadcore.


sched_getaffinity doesn't exist on OS X, and might not on BSD. Those
will probably require a fallback to sysconf.

It is Linux specific, but _SC_NPROCESSORS_ONLN is not standard either.
BSD seems to have it, though, so perhaps OSX does too.


Macosx and freebsd have a sysctl for that:

int mib[4];
size_t len = sizeof(numCPU);

/* set the mib for hw.ncpu */
mib[0] = CTL_HW;
mib[1] = HW_AVAILCPU;  // alternatively, try HW_NCPU;

/* get the number of CPUs from the system */
sysctl(mib, 2, &numCPU, &len, NULL, 0);

according to a post to stack overflow.

lu
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to