gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r2881 - gnunet-gtk/src/plugins/stats


From: grothoff
Subject: [GNUnet-SVN] r2881 - gnunet-gtk/src/plugins/stats
Date: Mon, 22 May 2006 05:32:35 -0700 (PDT)

Author: grothoff
Date: 2006-05-22 05:32:32 -0700 (Mon, 22 May 2006)
New Revision: 2881

Modified:
   gnunet-gtk/src/plugins/stats/functions.c
   gnunet-gtk/src/plugins/stats/statistics.c
Log:
minimal stats fixes

Modified: gnunet-gtk/src/plugins/stats/functions.c
===================================================================
--- gnunet-gtk/src/plugins/stats/functions.c    2006-05-21 20:31:59 UTC (rev 
2880)
+++ gnunet-gtk/src/plugins/stats/functions.c    2006-05-22 12:32:32 UTC (rev 
2881)
@@ -138,13 +138,14 @@
   long long noise;
   long long content;
   long long queries;
+  long long hellos;
   long long ltotal;
   long long lnoise;
   long long lcontent;
   long long lqueries;
+  long long lhellos;
   cron_t dtime;
   char * buffer;
-  int i;
 
   if (OK != getStatValue(&total,       
                         &ltotal,
@@ -156,7 +157,6 @@
                         NULL,
                         "# bytes of noise received"))
     return SYSERR;
-  i = 0;
   buffer = MALLOC(512);
   SNPRINTF(buffer,
           512,
@@ -166,12 +166,22 @@
                         &lcontent,
                         NULL,
                         buffer)) {
-    content += 0;
-    lcontent += 0;
+    content = 0;
+    lcontent = 0;
   }
-  i = 0;
   SNPRINTF(buffer,
           512,
+          "# bytes received of type %d",
+          p2p_PROTO_hello);
+  if (OK != getStatValue(&hellos,
+                        &lhellos,
+                        NULL,
+                        buffer)) {
+    hellos = 0;
+    lhellos = 0;
+  }
+  SNPRINTF(buffer,
+          512,
            "# bytes received of type %d",
           P2P_PROTO_gap_QUERY);
   if (OK != getStatValue(&queries,
@@ -189,22 +199,26 @@
   noise -= lnoise;
   queries -= lqueries;
   content -= lcontent;
+  hellos -= lhellos;
   if (banddown < 0) {
     data[0][0] = 0.0;
     data[0][1] = 0.0;
     data[0][2] = 0.0;
     data[0][3] = 0.0;
+    data[0][4] = 0.0;
     return OK;
   }
   data[0][0] = ((gfloat) noise) / (banddown * dtime / cronSECONDS); /* red */
   data[0][1] = ((gfloat) (content+noise)) / (banddown * dtime / cronSECONDS); 
/* green */
   data[0][2] = ((gfloat)(queries+content+noise)) / (banddown * dtime / 
cronSECONDS); /* yellow */
-  data[0][3] = ((gfloat) total) / (banddown * dtime / cronSECONDS); /* blue */
-  /*printf("I: %f %f %f\n",
+  data[0][3] = ((gfloat)(queries+content+noise+hellos)) / (banddown * dtime / 
cronSECONDS); /* blue */
+  data[0][4] = ((gfloat) total) / (banddown * dtime / cronSECONDS); /* gray */
+#if 0
+  printf("I: %f %f %f %f\n",
         data[0][0],
         data[0][1],
-        data[0][2]);*/
-
+        data[0][2]);
+#endif
   return OK;
 }
 
@@ -214,13 +228,14 @@
   long long noise;
   long long content;
   long long queries;
+  long long hellos;
   long long ltotal;
   long long lnoise;
   long long lcontent;
   long long lqueries;
+  long long lhellos;
   cron_t dtime;
   char * buffer;
-  int i;
 
   if (OK != getStatValue(&total,       
                         &ltotal,
@@ -232,7 +247,6 @@
                         NULL,
                          "# bytes noise sent"))
     return SYSERR;
