From: duane@hunch.zk3.dec.com (Andrew Duane USG)
Subject: Re: How I get cpu total number
Date: Mon, 13 May 2002 12:08:25 GMT [thread overview]
Message-ID: <Z0OD8.8$kR1.339109@cacnews.cac.cpqcorp.net> (raw)
In-Reply-To: abhu8a$j0o$1@news1.kornet.net
In article <abhu8a$j0o$1@news1.kornet.net> "Atom" <aiguru@linux.co.kr> writes:
>How I get cpu total number and online cpu number by table() system call on
>tru64..
Table() isn't what you want; getsysinfo() is. From the getsysinfo man page:
GSI_CPUS_IN_BOX
Returns the actual number of CPUs present in the current machine in the
form of an int.
buffer
int
nbytes
Specifies the size of the user buffer.
My code snippet:
#include <sys/sysinfo.h>
int ncpus;
getsysinfo(GSI_CPUS_IN_BOX, (char *)&ncpus, sizeof(ncpus), 0L, 0L, 0L);
printf ("There are %d CPUs in this box\n", ncpus);
--
Andrew L. Duane (JOT-7) duane@zk3.dec.com
Compaq Computer Corporation (603)-884-1294
110 Spit Brook Road
M/S ZKO3-3/U14
Nashua, NH 03062-2698
prev parent reply other threads:[~2002-05-13 12:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-11 2:21 How I get cpu total number Atom
2002-05-13 12:08 ` Andrew Duane USG [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox