the following proposed patch for stable (3.0) fixes a bug in Cygwin which
will result in a cpu count of 1, regardless of the number of CPUs available
because of a missing implementation for this metric and a hardcoded value.

attached original fix committed as r823

Carlo

---
Index: libmetrics/cygwin/metrics.c
===================================================================
--- libmetrics/cygwin/metrics.c (revision 822)
+++ libmetrics/cygwin/metrics.c (revision 823)
@@ -260,20 +260,17 @@
 g_val_t
 cpu_num_func ( void )
 {
-#if 0
-   static int cpu_num = 0;
-#endif
+   static DWORD cpu_num = 0;
+   SYSTEM_INFO siSysInfo;
    g_val_t val;
 
-#if 0
    /* Only need to do this once */
-   if (! cpu_num) {
-      /* We'll use _SC_NPROCESSORS_ONLN to get operating cpus */
-      cpu_num = get_nprocs();
+   if (!cpu_num) {
+      GetSystemInfo(&siSysInfo);
+      cpu_num = siSysInfo.dwNumberOfProcessors;
    }
-#endif
-   val.uint16 = 1;/**FIXME: assuming only one processor right now */
 
+   val.uint16 = cpu_num;
    return val;
 }
 

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Ganglia-developers mailing list
Ganglia-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to