Results 1 to 4 of 4
I need to obtain information such as CPU,Mem utilization and statistics like type and brand of cpu ,number of nics connected to the system,nics type its mac address ,partitions/disk capacity,device ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-10-2009 #1Just Joined!
- Join Date
- Feb 2009
- Posts
- 2
how can we get system information using c functions in any form of linux
I need to obtain information such as CPU,Mem utilization and statistics like type and brand of cpu ,number of nics connected to the system,nics type its mac address ,partitions/disk capacity,device idand its type ATA/SATA.I would like to know whether any pci cards are connected to my machine ....if yes its information. swap memory statistics .I would also like to know how to get events which occured ..is there any log file from which i can parse the events details.
Where can i get the above information from ,I dont wanna use the commands at the command prompt to get the information as this might slow my system down .I want to know if there is any directory which contains this information, like the /proc/cpu info file in ubuntu for cpu information etc .
Can u please help me out how to get the cpu and memory utilization for each and every process which is running on my machine.
i have to use some system calls or c functions inorder to do this .....can n e body help me out this ....i was able to find ioctl which would return ip address and mac address....can i use the same function to get information for all the above stated parameters.
thanks in advance
- 02-10-2009 #2
I think most of this information is in the /proc directory, which can be read like any other directory, using functions like opendir and readdir. The statistics for each process are in /proc/PID_of_process. But your program will need to run with root permissions to access them.
"I'm just a little old lady; don't try to dazzle me with jargon!"
- 02-11-2009 #3Just Joined!
- Join Date
- Feb 2009
- Posts
- 2
Solaris unlike the other Linux variants does not have files such as cpuinfo mem swaps files where we can get the information regarding the underlying system .All the files inside the /proc /PID_of_process are not in human readable format.I am looking at getting system level info across all the variants of linux
- 02-11-2009 #4Linux Guru
- Join Date
- Nov 2007
- Posts
- 1,722
how can we get system information using c functions in any form of linuxSolaris unlike the other Linux variants
Solaris is *not* Linux and neither is a *variant* of the other.
Most Solaris installs are on Sparc processors, so you will inherently have different code than most Linux installs (X86.)


Reply With Quote

