From: Gurucharan Shetty Date: Mon, 10 Mar 2014 16:59:56 +0000 (-0700) Subject: ovs-thread: count the number of cpu cores. X-Git-Tag: sliver-openvswitch-2.2.90-1~6^2~142 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=fdd73c2366a19ae4c8295bc59a7a62e8eb03954e;p=sliver-openvswitch.git ovs-thread: count the number of cpu cores. We use the number of cpu cores to determine the number of threads that we spawn. We are not yet sure what is the ideal number of OVS userspace threads that can run on Hyper-V. Till we figure that out, use the same logic of counting CPU cores in Windows too. Signed-off-by: Gurucharan Shetty Acked-by: Ben Pfaff --- diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c index b6b51c76a..85de014ec 100644 --- a/lib/ovs-thread.c +++ b/lib/ovs-thread.c @@ -509,10 +509,16 @@ count_cpu_cores(void) static long int n_cores; if (ovsthread_once_start(&once)) { +#ifndef _WIN32 parse_cpuinfo(&n_cores); if (!n_cores) { n_cores = sysconf(_SC_NPROCESSORS_ONLN); } +#else + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + n_cores = sysinfo.dwNumberOfProcessors; +#endif ovsthread_once_done(&once); }