The biggest of all patches, but the less likely to generate any problems

It could be skipped, but then the series will have 13 patches, and you know
what they say about that number and it makes the code nicer to read and
easier to extend.

Signed-off-by: Carlo Marcelo Arenas Belon <[EMAIL PROTECTED]>
---
 trunk/monitor-core/libmetrics/aix/metrics.c |  619 ++++++++++++--------------
 1 files changed, 286 insertions(+), 333 deletions(-)

diff --git a/trunk/monitor-core/libmetrics/aix/metrics.c 
b/trunk/monitor-core/libmetrics/aix/metrics.c
index f08c5bb..0f82b5a 100644
--- a/trunk/monitor-core/libmetrics/aix/metrics.c
+++ b/trunk/monitor-core/libmetrics/aix/metrics.c
@@ -8,6 +8,9 @@
  *  Written by Michael Perzl ([EMAIL PROTECTED])
  *         and Nigel Griffiths ([EMAIL PROTECTED])
  *
+ *  All bugs added while adapting it to upstream ganglia by:
+ *  Carlo Marcelo Arenas Belon <[EMAIL PROTECTED]>
+ *
  *  Firt version of rewritten AIX metrics using libperfstat API
  *  by Andreas Schoenfeld, TU Darmstadt, Germany (4/2005) 
  *  E-Mail: [EMAIL PROTECTED]
