prameela
prameela

Reputation: 49

cpu information

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

Upvotes: 4

Views: 342

Answers (2)

hookenz
hookenz

Reputation: 38987

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);

Upvotes: 5

Delan Azabani
Delan Azabani

Reputation: 81492

You can read from the /proc/cpuinfo file to gain information about CPUs in the running computer.

Upvotes: 6

Related Questions