Re: Finding number of processors
Re: Finding number of processors
- Subject: Re: Finding number of processors
- From: Chris Ridd <email@hidden>
- Date: Wed, 16 Mar 2005 19:04:58 +0000
On 16/3/05 6:46 pm, Chris Ridd <email@hidden> wrote:
> On 16/3/05 6:38 pm, Michael Koehmstedt <email@hidden> wrote:
>
>> Hello all,
>>
>> How can I determine how many processors are present in the computer?
>
> Try sysctlbyname("hw.ncpus", ...). The function has a man page.
Spot the mistake. Anyway, this code snippet works:
int val = 0;
size_t sval = sizeof(int);
if (sysctlbyname("hw.ncpu", &val, &sval, NULL, 0) == 0)
printf("There are %d CPUs.\n", val);
Cheers,
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden