gnunet-svn
[Top][All Lists]
Advanced

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

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


From: grothoff
Subject: [GNUnet-SVN] r3887 - gnunet-gtk/src/plugins/stats
Date: Wed, 6 Dec 2006 23:31:54 -0800 (PST)

Author: grothoff
Date: 2006-12-06 23:31:52 -0800 (Wed, 06 Dec 2006)
New Revision: 3887

Modified:
   gnunet-gtk/src/plugins/stats/functions.c
   gnunet-gtk/src/plugins/stats/functions.h
   gnunet-gtk/src/plugins/stats/statistics.c
Log:
extending stats

Modified: gnunet-gtk/src/plugins/stats/functions.c
===================================================================
--- gnunet-gtk/src/plugins/stats/functions.c    2006-12-07 07:31:17 UTC (rev 
3886)
+++ gnunet-gtk/src/plugins/stats/functions.c    2006-12-07 07:31:52 UTC (rev 
3887)
@@ -168,11 +168,13 @@
   long long content;
   long long queries;
   long long hellos;
+  long long rlimit;
   long long ltotal;
   long long lnoise;
   long long lcontent;
   long long lqueries;
   long long lhellos;
+  long long lrlimit;
   cron_t dtime;
   char * buffer;
 
@@ -220,6 +222,13 @@
     queries = 0;
     lqueries = 0;
   }
+  if (OK != getStatValue(&rlimit,
+                        &lrlimit,
+                        NULL,
+                        "# total advertised bytes per minute received limit")) 
{
+    rlimit = 0;
+    lrlimit = 0;
+  }
   FREE(buffer);
   if (banddown == 0)
     return SYSERR;
@@ -235,6 +244,7 @@
     data[0][2] = 0.0;
     data[0][3] = 0.0;
     data[0][4] = 0.0;
+    data[0][5] = 0.0;
     return OK;
   }
   data[0][0] = ((gfloat) noise) / (banddown * dtime / cronSECONDS); /* red */
@@ -242,6 +252,7 @@
   data[0][2] = ((gfloat)(queries+content+noise)) / (banddown * dtime / 
cronSECONDS); /* yellow */
   data[0][3] = ((gfloat)(queries+content+noise+hellos)) / (banddown * dtime / 
cronSECONDS); /* blue */
   data[0][4] = ((gfloat) total) / (banddown * dtime / cronSECONDS); /* gray */
+  data[0][5] = ((gfloat) rlimit) / (banddown * dtime / cronSECONDS); /* 
magenta */
 #if 0
   printf("I: %f %f %f %f\n",
         data[0][0],
@@ -258,11 +269,13 @@
   long long content;
   long long queries;
   long long hellos;
+  long long slimit;
   long long ltotal;
   long long lnoise;
   long long lcontent;
   long long lqueries;
   long long lhellos;
+  long long lslimit;
   cron_t dtime;
   char * buffer;
 
@@ -310,6 +323,13 @@
     queries = 0;
     lqueries = 0;
   }
+  if (OK != getStatValue(&slimit,
+                        &lslimit,
+                        NULL,
+                        "# total allowed bytes per minute transmission 
limit")) {
+    slimit = 0;
+    lslimit = 0;
+  }
   FREE(buffer);
   if (bandup == 0)
     return SYSERR;
@@ -324,13 +344,15 @@
     data[0][2] = 0.0;
     data[0][3] = 0.0;
     data[0][4] = 0.0;
+    data[0][5] = 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) (noise + content + queries + hellos)) / (bandup*dtime 
/ cronSECONDS); /* blue */
-  data[0][4] = ((gfloat) total) / (bandup*dtime / cronSECONDS); /* blue */
+  data[0][4] = ((gfloat) total) / (bandup*dtime / cronSECONDS); /* grey */
+  data[0][5] = ((gfloat) slimit) / (bandup*dtime / cronSECONDS); /* magenta */
 #if 0
   printf("O: %f %f %f %f\n",
         data[0][0],
@@ -474,19 +496,19 @@
   },
   {
     gettext_noop("Inbound Traffic"),
-    gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos 
(blue), other (gray)"),
+    gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos 
(blue), other (gray), limit (magenta)"),
     &getTrafficRecvStats,
     NULL,
+    6,
     5,
-    YES,
   },
   {
     gettext_noop("Outbound Traffic"),
-    gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos 
(blue), other (gray)"),
+    gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos 
(blue), other (gray), limit (magenta)"),
     &getTrafficSendStats,
     NULL,
+    6,
     5,
-    YES,
   },
   {
     gettext_noop("Routing Effectiveness"),

Modified: gnunet-gtk/src/plugins/stats/functions.h
===================================================================
--- gnunet-gtk/src/plugins/stats/functions.h    2006-12-07 07:31:17 UTC (rev 
3886)
+++ gnunet-gtk/src/plugins/stats/functions.h    2006-12-07 07:31:52 UTC (rev 
3887)
@@ -45,7 +45,7 @@
   UpdateData getData;
   void * get_closure;
   unsigned int count;
-  int fill; /* YES / NO */
+  int fill; /* fill first "fill" entries */
 } StatEntry;
 
 extern StatEntry stats[];

Modified: gnunet-gtk/src/plugins/stats/statistics.c
===================================================================
--- gnunet-gtk/src/plugins/stats/statistics.c   2006-12-07 07:31:17 UTC (rev 
3886)
+++ gnunet-gtk/src/plugins/stats/statistics.c   2006-12-07 07:31:52 UTC (rev 
3887)
@@ -27,7 +27,7 @@
 #include <GNUnet/gnunet_getoption_lib.h>
 #include "functions.h"
 
-#define MAX_COLOR 5
+#define MAX_COLOR 6
 #define GNOME_PAD_SMALL 2
 #define FRAME_WIDTH 0
 
@@ -174,7 +174,7 @@
       gint y2 = g->data[i+1][j] / max * g->draw_height - 1;
 
       if ((g->data[i][j] != -1) && (g->data[i+1][j] != -1)) {
-       if (stats[g->statIdx].fill == NO) {
+       if (stats[g->statIdx].fill <= i) {
          gdk_draw_line(g->pixmap, g->gc,
                        g->draw_width - x2,
                        g->draw_height - y2,
@@ -465,8 +465,10 @@
                  &config.mem_color[3]);
   gdk_color_parse("gray",
                  &config.mem_color[4]);
+  gdk_color_parse("magenta",
+                 &config.mem_color[5]);
   GE_ASSERT(ectx,
-           MAX_COLOR == 5);
+           MAX_COLOR == 6);
   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]