Find the answer to your Linux question:
Results 1 to 4 of 4
Hello, I'm looking for a function in c to get the processor type and number of processors of the machine in c / c++. I know I can read it ...
  1. #1
    Just Joined!
    Join Date
    May 2008
    Location
    Barcelona
    Posts
    5

    Question Get processor type in c/c++

    Hello,

    I'm looking for a function in c to get the processor type and number of processors of the machine in c / c++.

    I know I can read it from /proc/cpuinfo, but it would be great if there was a function that just do it like GetSystemInfo() in windows systems.

    thanks,

    Rafa

  2. #2
    Linux Newbie danielsmw's Avatar
    Join Date
    Nov 2006
    Location
    Clemson, SC / Charleston, SC
    Posts
    110
    Don't forget that you also have arch and uname depending on the info you need. Can't think of much else right now...
    Registered Linux User: #479567
    Asking a question? Read this page first.
    Now... sudo make me a sandwich.
    ratiocinativeroot.blogspot.com

  3. #3
    Just Joined!
    Join Date
    May 2008
    Location
    Barcelona
    Posts
    5
    Well... thanks Daniel, but I'm looking for a c/c++ function, not a system command.

    Thanks anyway...

  4. #4
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Location
    Canada, Prince Edward Island
    Posts
    714
    You could try an assembler routine that calls cpuid....

    If you google linux cpuid this you'll see plenty of examples on how to integrate it into c/c++

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...