gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3763 - GNUnet/src/applications/datastore gnunet-gtk/src/pl


From: grothoff
Subject: [GNUnet-SVN] r3763 - GNUnet/src/applications/datastore gnunet-gtk/src/plugins/stats
Date: Mon, 13 Nov 2006 20:56:44 -0800 (PST)

Author: grothoff
Date: 2006-11-13 20:56:35 -0800 (Mon, 13 Nov 2006)
New Revision: 3763

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

Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c       2006-11-14 04:53:08 UTC 
(rev 3762)
+++ GNUnet/src/applications/datastore/datastore.c       2006-11-14 04:56:35 UTC 
(rev 3763)
@@ -357,7 +357,7 @@
     = lquota * 1024 * 1024; /* MB to bytes */
   stats = capi->requestService("stats");
   if (stats != NULL) {
-    stats->set(stats->create(gettext_noop("# bytes allowed for datastore")),
+    stats->set(stats->create(gettext_noop("# bytes allowed in datastore")),
               quota);
     capi->releaseService(stats);
   }

Modified: gnunet-gtk/src/plugins/stats/functions.c
===================================================================
--- gnunet-gtk/src/plugins/stats/functions.c    2006-11-14 04:53:08 UTC (rev 
3762)
+++ gnunet-gtk/src/plugins/stats/functions.c    2006-11-14 04:56:35 UTC (rev 
3763)
@@ -140,6 +140,27 @@
   return OK;
 }
 
+static int getQuotaStat(const void * closure,
+                       gfloat ** data) {
+  long long allowed;
+  long long have;
+
+  if (OK != getStatValue(&allowed,
+                        NULL,
+                        NULL,
+                       "# bytes allowed in datastore"))
+    return SYSERR;
+  if (allowed == 0)
+    return SYSERR;
+  if (OK != getStatValue(&have,
+                        NULL,
+                        NULL,
+                       "# bytes in datastore"))
+    return SYSERR;
+  data[0][0] = ((gfloat) have) / allowed;
+  return OK;
+}
+
 static int getTrafficRecvStats(const void * closure,
                               gfloat ** data) {
   long long total;
@@ -427,7 +448,7 @@
 
 
 StatEntry stats[] = {
- {
+  {
     gettext_noop("Connectivity"),
     gettext_noop("# connected nodes (100% = connection table size)"),
     &getConnectedNodesStat,
@@ -444,6 +465,14 @@
     NO,
   },
   {
+    gettext_noop("Datastore capacity"),
+    gettext_noop("Data in datastore (in percent of allowed quota)"),
+    &getQuotaStat,
+    NULL,
+    1,
+    NO,
+  },
+  {
     gettext_noop("Inbound Traffic"),
     gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos 
(blue), other (gray)"),
     &getTrafficRecvStats,





reply via email to

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