public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Cong <vo.chi.cong@is.titech.ac.jp>
To: me@rupey.net
Cc: bharathi@lantana.tenet.res.in, gcc-help@gcc.gnu.org
Subject: Re: how to get the number of CPUs?
Date: Sat, 06 Jul 2002 21:24:00 -0000	[thread overview]
Message-ID: <20020707.132410.39168269.vo.chi.cong@is.titech.ac.jp> (raw)
In-Reply-To: <616BE6A276E3714788D2AC35C40CD18D5EC4E6@whale.softwire.co.uk>

Thank you, your code works for me!

But, when I do man sysconf on Linux, it show no infomation
about _SC_NPROCESSORS_CONF as manpage on Solaris do. However, looking
at <unistd.h>, they're there!

Cong

> > On Thu, 4 Jul 2002, Cong wrote:
> > > number of CPUs on each of them. So I want to get the number of CPUs
> >   cpu info is avilable in /proc/cpuinfo file
> >   if processor is 0 then No. of CPU is 1
> >   Explore /proc dir you will more idea :)
> 
> Or the sysconf solution - for Solaris, at least, but this ought to be
> portable:
> 
>     #include <stdio.h>
>     #include <unistd.h>
> 
>     int main(void)
>     {
>         long nProcessorsConfigured = sysconf(_SC_NPROCESSORS_CONF);
>         long nProcessorsOnline     = sysconf(_SC_NPROCESSORS_ONLN);
> 
> Try 'man sysconf' to get a list of supported sysconf arguments and their
> descriptions on your platform.
> 

  reply	other threads:[~2002-07-07  4:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <616BE6A276E3714788D2AC35C40CD18D6C01F7@whale.softwire.co.uk>
2002-07-04  5:52 ` Rupert Wood
2002-07-06 21:24   ` Cong [this message]
2002-07-13  8:00     ` Nix
2002-07-04 13:11 Dockeen
     [not found] <1025766825.11142.ezmlm@gcc.gnu.org>
2002-07-04  4:45 ` Cong
2002-07-04  5:30   ` Bharathi S

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020707.132410.39168269.vo.chi.cong@is.titech.ac.jp \
    --to=vo.chi.cong@is.titech.ac.jp \
    --cc=bharathi@lantana.tenet.res.in \
    --cc=gcc-help@gcc.gnu.org \
    --cc=me@rupey.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).