linux get Cpu Count?

Started by
4 comments, last by Makaan 14 years ago
How do i get the physical Cpu count in linux? Thanks, Raxvan
Advertisement
You can read /proc/cpuinfo. This will have one entry for each core. If the processor has Hyper Threading you will see two for each core. Although I think the file has values that could be used to determine actual physical processors.
OpenMP also has the omp_get_num_procs function, if OpenMP were an option.
boost also has boost::thread::get_hardware_concurrency() or boost::thread::hardware_concurrency() or something like that
sysconf(_SC_NPROCESSORS_ONLN)
This space for rent.
gumpy Thanks , i just found the same solution on another forum.

This topic is closed to new replies.

Advertisement