-  i = 0;
   buffer = MALLOC(512);
   SNPRINTF(buffer,
           512,
@@ -245,7 +259,6 @@
     content = 0;
     lcontent = 0;
   }
-  i = 0;
   SNPRINTF(buffer,
           512,
            "# bytes transmitted of type %d",
@@ -257,6 +270,17 @@
     queries = 0;
     lqueries = 0;
   }
+  SNPRINTF(buffer,
+          512,
+           "# bytes transmitted of type %d",
+          p2p_PROTO_hello);
+  if (OK != getStatValue(&hellos,
+                        &lhellos,
+                        NULL,
+                        buffer)) {
+    queries = 0;
+    lqueries = 0;
+  }
   FREE(buffer);
   if (bandup == 0)
     return SYSERR;
@@ -264,21 +288,27 @@
   noise -= lnoise;
   queries -= lqueries;
   content -= lcontent;
+  hellos -= lhellos;
   if (bandup < 0) {
     data[0][0] = 0.0;
     data[0][1] = 0.0;
     data[0][2] = 0.0;
     data[0][3] = 0.0;
+    data[0][4] = 0.0;
     return OK;
   }
   data[0][0] = ((gfloat) noise) / (bandup * dtime / cronSECONDS); /* red */
   data[0][1] = ((gfloat) (noise + content)) / (bandup*dtime / cronSECONDS); /* 
green */
   data[0][2] = ((gfloat) (noise + content + queries)) / (bandup*dtime / 
cronSECONDS); /* yellow */
-  data[0][3] = ((gfloat) total) / (bandup*dtime / cronSECONDS); /* blue */
-  /* printf("O: %f %f %f\n",
-     data[0][0],
-     data[0][1],
-        data[0][2]);*/
+  data[0][3] = ((gfloat) (noise + content + queries + hellos)) / (bandup*dtime 
/ cronSECONDS); /* blue */
+  data[0][4] = ((gfloat) total) / (bandup*dtime / cronSECONDS); /* blue */
+#if 0
+  printf("O: %f %f %f %f\n",
+        data[0][0],
+        data[0][1],
+        data[0][2],
+        data[0][3]);
+#endif
   return OK;
 }
 
@@ -406,18 +436,18 @@
   },
   {
     gettext_noop("Inbound Traffic"),
-    gettext_noop("Noise (red), Content (green), Queries (yellow), other 
(blue)"),
+    gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos 
(blue), other (gray)"),
     &getTrafficRecvStats,
     NULL,
-    4,
+    5,
     YES,
   },
   {
     gettext_noop("Outbound Traffic"),
-    gettext_noop("Noise (red), Content (green), Queries (yellow), other 
(blue)"),
+    gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos 
(blue), other (gray)"),
     &getTrafficSendStats,
     NULL,
-    4,
+    5,
     YES,
   },
   {

Modified: gnunet-gtk/src/plugins/stats/statistics.c
===================================================================
--- gnunet-gtk/src/plugins/stats/statistics.c   2006-05-21 20:31:59 UTC (rev 
2880)
+++ gnunet-gtk/src/plugins/stats/statistics.c   2006-05-22 12:32:32 UTC (rev 
2881)
@@ -27,7 +27,7 @@
 #include <GNUnet/gnunet_getoption_lib.h>
 #include "functions.h"
 
-#define MAX_COLOR 4
+#define MAX_COLOR 5
 #define GNOME_PAD_SMALL 2
 #define FRAME_WIDTH 0
 
@@ -451,7 +451,9 @@
                  &config.mem_color[2]);
   gdk_color_parse("blue",
                  &config.mem_color[3]);
-  GNUNET_ASSERT(MAX_COLOR == 4);
+  gdk_color_parse("gray",
+                 &config.mem_color[4]);
+  GNUNET_ASSERT(MAX_COLOR == 5);
   i = -1;
   while (stats[++i].paneName != NULL) {
     sys_box = create_sys_view(i,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]