LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-29-2005, 05:16 AM   #1
laxmi_cs
LQ Newbie
 
Registered: Aug 2005
Location: india
Posts: 7

Rep: Reputation: 1
how to get cpu information on Linux machine


Hi,

I want to display cpu information like model number, vender information, and how many cpu's are there in the system (Linux machine)

Is there any system call ? or /proc/cpuinfo is the only way

And also how get information regarding controllers and adapters installed on system(Linux machine) using any system call



Thanks and regards
laxmi
 
Old 08-29-2005, 05:22 AM   #2
Nathanael
Member
 
Registered: May 2004
Location: Karlsruhe, Germany
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940

Rep: Reputation: 33
cat /proc/cpuinfo
cat /proc/meminfo
dmesg
lspci

Welcome to LQ :-)
 
3 members found this post helpful.
Old 08-29-2005, 05:26 AM   #3
laxmi_cs
LQ Newbie
 
Registered: Aug 2005
Location: india
Posts: 7

Original Poster
Rep: Reputation: 1
How to get the same things using some system calls
 
1 members found this post helpful.
Old 08-29-2005, 05:39 AM   #4
Nathanael
Member
 
Registered: May 2004
Location: Karlsruhe, Germany
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940

Rep: Reputation: 33
do these not supply you with enough information?
what do you need it for?
does this not work?
 
Old 08-29-2005, 05:44 AM   #5
laxmi_cs
LQ Newbie
 
Registered: Aug 2005
Location: india
Posts: 7

Original Poster
Rep: Reputation: 1
Sorry, I want to store model number, vender information, and how many cpu's are there to some variables so that i can display same things on the browser
 
Old 08-29-2005, 07:09 AM   #6
seran
Member
 
Registered: Aug 2004
Location: Bangalore
Posts: 64

Rep: Reputation: 16
you can open this file /proc/cpuinfo from your C program, and store those vendor_id, model name fields in to variables. this is one way. this will require lots of string processing work.
 
Old 08-25-2006, 02:52 AM   #7
grep65535
LQ Newbie
 
Registered: Jul 2006
Location: Seattle, WA
Distribution: Fedora, RHEL, CentOS
Posts: 29

Rep: Reputation: 18
/usr/sbin/./x86info -a
 
1 members found this post helpful.
Old 08-25-2006, 10:01 AM   #8
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
x86info is hardly a standard utility.

/proc/cpuinfo is the standard interface to the kernel's information regarding CPUs. It is the best option for getting the information you want. There are several scripts on here and other sites that show how to extract the relevant information.
 
Old 08-25-2006, 10:01 AM   #9
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 08-25-2006, 10:06 AM   #10
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
i agree with Nathanael

this is why

`cat /proc/cpuinfo`
Code:
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Xeon(TM) CPU 3.06GHz
stepping        : 9
cpu MHz         : 3057.662
cache size      : 512 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid xtpr
bogomips        : 6119.81

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Xeon(TM) CPU 3.06GHz
stepping        : 9
cpu MHz         : 3057.662
cache size      : 512 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid xtpr
bogomips        : 6112.78
what more do you need?
 
Old 08-26-2006, 04:24 AM   #11
lkg
LQ Newbie
 
Registered: Aug 2006
Posts: 13

Rep: Reputation: 0
Here i cant see the unique cpuid how to retriew that cpuid?????????
 
Old 08-26-2006, 05:24 AM   #12
cupubboy
Member
 
Registered: May 2003
Location: Bucharest,Romania
Distribution: Fedora Core 7
Posts: 109

Rep: Reputation: 15
Who are you?

CPUID is an cpu instruction .. look here for details http://www.paradicesoftware.com/specs/cpuid/index.htm

Although the best reading material are the manuals from intel's site Cheers
 
Old 08-26-2006, 10:07 AM   #13
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Though I'm not sure why you need the CPUID. /proc/cpuinfo contains all the information from CPUID, already decoded for you.
 
Old 08-26-2006, 10:52 AM   #14
Nightfrost
Member
 
Registered: Jun 2004
Location: Sweden
Distribution: ArchLinux
Posts: 201

Rep: Reputation: 30
I actually have a similar problem. I'm trying to write a set of scripts for which I need to know the pentium-m cpu model of the current computer. That is, I need to know if it's p-m 753, p-m 725, etc. I can't find that information in /proc/cpuinfo. Is there a way to find that out?
 
Old 08-26-2006, 03:12 PM   #15
grep65535
LQ Newbie
 
Registered: Jul 2006
Location: Seattle, WA
Distribution: Fedora, RHEL, CentOS
Posts: 29

Rep: Reputation: 18
Quote:
Originally Posted by Matir
x86info is hardly a standard utility.

/proc/cpuinfo is the standard interface to the kernel's information regarding CPUs. It is the best option for getting the information you want. There are several scripts on here and other sites that show how to extract the relevant information.

i wasn't shooting for standard, more so toward another alternative to the already suggested methods, the guy asks for maybe another way beyond /proc/cpuinfo, i just threw one out there ;-p
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find how many CPU's are active in 8 CPU Linux machine sumit_sinha Linux - General 11 03-29-2011 10:53 AM
CPU information structure alltime Programming 2 10-31-2005 05:58 AM
Multithreaded System On 4 Cpu Linux Machine, process stuck on certain thread eyalzm Programming 1 05-10-2004 11:46 AM
Switching off a CPU of a multiple CPU machine kravisudhakar Linux - General 1 12-26-2003 10:13 AM
CPU#0:Machine Check Exception karamboul Linux - Software 1 03-29-2002 10:33 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration