ovs-thread: count the number of cpu cores.
authorGurucharan Shetty <gshetty@nicira.com>
Mon, 10 Mar 2014 16:59:56 +0000 (09:59 -0700)
committerGurucharan Shetty <gshetty@nicira.com>
Wed, 12 Mar 2014 03:52:35 +0000 (20:52 -0700)
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 <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/ovs-thread.c

index b6b51c7..85de014 100644 (file)
@@ -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);
     }