<SNIP>
> I also have a simple patch to implement cygwin cpu count that
> I will forward tonight. I remember a thread about this a while ago and
> I'm surprised that cygwin/gmetric.c/cpu_num_func() looks like the
> original one.

Oops, my bad, I'd been using a patched version of cpu_num_func for a while 
and almost forgot that the source wasn't yet fixed.

I'd updated the patch and rebuilt it with the last SVN revision and tested it 
in my Windows XP SP2 Home laptop (only 1 CPU though) but haven't had the 
opportunity to test it in any multi core/multi CPU windows environment.

Attached the patch for comments, and in the following address a binary gmond
built with it to simplify testing (using --enable-static-build) :

  http://www.sajinet.com.pe/ganglia/gmond-3.1.0-bin.zip

in order to test it do the following :

1) unzip (using windows explorer - extract all) the contents in c:\progra~1
2) change c:\progra~1\ganglia\gmond.conf to match your environment for a
   collector (if not change 192.168.0.11 with your own IP so it collects to
   itself)
3) stop any other cygwin related applications (including services)
4) go to c:\progra~1\ganglia and run :

     gmond.exe -c gmond.conf

a telnet to TCP 8649 in the collector should print the cpu_num metric with the
right value.

Carlo
Index: monitor-core/libmetrics/cygwin/metrics.c
===================================================================
--- monitor-core/libmetrics/cygwin/metrics.c    (revision 820)
+++ monitor-core/libmetrics/cygwin/metrics.c    (working copy)
@@ -260,20 +260,18 @@
 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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Ganglia-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to