[Gambas-user] Faster compiler

Brian G brian at westwoodsvcs.com
Sun Jan 31 23:14:41 CET 2021


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

----- Original Message -----
From: "Benoît Minisini" <g4mba5 at gmail.com>
To: "Gambas mailing list" <user at lists.gambas-basic.org>
Sent: Sunday, January 31, 2021 6:47:48 PM
Subject: Re: [Gambas-user] Faster compiler

Le 31/01/2021 à 19:32, Brian G a écrit :
> on linux use nproc return number of processors ie. cores and virtual cores
> 
> bsd use as root dmesg | grep -i cpu
> 
> Thank You
> Brian G
> 

Yes. I need system calls on all systems.

-- 
Benoît Minisini

----[ http://gambaswiki.org/wiki/doc/netiquette ]----


More information about the User mailing list