I want know how can we find cpu information (Number of cpus and spead of cpu) from c program in linux. can anybody help me onthat
You can read from the /proc/cpuinfo
file to gain information about CPUs in the running computer.
As Delan has mentioned /proc/cpuinfo does provide those details.
There is also sysconf for getting the number of logical CPU's.
long numcpus = sysconf(_SC_NPROCESSORS_ONLN);
printf("Number of CPU's=%ld\n",numcpus);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With