gnunet-svn
[Top][All Lists]
Advanced

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

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


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

Author: grothoff
Date: 2006-05-13 18:21:41 -0700 (Sat, 13 May 2006)
New Revision: 2794

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:04:22 UTC (rev 
2793)
+++ gnunet-gtk/src/plugins/stats/functions.c    2006-05-14 01:21:41 UTC (rev 
2794)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     (C) 2004, 2005 Christian Grothoff (and other contributing authors)
+     (C) 2004, 2005, 2006 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -283,6 +283,42 @@
 }
 
 
+static int getEffectivenessStats(const void * closure,
+                                gfloat ** data) {
+  long long total;
+  long long success;
+  long long local;
+  long long ltotal;
+  long long lsuccess;
+  long long llocal;
+
+  if (OK != getStatValue(&total,       
+                        &ltotal,
+                        NULL,
+                         "# gap requests forwarded (counting each peer)"))
+    return SYSERR;
+  if (OK != getStatValue(&success,
+                        &lsuccess,
+                        NULL,
+                         "# gap routing successes (total)"))
+    return SYSERR;
+  if (OK != getStatValue(&local,
+                        &llocal,
+                        NULL,
+                         "# gap requests processed: local result"))
+    return SYSERR;
+  total -= ltotal;
+  success -= lsuccess;
+  local -= llocal;
+  data[0][0] = 0.0;
+  if (success <= local)
+    return OK;
+  success -= local;
+  data[0][0] = 1.0 * success / total;
+  return OK;
+}
+
+
 static int statsProcessor(const char * optName,
                          unsigned long long value,
                          void * data) {
@@ -365,11 +401,19 @@
     YES,
   },
   {
+    gettext_noop("Routing Effectiveness"),
+    gettext_noop("Higher is better (successful routes per forwarded query)"),
+    &getEffectivenessStats,
     NULL,
+    1,
+    YES,
+  },
+  {
     NULL,
     NULL,
     NULL,
-    1,
+    NULL,
+    0,
     NO,
   },
 };





reply via email to

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