aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/stats/functions.c32
-rw-r--r--src/plugins/stats/functions.h2
-rw-r--r--src/plugins/stats/statistics.c8
3 files changed, 33 insertions, 9 deletions
diff --git a/src/plugins/stats/functions.c b/src/plugins/stats/functions.c
index 488a8410..08bb125c 100644
--- a/src/plugins/stats/functions.c
+++ b/src/plugins/stats/functions.c
@@ -168,11 +168,13 @@ static int getTrafficRecvStats(const void * closure,
168 long long content; 168 long long content;
169 long long queries; 169 long long queries;
170 long long hellos; 170 long long hellos;
171 long long rlimit;
171 long long ltotal; 172 long long ltotal;
172 long long lnoise; 173 long long lnoise;
173 long long lcontent; 174 long long lcontent;
174 long long lqueries; 175 long long lqueries;
175 long long lhellos; 176 long long lhellos;
177 long long lrlimit;
176 cron_t dtime; 178 cron_t dtime;
177 char * buffer; 179 char * buffer;
178 180
@@ -220,6 +222,13 @@ static int getTrafficRecvStats(const void * closure,
220 queries = 0; 222 queries = 0;
221 lqueries = 0; 223 lqueries = 0;
222 } 224 }
225 if (OK != getStatValue(&rlimit,
226 &lrlimit,
227 NULL,
228 "# total advertised bytes per minute received limit")) {
229 rlimit = 0;
230 lrlimit = 0;
231 }
223 FREE(buffer); 232 FREE(buffer);
224 if (banddown == 0) 233 if (banddown == 0)
225 return SYSERR; 234 return SYSERR;
@@ -235,6 +244,7 @@ static int getTrafficRecvStats(const void * closure,
235 data[0][2] = 0.0; 244 data[0][2] = 0.0;
236 data[0][3] = 0.0; 245 data[0][3] = 0.0;
237 data[0][4] = 0.0; 246 data[0][4] = 0.0;
247 data[0][5] = 0.0;
238 return OK; 248 return OK;
239 } 249 }
240 data[0][0] = ((gfloat) noise) / (banddown * dtime / cronSECONDS); /* red */ 250 data[0][0] = ((gfloat) noise) / (banddown * dtime / cronSECONDS); /* red */
@@ -242,6 +252,7 @@ static int getTrafficRecvStats(const void * closure,
242 data[0][2] = ((gfloat)(queries+content+noise)) / (banddown * dtime / cronSECONDS); /* yellow */ 252 data[0][2] = ((gfloat)(queries+content+noise)) / (banddown * dtime / cronSECONDS); /* yellow */
243 data[0][3] = ((gfloat)(queries+content+noise+hellos)) / (banddown * dtime / cronSECONDS); /* blue */ 253 data[0][3] = ((gfloat)(queries+content+noise+hellos)) / (banddown * dtime / cronSECONDS); /* blue */
244 data[0][4] = ((gfloat) total) / (banddown * dtime / cronSECONDS); /* gray */ 254 data[0][4] = ((gfloat) total) / (banddown * dtime / cronSECONDS); /* gray */
255 data[0][5] = ((gfloat) rlimit) / (banddown * dtime / cronSECONDS); /* magenta */
245#if 0 256#if 0
246 printf("I: %f %f %f %f\n", 257 printf("I: %f %f %f %f\n",
247 data[0][0], 258 data[0][0],
@@ -258,11 +269,13 @@ static int getTrafficSendStats(const void * closure,
258 long long content; 269 long long content;
259 long long queries; 270 long long queries;
260 long long hellos; 271 long long hellos;
272 long long slimit;
261 long long ltotal; 273 long long ltotal;
262 long long lnoise; 274 long long lnoise;
263 long long lcontent; 275 long long lcontent;
264 long long lqueries; 276 long long lqueries;
265 long long lhellos; 277 long long lhellos;
278 long long lslimit;
266 cron_t dtime; 279 cron_t dtime;
267 char * buffer; 280 char * buffer;
268 281
@@ -310,6 +323,13 @@ static int getTrafficSendStats(const void * closure,
310 queries = 0; 323 queries = 0;
311 lqueries = 0; 324 lqueries = 0;
312 } 325 }
326 if (OK != getStatValue(&slimit,
327 &lslimit,
328 NULL,
329 "# total allowed bytes per minute transmission limit")) {
330 slimit = 0;
331 lslimit = 0;
332 }
313 FREE(buffer); 333 FREE(buffer);
314 if (bandup == 0) 334 if (bandup == 0)
315 return SYSERR; 335 return SYSERR;
@@ -324,13 +344,15 @@ static int getTrafficSendStats(const void * closure,
324 data[0][2] = 0.0; 344 data[0][2] = 0.0;
325 data[0][3] = 0.0; 345 data[0][3] = 0.0;
326 data[0][4] = 0.0; 346 data[0][4] = 0.0;
347 data[0][5] = 0.0;
327 return OK; 348 return OK;
328 } 349 }
329 data[0][0] = ((gfloat) noise) / (bandup * dtime / cronSECONDS); /* red */ 350 data[0][0] = ((gfloat) noise) / (bandup * dtime / cronSECONDS); /* red */
330 data[0][1] = ((gfloat) (noise + content)) / (bandup*dtime / cronSECONDS); /* green */ 351 data[0][1] = ((gfloat) (noise + content)) / (bandup*dtime / cronSECONDS); /* green */
331 data[0][2] = ((gfloat) (noise + content + queries)) / (bandup*dtime / cronSECONDS); /* yellow */ 352 data[0][2] = ((gfloat) (noise + content + queries)) / (bandup*dtime / cronSECONDS); /* yellow */
332 data[0][3] = ((gfloat) (noise + content + queries + hellos)) / (bandup*dtime / cronSECONDS); /* blue */ 353 data[0][3] = ((gfloat) (noise + content + queries + hellos)) / (bandup*dtime / cronSECONDS); /* blue */
333 data[0][4] = ((gfloat) total) / (bandup*dtime / cronSECONDS); /* blue */ 354 data[0][4] = ((gfloat) total) / (bandup*dtime / cronSECONDS); /* grey */
355 data[0][5] = ((gfloat) slimit) / (bandup*dtime / cronSECONDS); /* magenta */
334#if 0 356#if 0
335 printf("O: %f %f %f %f\n", 357 printf("O: %f %f %f %f\n",
336 data[0][0], 358 data[0][0],
@@ -474,19 +496,19 @@ StatEntry stats[] = {
474 }, 496 },
475 { 497 {
476 gettext_noop("Inbound Traffic"), 498 gettext_noop("Inbound Traffic"),
477 gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos (blue), other (gray)"), 499 gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos (blue), other (gray), limit (magenta)"),
478 &getTrafficRecvStats, 500 &getTrafficRecvStats,
479 NULL, 501 NULL,
502 6,
480 5, 503 5,
481 YES,
482 }, 504 },
483 { 505 {
484 gettext_noop("Outbound Traffic"), 506 gettext_noop("Outbound Traffic"),
485 gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos (blue), other (gray)"), 507 gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos (blue), other (gray), limit (magenta)"),
486 &getTrafficSendStats, 508 &getTrafficSendStats,
487 NULL, 509 NULL,
510 6,
488 5, 511 5,
489 YES,
490 }, 512 },
491 { 513 {
492 gettext_noop("Routing Effectiveness"), 514 gettext_noop("Routing Effectiveness"),
diff --git a/src/plugins/stats/functions.h b/src/plugins/stats/functions.h
index 76ff75d0..ebd54cf1 100644
--- a/src/plugins/stats/functions.h
+++ b/src/plugins/stats/functions.h
@@ -45,7 +45,7 @@ typedef struct SE_ {
45 UpdateData getData; 45 UpdateData getData;
46 void * get_closure; 46 void * get_closure;
47 unsigned int count; 47 unsigned int count;
48 int fill; /* YES / NO */ 48 int fill; /* fill first "fill" entries */
49} StatEntry; 49} StatEntry;
50 50
51extern StatEntry stats[]; 51extern StatEntry stats[];
diff --git a/src/plugins/stats/statistics.c b/src/plugins/stats/statistics.c
index e9375e06..5852c79a 100644
--- a/src/plugins/stats/statistics.c
+++ b/src/plugins/stats/statistics.c
@@ -27,7 +27,7 @@
27#include <GNUnet/gnunet_getoption_lib.h> 27#include <GNUnet/gnunet_getoption_lib.h>
28#include "functions.h" 28#include "functions.h"
29 29
30#define MAX_COLOR 5 30#define MAX_COLOR 6
31#define GNOME_PAD_SMALL 2 31#define GNOME_PAD_SMALL 2
32#define FRAME_WIDTH 0 32#define FRAME_WIDTH 0
33 33
@@ -174,7 +174,7 @@ static void load_graph_draw(LoadGraph *g) {
174 gint y2 = g->data[i+1][j] / max * g->draw_height - 1; 174 gint y2 = g->data[i+1][j] / max * g->draw_height - 1;
175 175
176 if ((g->data[i][j] != -1) && (g->data[i+1][j] != -1)) { 176 if ((g->data[i][j] != -1) && (g->data[i+1][j] != -1)) {
177 if (stats[g->statIdx].fill == NO) { 177 if (stats[g->statIdx].fill <= i) {
178 gdk_draw_line(g->pixmap, g->gc, 178 gdk_draw_line(g->pixmap, g->gc,
179 g->draw_width - x2, 179 g->draw_width - x2,
180 g->draw_height - y2, 180 g->draw_height - y2,
@@ -465,8 +465,10 @@ void init_stats(struct GE_Context * ectx,
465 &config.mem_color[3]); 465 &config.mem_color[3]);
466 gdk_color_parse("gray", 466 gdk_color_parse("gray",
467 &config.mem_color[4]); 467 &config.mem_color[4]);
468 gdk_color_parse("magenta",
469 &config.mem_color[5]);
468 GE_ASSERT(ectx, 470 GE_ASSERT(ectx,
469 MAX_COLOR == 5); 471 MAX_COLOR == 6);
470 i = -1; 472 i = -1;
471 while (stats[++i].paneName != NULL) { 473 while (stats[++i].paneName != NULL) {
472 sys_box = create_sys_view(i, 474 sys_box = create_sys_view(i,