gnunet-svn
[Top][All Lists]
Advanced

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

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


From: grothoff
Subject: [GNUnet-SVN] r2796 - gnunet-gtk/src/plugins/stats
Date: Sat, 13 May 2006 18:28:01 -0700 (PDT)

Author: grothoff
Date: 2006-05-13 18:28:00 -0700 (Sat, 13 May 2006)
New Revision: 2796

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

Modified: gnunet-gtk/src/plugins/stats/functions.c
===================================================================
--- gnunet-gtk/src/plugins/stats/functions.c    2006-05-14 01:24:11 UTC (rev 
2795)
+++ gnunet-gtk/src/plugins/stats/functions.c    2006-05-14 01:28:00 UTC (rev 
2796)
@@ -285,13 +285,22 @@
 
 static int getEffectivenessStats(const void * closure,
                                 gfloat ** data) {
+  static cron_t last;
+  static double lastdata;
   long long total;
   long long success;
   long long local;
   long long ltotal;
   long long lsuccess;
   long long llocal;
-
+  cron_t now;
+  
+  cronTime(&now);
+  if (now < last + 2 * cronMINUTES) {
+    data[0][0] = lastadata;
+    return OK;
+  }
+  last = now;
   if (OK != getStatValue(&total,       
                         &ltotal,
                         NULL,
@@ -308,13 +317,15 @@
                          "# gap requests processed: local result"))
     return SYSERR;
   total -= ltotal;
+  data[0][0] = 0.0;
+  if (total == 0) 
+    return OK;  
   success -= lsuccess;
   local -= llocal;
-  data[0][0] = 0.0;
   if (success <= local)
     return OK;
   success -= local;
-  data[0][0] = 1.0 * success / total;
+  data[0][0] = lastdata = 1.0 * success / total;
   return OK;
 }
 





reply via email to

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