aboutsummaryrefslogtreecommitdiff
path: root/m4/tuklib_cpucores.m4 (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2022-10-20tuklib_cpucores: Use HW_NCPUONLINE on OpenBSD.Lasse Collin1-0/+5
On OpenBSD the number of cores online is often less than what HW_NCPU would return because OpenBSD disables simultaneous multi-threading (SMT) by default. Thanks to Christian Weisgerber.
2020-02-24tuklib: Omit an unneeded <sys/types.h> from a tests.Lasse Collin1-1/+0
tuklib_cpucores.c and tuklib_physmem.c don't include <sys/types.h> even via other files in this package, so clearly that header isn't needed in the tests either (no one has reported build problems due to a missing header in a .c file).
2016-10-24tuklib_cpucores: Add support for sched_getaffinity().Lasse Collin1-1/+29
It's available in glibc (GNU/Linux, GNU/kFreeBSD). It's better than sysconf(_SC_NPROCESSORS_ONLN) because sched_getaffinity() gives the number of cores available to the process instead of the total number of cores online. As a side effect, this commit fixes a bug on GNU/kFreeBSD where configure would detect the FreeBSD-specific cpuset_getaffinity() but it wouldn't actually work because on GNU/kFreeBSD it requires using -lfreebsd-glue when linking. Now the glibc-specific function will be used instead. Thanks to Sebastian Andrzej Siewior for the original patch and testing.
2015-03-27Fix CPU core count detection on QNX.Lasse Collin1-4/+11
It tried to use sysctl() on QNX but - it broke the build because sysctl() needs -lsocket on QNX; - sysctl() doesn't work for detecting the core count on QNX even if it compiled. sysconf() works. An alternative would have been to use QNX-specific SYSPAGE_ENTRY(num_cpu) from <sys/syspage.h>. Thanks to Ole André Vadla Ravnås.
2015-02-10tuklib_cpucores: Use cpuset_getaffinity() on FreeBSD if available.Lasse Collin1-1/+22
In FreeBSD, cpuset_getaffinity() is the preferred way to get the number of available cores. Thanks to Rui Paulo for the patch. I edited it slightly, but hopefully I didn't break anything.
2013-08-03Windows: Add Windows support to tuklib_cpucores().Lasse Collin1-2/+17
It is used for Cygwin too. I'm not sure if that is a good or bad idea. Thanks to Vincent Torri.
2010-05-10Updates to tuklib_physmem and tuklib_cpucores.Lasse Collin1-6/+27
Don't use #error to generate compile error, because some compilers actually don't take it as an error. This fixes tuklib_physmem on IRIX. Fix incorrect error check for sysconf() return values. Add AIX, HP-UX, and Tru64 specific code to detect the amount RAM. Add HP-UX specific code to detect the number of CPU cores. Thanks a lot to Peter O'Gorman for initial patches, testing, and debugging these fixes.
2010-01-12Add IRIX-specific code to tuklib_physmem and tuklib_cpucores.Lasse Collin1-2/+9
This is untested but it will get tested soon and, if needed, fixed before 5.0.0. Thanks to Stuart Shelton.
2009-11-20Update tuklib_cpucores.m4 and tuklib_physmem.m4 from tuklib,Lasse Collin1-13/+18
which now use AC_CACHE_CHECK. Using the cache variable, configure now warns if there is no method to detect the amount of RAM and recommends using --enable-assume-ram.
2009-09-19Various changes.Lasse Collin1-34/+49
Separate a few reusable components from XZ Utils specific code. The reusable code is now in "tuklib" modules. A few more could be separated still, e.g. bswap.h. Fix some bugs in lzmainfo. Fix physmem and cpucores code on OS/2. Thanks to Elbert Pol for help. Add OpenVMS support into physmem. Add a few #ifdefs to ease building XZ Utils on OpenVMS. Thanks to Jouk Jansen for the original patch.
2009-08-29Fix sysctl() usage.Lasse Collin1-1/+1
This fixes build on *BSDs and Darwin. Thanks to Jukka Salmi for the patches. Richard Koch reported the problem too.
2009-03-18Fix wrong macro names in lc_cpucores.m4 and cpucores.h.Lasse Collin1-2/+2
Thanks to Bert Wesarg.
2009-02-14Cleanups to the code that detects the amount of RAM andLasse Collin1-0/+57
the number of CPU cores. Added support for using sysinfo() on Linux systems whose libc lacks appropriate sysconf() support (at least dietlibc). The Autoconf macros were split into separate files, and CPU core count detection was moved from hardware.c to cpucores.h. The core count isn't used for anything real for now, so a problematic part in process.c was commented out.