gnunet-svn
[Top][All Lists]
Advanced

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

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


From: grothoff
Subject: [GNUnet-SVN] r2799 - gnunet-gtk/src/plugins/stats
Date: Sat, 13 May 2006 19:02:13 -0700 (PDT)

Author: grothoff
Date: 2006-05-13 19:02:12 -0700 (Sat, 13 May 2006)
New Revision: 2799

Modified:
   gnunet-gtk/src/plugins/stats/functions.c
Log:
average

Modified: gnunet-gtk/src/plugins/stats/functions.c
===================================================================
--- gnunet-gtk/src/plugins/stats/functions.c    2006-05-14 01:31:26 UTC (rev 
2798)
+++ gnunet-gtk/src/plugins/stats/functions.c    2006-05-14 02:02:12 UTC (rev 
2799)
@@ -287,6 +287,7 @@
                                 gfloat ** data) {
   static cron_t last;
   static double lastdata;
+  static double lastavg;
   long long total;
   long long success;
   long long local;
@@ -298,6 +299,7 @@
   cronTime(&now);
   if (now < last + 2 * cronMINUTES) {
     data[0][0] = lastdata;
+    data[0][1] = lastavg;
     return OK;
   }
   last = now;
@@ -318,6 +320,12 @@
     return SYSERR;
   total -= ltotal;
   data[0][0] = 0.0;
+  if (ltotal + total > 0) {
+    data[0][1] = lastavg = 1.0 * (success + lsuccess - local - llocal) / 
(total + ltotal);
+  } else {
+    data[0][1] = 0.0;
+    return OK;
+  }
   if (total == 0) 
     return OK;  
   success -= lsuccess;
@@ -325,6 +333,7 @@
   if (success <= local)
     return OK;
   success -= local;
+  lsuccess -= llocal;
   data[0][0] = lastdata = 1.0 * success / total;
   return OK;
 }
@@ -413,10 +422,10 @@
   },
   {
     gettext_noop("Routing Effectiveness"),
-    gettext_noop("Higher is better (successful routes per forwarded query)"),
+    gettext_noop("Current (red) and average (green) effectiveness (100% = 
perfect)"),
     &getEffectivenessStats,
     NULL,
-    1,
+    2,
     NO,
   },
   {





reply via email to

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