@@ -89,6 +92,7 @@ struct product {
 #endif
 
 #define MAX_CPUS  64
+#define MAXPROCS 1000000
 
 #define INFO_TIMEOUT        (5.0)
 #define CPUINFO_TIMEOUT     INFO_TIMEOUT
@@ -117,10 +121,264 @@ struct cpuinfo_stats {
 static int aixver, aixrel, aixlev, aixfix;
 static time_t boottime;
 
-/* Prototypes
+/* int bos_level(int *aix_version, int *aix_release, int *aix_level, int 
*aix_fix)
+ *  is copied from:
+ *
+ *  First stab at support for metrics in AIX
+ *  by Preston Smith <[EMAIL PROTECTED]>
+ *  Wed Feb 27 14:55:33 EST 2002
+ *
+ *  AIX V5 support, bugfixes added by Davide Tacchella <[EMAIL PROTECTED]>
+ *  May 10, 2002
+ *
+ *  AIX 5L adaptation done by Michael Perzl ([EMAIL PROTECTED])
+ *  March 30, 2006
+ */
+
+int bos_level(int *aix_version, int *aix_release, int *aix_level, int *aix_fix)
+{
+    struct Class *my_cl;   /* customized devices class ptr */
+    struct product  productobj;     /* customized device object storage */
+    int maxVer, maxTel, maxMod, maxFix;
+    int rc, getit, found = 0;
+    char *path;
+
+    /*
+     * start up odm
+     */
+    if (odm_initialize() == -1)
+        return E_ODMINIT; 
+
+    /*
+     * Make sure we take the right database
+     */
+    if ((path = odm_set_path("/usr/lib/objrepos")) == (char *) -1)
+        return odmerrno;
+ 
+    /*
+     * Mount the lpp class
+     */
+    if ((My_CLASS = odm_mount_class("product")) == (CLASS_SYMBOL) -1) {
+        free(path);
+        return odmerrno;
+    }
+    /*
+     * open customized devices object class
+     */
+    if ((int)(my_cl = odm_open_class(My_CLASS)) == -1) {
+        free(path)
+        return E_ODMOPEN;
+    }
+
+    /*
+     * Loop trough all entries for the lpp name
+     *
+     * AIX > 4.2 uses bos.mp or bos.up
+     * we look also for bos.mp64 abd bos.up64
+     */
+    maxVer = maxRel = maxMod = maxFix = 0;
+    
+    getit = ODM_FIRST;
+    while ((rc = (int)odm_get_obj(my_cl, "name like bos.?p",
+                                  &productobj, getit)) != 0) {
+        getit = ODM_NEXT;
+        if (rc == -1) {
+            /* ODM failure */
+            break;
+        } else {
+            if (productobj.ver > maxVer) maxVer = productobj.ver;
+            if (productobj.rel > maxRel) maxRel = productobj.rel;
+            if (productobj.mod > maxMod) maxMod = productobj.mod;
+            if (productobj.fix > maxFix) maxFix = productobj.fix;
+            found++;
+        }
+    }
+    getit = ODM_FIRST;
+    while ((rc = (int)odm_get_obj(my_cl, "name like bos.?p64",
+                                  &productobj, getit)) != 0) {
+        getit = ODM_NEXT;
+        if (rc == -1) {
+            /* ODM failure */
+            break;
+        } else {
+            if (productobj.ver > maxVer) maxVer = productobj.ver;
+            if (productobj.rel > maxRel) maxRel = productobj.rel;
+            if (productobj.mod > maxMod) maxMod = productobj.mod;
+            if (productobj.fix > maxFix) maxFix = productobj.fix;
+            found++;
+        }
+    }
+    /*
+     * AIX < 4.2 
+     */
+    if (!found) {
+        getit = ODM_FIRST;
+        while ((rc = (int)odm_get_obj(my_cl, "name like bos.rte.?p",
+                                      &productobj, getit)) != 0) {
+            getit = ODM_NEXT;
+            if (rc == -1) {
+                /* ODM failure */
+                break;
+            } else {
+                if (productobj.ver > maxVer) maxVer = productobj.ver;
+                if (productobj.rel > maxRel) maxRel = productobj.rel;
+                if (productobj.mod > maxMod) maxMod = productobj.mod;
+                if (productobj.fix > maxFix) maxFix = productobj.fix;
+                found++;
+            }
+        }
+    }
+
+    *aix_version = productobj.ver;
+    *aix_release = productobj.rel;
+    *aix_level   = productobj.mod;
+    *aix_fix     = productobj.fix;
+
+    /*
+     * close lpp object class
+     */
+    odm_close_class(my_cl);
+
+    odm_terminate();
+
+    free(path);
+    return (found ? 0 : -1);
+
+} /* bos_level */
+
+void
+update_ifdata( void )
+{
+   static int init_done = 0;
+   perfstat_id_t name;
+   perfstat_netinterface_t *nif_buf, *p;
+   static u_longlong_t last_bytes_in = 0L;
+   static u_longlong_t last_bytes_out = 0L;
+   static u_longlong_t last_pkts_in = 0L;
+   static u_longlong_t last_pkts_out = 0L;
+   u_longlong_t bytes_in, bytes_out, pkts_in, pkts_out;
+   longlong_t d;
+   int i, nr_netif;
+   static double last_time = 0.0;
+   double now, delta_t;
+   struct timeval timeValue;
+   struct timezone timeZone;
+
+   gettimeofday( &timeValue, &timeZone );
+
+   now = (double) (timeValue.tv_sec - boottime) + (timeValue.tv_usec / 
1000000.0);
+   delta_t = now - last_time;
+
+/* Do nothing if we are called too soon after the last call */
+   if (init_done && (delta_t < NETWORKINFO_TIMEOUT)) return;
+
+/* obtain the network parameters */
+   bytes_in = bytes_out = pkts_in = pkts_out = 0L;
+
+   nr_netif = perfstat_netinterface( NULL, NULL, sizeof( 
perfstat_netinterface_t ), 0 );
+
+   if (nr_netif == -1)
+      return;
+   else {
+/* We can allocate enough memory for the buffer */
+      nif_buf = (perfstat_netinterface_t *)
+                    malloc( nr_netif * sizeof( perfstat_netinterface_t));
+
+      if (nif_buf == NULL)
+/* couldn't allocate enough memory */
+         return;
+      else { 
+/* In order to get all of the network interfaces statistics,
+ * we will first ask for the network interface which name is "",
+ * that can be considered as an alias for the name of the first
+ * network interface.
  */
-void  update_ifdata(void);
-int bos_level(int *aix_version, int *aix_release, int *aix_level, int 
*aix_fix);
+         strcpy( name.name, FIRST_NETINTERFACE );
+         if (perfstat_netinterface( &name,
+                                    nif_buf,
+                                    sizeof( perfstat_netinterface_t ),
+                                    nr_netif ) == -1) {
+            free( nif_buf );
+            return;
+         } else {
+/* Ok, we could get the statistics, we can now use it. */
+/* Ignore all loopback devices */
+            for (i = 0, p = nif_buf;  i < nr_netif;  i++, p++ )
+               if (p->type != IFT_LOOP)
+               {
+                  bytes_in  += p->ibytes;
+                  bytes_out += p->obytes;
+                  pkts_in   += p->ipackets;
+                  pkts_out  += p->opackets;
+               }
+         }
+
+/* free allocated memory again */
+         free( nif_buf );
+      }
+   }
+
+/* calculate the network parameters */
+   if (init_done)
+   {
+/* get the number of bytes transferred in, check for integer overrun */
+      d = bytes_in - last_bytes_in;
+      if (d < 0) d += ULONG_MAX;
+      if ( delta_t )
+         cur_net_stat.ibytes = (double) d / delta_t;
+      else
+         cur_net_stat.ibytes = 0.0;
+
+      last_bytes_in = bytes_in;
+
+/* get the number of bytes transferred out, check for integer overrun */
+      d = bytes_out - last_bytes_out;
+      if (d < 0) d += ULONG_MAX;
+
+      if ( delta_t )
+         cur_net_stat.obytes = (double) d / delta_t;
+      else
+         cur_net_stat.obytes = 0.0;
+
+      last_bytes_out = bytes_out;
+
+/* get the number of packets transferred in, check for integer overrun */
+      d = pkts_in - last_pkts_in;
+      if (d < 0) d += ULONG_MAX;
+
+      if ( delta_t )
+         cur_net_stat.ipackets = (double) d / delta_t;
+      else
+         cur_net_stat.ipackets = 0.0;
+
+      last_pkts_in = pkts_in;
+
+/* get the number of packets transferred out, check for integer overrun */
+      d = pkts_out - last_pkts_out;
+      if (d < 0) d += ULONG_MAX;
+
+      if ( delta_t )
+         cur_net_stat.opackets = (double) d / delta_t;
+      else
+         cur_net_stat.opackets = 0.0;
+
+      last_pkts_out = pkts_out;
+   } else {
+      init_done = 1;
+
+      cur_net_stat.ibytes   = 0.0;
+      cur_net_stat.obytes   = 0.0;
+      cur_net_stat.ipackets = 0.0;
+      cur_net_stat.opackets = 0.0;
+
+      last_bytes_in  = bytes_in;
+      last_bytes_out = bytes_out;
+      last_pkts_in   = pkts_in;
+      last_pkts_out  = pkts_out;
+   }
+
+   last_time = now;
+}
 
 /*
  * This function is called only once by the gmond.  Use to 
@@ -147,7 +405,7 @@ cpu_speed_func ( void )
    if (perfstat_cpu_total(NULL,  &c, sizeof(perfstat_cpu_total_t), 1) == -1)
       val.uint32 = 0;
    else
-      val.uint32 = c.processorHZ/1000000;
+      val.uint32 = c.processorHZ / 1000000;
 
    return val;
 }
@@ -215,15 +473,14 @@ os_name_func ( void )
    return val;
 }        
 
-
 g_val_t
 os_release_func ( void )
 {
    g_val_t val;
    char oslevel[MAX_G_STRING_SIZE];
 
-   sprintf(oslevel, "%d.%d.%d.%d", aixver, aixrel, aixlev, aixfix);
-   strncpy( val.str, oslevel, MAX_G_STRING_SIZE );
+   sprintf (oslevel, "%d.%d.%d.%d", aixver, aixrel, aixlev, aixfix);
+   strncpy (val.str, oslevel, MAX_G_STRING_SIZE);
 
    return val;
 }        
@@ -250,7 +507,7 @@ update_cpuinfo( void )
    struct timeval timeValue;
    struct timezone timeZone;
 
-   gettimeofday( &timeValue, &timeZone );
+   gettimeofday (&timeValue, &timeZone);
    now = (double) (timeValue.tv_sec - boottime) + (timeValue.tv_usec / 
1000000.0);
 
 /* Do nothing if we are called too soon after the last call */
@@ -259,7 +516,7 @@ update_cpuinfo( void )
    last_time = now;
 
 /* obtain CPU parameters */
-   if (perfstat_cpu_total( NULL, &c, sizeof( perfstat_cpu_total_t ), 1 ) != -1)
+   if (perfstat_cpu_total (NULL, &c, sizeof( perfstat_cpu_total_t ), 1) != -1)
    {
       user_ticks = c.user;
       sys_ticks = c.sys;
@@ -291,23 +548,11 @@ cpu_user_func ( void )
    g_val_t val;
    
    update_cpuinfo();
-   
    val.f = current_cpuinfo.user;
 
    return val;
 }
 
-/* FIXME? */
-g_val_t
-cpu_nice_func ( void )
-{
-   g_val_t val;
-
-   val.f = 0;
-
-   return val;
-}
-
 g_val_t 
 cpu_system_func ( void )
 {
@@ -318,8 +563,8 @@ cpu_system_func ( void )
    
    return val;
 }
-g_val_t 
 
+g_val_t 
 cpu_wio_func ( void )
 {
    g_val_t val;
@@ -335,7 +580,6 @@ cpu_idle_func ( void )
 {
    g_val_t val;
 
-
    update_cpuinfo();
    val.f = current_cpuinfo.idle;
 
@@ -354,6 +598,17 @@ cpu_aidle_func ( void )
 }
 
 /* FIXME? */
+g_val_t
+cpu_nice_func ( void )
+{
+   g_val_t val;
+
+   val.f = 0;
+
+   return val;
+}
+
+/* FIXME? */
 g_val_t 
 cpu_intr_func ( void )
 {
@@ -369,7 +624,9 @@ g_val_t
 cpu_sintr_func ( void )
 {
    g_val_t val;
+
    val.f = 0.0;
+
    return val;
 }
 
@@ -450,7 +707,9 @@ g_val_t
 part_max_used_func ( void )
 {
    g_val_t val;
+
    val.f = 0.0;
+
    return val;
 }
 
@@ -464,6 +723,7 @@ load_one_func ( void )
       val.f = 0.0;
    else
       val.f = (float)c.loadavg[0]/(float)(1<<SBITS);
+
    return val;
 }
 
@@ -477,6 +737,7 @@ load_five_func ( void )
       val.f = 0.0;
    else
       val.f = (float)c.loadavg[1]/(float)(1<<SBITS);
+
    return val;
 }
 
@@ -508,54 +769,6 @@ cpu_num_func ( void )
    return val;
 }
 
-#define MAXPROCS 1000000
-/*
-** Theese Missing prototypes have caused me an afternoon of real grief !!!
-*/
-int getprocs64 (struct procentry64 *ProcessBuffer, int ProcessSize, 
-                struct fdsinfo64 *FileBuffer, int FileSize,
-                pid_t *IndexPointer, int Count);
-int getthrds64 (pid_t ProcessIdentifier, struct thrdentry64 *ThreadBuffer,
-            int  ThreadSize, tid64_t *IndexPointer, int Count);
-
-/*
-** count_threads(pid) finds all runnable threads belonging to
-** process==pid. We do not count threads with the TFUNNELLED
-** flag set, as they do not seem to count against the load
-** averages (pure WOODOO, also known as "heuristics" :-)
-*/
-int count_threads(pid_t pid) {
-
-  struct thrdentry64 ThreadsBuffer[MAXPROCS];
-  tid64_t IndexPointer = 0;
-  int stat_val;
-  int nth = 0; 
-  int i;
-  
-  while ((stat_val = getthrds64(pid,
-                             ThreadsBuffer,
-                             sizeof(struct thrdentry64),
-                             &IndexPointer,
-                             MAXPROCS )) > 0 ) 
-    
-    {
-      for ( i=0; i<stat_val; i++) {
-        /*
-        ** Do not count FUNNELED threads, as they do not seem to
-        ** be counted in loadavg.
-        */
-        if (ThreadsBuffer[i].ti_flag & TFUNNELLED) continue;
-       if(ThreadsBuffer[i].ti_state == TSRUN) {
-          /*fprintf(stderr,"i=%d pid=%d tid=%lld state=%x 
flags=%x\n",i,ThreadsBuffer[i].ti_pid,
-                       ThreadsBuffer[i].ti_tid,ThreadsBuffer[i].ti_state,
-                       ThreadsBuffer[i].ti_flag);*/
-          nth++;
-        }
-      }
-      if (stat_val < MAXPROCS) break;
-    }       
-  return nth;
-}
 
 g_val_t
 proc_total_func ( void )
@@ -602,7 +815,6 @@ proc_run_func( void )
    }
 
    last_time = now;
