Num Processors Linux
I am using GetSystemInfo in Windows to find the number of physical processors/cores in a machine. Then I am scaling my custom thread pool accordingly. What I am looking for is an equivalent function for Linux, and I would prefer not to use any assembly to do this.
Anyone know of a library function for this?
Quote:Original post by Wolfdog
I am using GetSystemInfo in Windows to find the number of physical processors/cores in a machine. Then I am scaling my custom thread pool accordingly. What I am looking for is an equivalent function for Linux, and I would prefer not to use any assembly to do this.
Anyone know of a library function for this?
try reading /proc/cpuinfo
Edit: might not work correctly with intel P4 cpus (HyperThreading seems to make the OS think that there are more physical cpus than there really are)
Ofcourse, treating a HT cpu as 2 cpus doesn't really hurt that much.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement