[Gambas-user] Faster compiler
Benoît Minisini
g4mba5 at gmail.com
Sun Jan 31 23:28:52 CET 2021
Le 31/01/2021 à 23:14, Brian G a écrit :
> Does This Help or is it required for a common call for all systems?
>
> #include <sys/sysinfo.h>
> //raspi-os and linux
> https://linux.die.net/man/3/get_nprocs
> int main(int argc, char *argv[])
> {
> printf("This system has %d processors configured and "
> "%d processors available.\n",
> get_nprocs_conf(), get_nprocs());
> return 0;
> }
>
> /******************************************************************************/
> // https://www.freebsd.org/cgi/man.cgi?sysctl(3)
> // FreeBSD,OpenBsd,MacOSX Get systctl
> // #include <sys/types.h>
> // #include <sys/sysctl.h>
> // int mib[2], ncpus;
> // size_t len;
> //
> // mib[0] = CTL_HW;
> // mib[1] = HW_NCPU;
> // len = sizeof(ncpus);
> // sysctl(mib, 2, &ncpus, &len, NULL, 0);
> ~
>
> Thank You
> Brian G
>
Yes. I knew for Linux, but didn't for BSD*. Then I can add a
System.CpuCount property!
--
Benoît Minisini
More information about the User
mailing list