-
    val.uint32 = (unsigned int) runnable;
  
    return val;
@@ -706,269 +918,10 @@ mtu_func ( void )
 {
    /* We want to find the minimum MTU (Max packet size) over all UP interfaces.
 */
-   unsigned int min=0;
    g_val_t val;
+
    val.uint32 = get_min_mtu();
    /* A val of 0 means there are no UP interfaces. Shouldn't happen. */
-   return val;
-}
-
-/* int bos_level(int *aix_version, int *aix_release, int *aix_level, int 
*aix_fix)
- *  is copied from:
- *
- *  First stab at support for metrics in AIX
- *  by Preston Smith <[EMAIL PROTECTED]>
- *  Wed Feb 27 14:55:33 EST 2002
- *
- *  AIX V5 support, bugfixes added by Davide Tacchella <[EMAIL PROTECTED]>
- *  May 10, 2002
- *
- *  AIX 5L adaptation done by Michael Perzl ([EMAIL PROTECTED])
- *  March 30, 2006
- */
-
-int bos_level(int *aix_version, int *aix_release, int *aix_level, int *aix_fix)
-{
-    struct Class *my_cl;   /* customized devices class ptr */
-    struct product  productobj;     /* customized device object storage */
-    int maxVer, maxTel, maxMod, maxFix;
-    int rc, getit, found = 0;
-    char *path;
-
-    /*
-     * start up odm
-     */
-    if (odm_initialize() == -1)
-        return E_ODMINIT; 
-
-    /*
-     * Make sure we take the right database
-     */
-    if ((path = odm_set_path("/usr/lib/objrepos")) == (char *) -1)
-        return odmerrno;
- 
-    /*
-     * Mount the lpp class
-     */
-    if ((My_CLASS = odm_mount_class("product")) == (CLASS_SYMBOL) -1) {
-        free(path);
-        return odmerrno;
-    }
-    /*
-     * open customized devices object class
-     */
-    if ((int)(my_cl = odm_open_class(My_CLASS)) == -1) {
-        free(path)
-        return E_ODMOPEN;
-    }
-
-    /*
-     * Loop trough all entries for the lpp name
-     *
-     * AIX > 4.2 uses bos.mp or bos.up
-     * we look also for bos.mp64 abd bos.up64
-     */
-    maxVer = maxRel = maxMod = maxFix = 0;
-    
-    getit = ODM_FIRST;
-    while ((rc = (int)odm_get_obj(my_cl, "name like bos.?p",
-                                  &productobj, getit)) != 0) {
-        getit = ODM_NEXT;
-        if (rc == -1) {
-            /* ODM failure */
-            break;
-        } else {
-            if (productobj.ver > maxVer) maxVer = productobj.ver;
-            if (productobj.rel > maxRel) maxRel = productobj.rel;
-            if (productobj.mod > maxMod) maxMod = productobj.mod;
-            if (productobj.fix > maxFix) maxFix = productobj.fix;
-            found++;
-        }
-    }
-    getit = ODM_FIRST;
-    while ((rc = (int)odm_get_obj(my_cl, "name like bos.?p64",
-                                  &productobj, getit)) != 0) {
-        getit = ODM_NEXT;
-        if (rc == -1) {
-            /* ODM failure */
-            break;
-        } else {
-            if (productobj.ver > maxVer) maxVer = productobj.ver;
-            if (productobj.rel > maxRel) maxRel = productobj.rel;
-            if (productobj.mod > maxMod) maxMod = productobj.mod;
-            if (productobj.fix > maxFix) maxFix = productobj.fix;
-            found++;
-        }
-    }
-    /*
-     * AIX < 4.2 
-     */
-    if (!found) {
-        getit = ODM_FIRST;
-        while ((rc = (int)odm_get_obj(my_cl, "name like bos.rte.?p",
-                                      &productobj, getit)) != 0) {
-            getit = ODM_NEXT;
-            if (rc == -1) {
-                /* ODM failure */
-                break;
-            } else {
-                if (productobj.ver > maxVer) maxVer = productobj.ver;
-                if (productobj.rel > maxRel) maxRel = productobj.rel;
-                if (productobj.mod > maxMod) maxMod = productobj.mod;
-                if (productobj.fix > maxFix) maxFix = productobj.fix;
-                found++;
-            }
-        }
-    }
-
-    *aix_version = productobj.ver;
-    *aix_release = productobj.rel;
-    *aix_level   = productobj.mod;
-    *aix_fix     = productobj.fix;
-
-    /*
-     * close lpp object class
-     */
-    odm_close_class(my_cl);
-
-    odm_terminate();
-
-    free(path);
-    return (found ? 0 : -1);
-
-} /* bos_level */
-
-void
-update_ifdata( void )
-{
-   static int init_done = 0;
-   perfstat_id_t name;
-   perfstat_netinterface_t *nif_buf, *p;
-   static u_longlong_t last_bytes_in = 0L;
-   static u_longlong_t last_bytes_out = 0L;
-   static u_longlong_t last_pkts_in = 0L;
-   static u_longlong_t last_pkts_out = 0L;
-   u_longlong_t bytes_in, bytes_out, pkts_in, pkts_out;
-   longlong_t d;
-   int i, nr_netif;
-   static double last_time = 0.0;
-   double now, delta_t;
-   struct timeval timeValue;
-   struct timezone timeZone;
-
-   gettimeofday( &timeValue, &timeZone );
-
-   now = (double) (timeValue.tv_sec - boottime) + (timeValue.tv_usec / 
1000000.0);
-   delta_t = now - last_time;
-
-/* Do nothing if we are called too soon after the last call */
-   if (init_done && (delta_t < NETWORKINFO_TIMEOUT)) return;
-
-/* obtain the network parameters */
-   bytes_in = bytes_out = pkts_in = pkts_out = 0L;
-
-   nr_netif = perfstat_netinterface( NULL, NULL, sizeof( 
perfstat_netinterface_t ), 0 );
-
-   if (nr_netif == -1)
-      return;
-   else {
-/* We can allocate enough memory for the buffer */
-      nif_buf = (perfstat_netinterface_t *)
-                    malloc( nr_netif * sizeof( perfstat_netinterface_t));
-
-      if (nif_buf == NULL)
-/* couldn't allocate enough memory */
-         return;
-      else { 
-/* In order to get all of the network interfaces statistics,
- * we will first ask for the network interface which name is "",
- * that can be considered as an alias for the name of the first
- * network interface.
- */
-         strcpy( name.name, FIRST_NETINTERFACE );
-         if (perfstat_netinterface( &name,
-                                    nif_buf,
-                                    sizeof( perfstat_netinterface_t ),
-                                    nr_netif ) == -1) {
-            free( nif_buf );
-            return;
-         } else {
-/* Ok, we could get the statistics, we can now use it. */
-/* Ignore all loopback devices */
-            for (i = 0, p = nif_buf;  i < nr_netif;  i++, p++ )
-               if (p->type != IFT_LOOP)
-               {
-                  bytes_in  += p->ibytes;
-                  bytes_out += p->obytes;
-                  pkts_in   += p->ipackets;
-                  pkts_out  += p->opackets;
-               }
-         }
-
-/* free allocated memory again */
-         free( nif_buf );
-      }
-   }
-
-
-/* calculate the network parameters */
-   if (init_done)
-   {
-/* get the number of bytes transferred in, check for integer overrun */
-      d = bytes_in - last_bytes_in;
-      if (d < 0) d += ULONG_MAX;
-      if ( delta_t )
-         cur_net_stat.ibytes = (double) d / delta_t;
-      else
-         cur_net_stat.ibytes = 0.0;
-
-      last_bytes_in = bytes_in;
-
-/* get the number of bytes transferred out, check for integer overrun */
-      d = bytes_out - last_bytes_out;
-      if (d < 0) d += ULONG_MAX;
 
-      if ( delta_t )
-         cur_net_stat.obytes = (double) d / delta_t;
-      else
-         cur_net_stat.obytes = 0.0;
-
-      last_bytes_out = bytes_out;
-
-/* get the number of packets transferred in, check for integer overrun */
-      d = pkts_in - last_pkts_in;
-      if (d < 0) d += ULONG_MAX;
-
-      if ( delta_t )
-         cur_net_stat.ipackets = (double) d / delta_t;
-      else
-         cur_net_stat.ipackets = 0.0;
-
-      last_pkts_in = pkts_in;
-
-/* get the number of packets transferred out, check for integer overrun */
-      d = pkts_out - last_pkts_out;
-      if (d < 0) d += ULONG_MAX;
-
-      if ( delta_t )
-         cur_net_stat.opackets = (double) d / delta_t;
-      else
-         cur_net_stat.opackets = 0.0;
-
-      last_pkts_out = pkts_out;
-   } else {
-      init_done = 1;
-
-      cur_net_stat.ibytes   = 0.0;
-      cur_net_stat.obytes   = 0.0;
-      cur_net_stat.ipackets = 0.0;
-      cur_net_stat.opackets = 0.0;
-
-      last_bytes_in  = bytes_in;
-      last_bytes_out = bytes_out;
-      last_pkts_in   = pkts_in;
-      last_pkts_out  = pkts_out;
-   }
-
-   last_time = now;
+   return val;
 }
-- 
1.5.3.7


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ganglia-developers mailing list
Ganglia-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to