gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r4120 - GNUnet/src/applications/dstore


From: grothoff
Subject: [GNUnet-SVN] r4120 - GNUnet/src/applications/dstore
Date: Fri, 29 Dec 2006 21:55:47 -0800 (PST)

Author: grothoff
Date: 2006-12-29 21:55:44 -0800 (Fri, 29 Dec 2006)
New Revision: 4120

Modified:
   GNUnet/src/applications/dstore/dstore.c
Log:
stats

Modified: GNUnet/src/applications/dstore/dstore.c
===================================================================
--- GNUnet/src/applications/dstore/dstore.c     2006-12-30 05:51:23 UTC (rev 
4119)
+++ GNUnet/src/applications/dstore/dstore.c     2006-12-30 05:55:44 UTC (rev 
4120)
@@ -33,6 +33,7 @@
 #include "platform.h"
 #include "gnunet_util.h"
 #include "gnunet_dstore_service.h"
+#include "gnunet_stats_service.h"
 #include <sqlite3.h>
 
 #define DEBUG_DSTORE NO
@@ -62,6 +63,13 @@
 static struct MUTEX * lock;
 
 /**
+ * Statistics service.
+ */
+static Stats_ServiceAPI * stats;
+
+static unsigned int stat_dstore_size;
+
+/**
  * @brief Prepare a SQL statement
  */
 static int sq_prepare(sqlite3 * dbh,
@@ -280,6 +288,8 @@
   }
   sqlite3_close(dbh);
   MUTEX_UNLOCK(lock);
+  if (stats != NULL)
+    stats->change(stat_dstore_size, payload);
   return OK;
 }
 
@@ -379,6 +389,9 @@
   api.get = &d_get;
   api.put = &d_put;
   quota = 1024 * 1024; /* FIXME: allow user to configure */
+  stats = capi->requestService("stats");
+  if (stats != NULL) 
+    stat_dstore_size = stats->create(gettext_noop("# bytes in dstore"));
   return &api;
 }
 
@@ -389,6 +402,10 @@
   UNLINK(fn);
   FREE(fn);
   fn = NULL;
+  if (stats != NULL) {
+    coreAPI->releaseService(stats);
+    stats = NULL;
+  }
 #if DEBUG_SQLITE
   GE_LOG(coreAPI->ectx,
         GE_DEBUG | GE_REQUEST | GE_USER,





reply via email to

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