gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r9235 - in gnunet/src: datastore hostlist include statistic


From: gnunet
Subject: [GNUnet-SVN] r9235 - in gnunet/src: datastore hostlist include statistics
Date: Wed, 21 Oct 2009 06:44:37 -0600

Author: grothoff
Date: 2009-10-21 06:44:37 -0600 (Wed, 21 Oct 2009)
New Revision: 9235

Modified:
   gnunet/src/datastore/Makefile.am
   gnunet/src/datastore/gnunet-service-datastore.c
   gnunet/src/datastore/plugin_datastore_sqlite.c
   gnunet/src/hostlist/hostlist-client.c
   gnunet/src/include/gnunet_statistics_service.h
   gnunet/src/statistics/gnunet-statistics.c
   gnunet/src/statistics/statistics_api.c
Log:
extra debug for datastore, stats api fix

Modified: gnunet/src/datastore/Makefile.am
===================================================================
--- gnunet/src/datastore/Makefile.am    2009-10-20 20:33:59 UTC (rev 9234)
+++ gnunet/src/datastore/Makefile.am    2009-10-21 12:44:37 UTC (rev 9235)
@@ -44,6 +44,7 @@
   plugin_datastore_sqlite.c
 libgnunet_plugin_datastore_sqlite_la_LIBADD = \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
+  $(top_builddir)/src/arm/libgnunetarm.la \
   $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3
 libgnunet_plugin_datastore_sqlite_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)

Modified: gnunet/src/datastore/gnunet-service-datastore.c
===================================================================
--- gnunet/src/datastore/gnunet-service-datastore.c     2009-10-20 20:33:59 UTC 
(rev 9234)
+++ gnunet/src/datastore/gnunet-service-datastore.c     2009-10-21 12:44:37 UTC 
(rev 9235)
@@ -134,11 +134,10 @@
 static unsigned long long quota;
 
 /**
- * How much space are we using for the cache?
- * (space available for insertions that will be
- *  instantly reclaimed by discarding less 
- *  important content --- or possibly whatever
- *  we just inserted into the "cache").
+ * How much space are we using for the cache?  (space available for
+ * insertions that will be instantly reclaimed by discarding less
+ * important content --- or possibly whatever we just inserted into
+ * the "cache").
  */
 static unsigned long long cache_size;
 
@@ -354,7 +353,7 @@
                             (0 == *need) ? GNUNET_YES : GNUNET_NO);
 #if DEBUG_DATASTORE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Deleting %llu bytes of low-priority content (still trying to 
recover %llu bytes)\n",
+             "Deleting %llu bytes of low-priority content (still trying to 
free another %llu bytes)\n",
              size + GNUNET_DATASTORE_ENTRY_OVERHEAD,
              *need);
 #endif
@@ -383,7 +382,7 @@
 
 #if DEBUG_DATASTORE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-             "Asked to recover %llu bytes of cache space\n",
+             "Asked to free up %llu bytes of cache space\n",
              need);
 #endif
   n = GNUNET_malloc (sizeof(unsigned long long));

Modified: gnunet/src/datastore/plugin_datastore_sqlite.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_sqlite.c      2009-10-20 20:33:59 UTC 
(rev 9234)
+++ gnunet/src/datastore/plugin_datastore_sqlite.c      2009-10-21 12:44:37 UTC 
(rev 9235)
@@ -25,11 +25,12 @@
  */
 
 #include "platform.h"
+#include "gnunet_arm_service.h"
 #include "gnunet_statistics_service.h"
 #include "plugin_datastore.h"
 #include <sqlite3.h>
 
-#define DEBUG_SQLITE GNUNET_NO
+#define DEBUG_SQLITE GNUNET_YES
 
 /**
  * After how many payload-changing operations
@@ -614,11 +615,28 @@
       nc->end_it = GNUNET_YES;
       return;
     }
+#if DEBUG_SQLITE
+  if (ret == GNUNET_NO)
+    GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+                    "sqlite",
+                    "Asked to remove entry %llu (%u bytes)\n",
+                    (unsigned long long) rowid,
+                    size + GNUNET_DATASTORE_ENTRY_OVERHEAD);
+#endif
   if ( (ret == GNUNET_NO) &&
        (GNUNET_OK == delete_by_rowid (plugin, rowid)) )
     {
       plugin->payload -= (size + GNUNET_DATASTORE_ENTRY_OVERHEAD);
       plugin->lastSync++; 
+#if DEBUG_SQLITE
+      if (ret == GNUNET_NO)
+       GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+                        "sqlite",
+                        "Removed entry %llu (%u bytes), new payload is %llu\n",
+                        (unsigned long long) rowid,
+                        size + GNUNET_DATASTORE_ENTRY_OVERHEAD,
+                        (unsigned long long) plugin->payload);
+#endif
       if (plugin->lastSync >= MAX_STAT_SYNC_LAG)
        sync_stats (plugin);
     }
@@ -741,6 +759,13 @@
                 GNUNET_ERROR_TYPE_BULK, "sqlite3_reset");
   plugin->lastSync++;
   plugin->payload += size + GNUNET_DATASTORE_ENTRY_OVERHEAD;
+#if DEBUG_SQLITE
+  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+                  "sqlite",
+                  "Stored new entry (%u bytes), new payload is %llu\n",
+                  size + GNUNET_DATASTORE_ENTRY_OVERHEAD,
+                  (unsigned long long) plugin->payload);
+#endif
   if (plugin->lastSync >= MAX_STAT_SYNC_LAG)
     sync_stats (plugin);
   return GNUNET_OK;
@@ -1522,11 +1547,18 @@
 process_stat_in (void *cls,
                 const char *subsystem,
                 const char *name,
-                unsigned long long value,
+                uint64_t value,
                 int is_persistent)
 {
   struct Plugin *plugin = cls;
   plugin->payload += value;
+#if DEBUG_SQLITE
+  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+                  "sqlite",
+                  "Notification from statistics about existing payload (%llu), 
new payload is %llu\n",
+                  value,
+                  (unsigned long long) plugin->payload);
+#endif
   return GNUNET_OK;
 }
                                         
@@ -1548,6 +1580,7 @@
     return NULL; /* can only initialize once! */
   memset (&plugin, 0, sizeof(struct Plugin));
   plugin.env = env;
+  GNUNET_ARM_start_services (env->cfg, env->sched, "statistics");
   plugin.statistics = GNUNET_STATISTICS_create (env->sched,
                                                "sqlite",
                                                env->cfg);
@@ -1562,6 +1595,7 @@
       database_setup (env->cfg, &plugin))
     {
       database_shutdown (&plugin);
+      GNUNET_ARM_stop_services (env->cfg, env->sched, "statistics");
       return NULL;
     }
   api = GNUNET_malloc (sizeof (struct GNUNET_DATASTORE_PluginFunctions));
@@ -1603,6 +1637,7 @@
   plugin->env = NULL; 
   plugin->payload = 0;
   GNUNET_STATISTICS_destroy (plugin->statistics);
+  GNUNET_ARM_stop_services (plugin->env->cfg, plugin->env->sched, 
"statistics");
   GNUNET_free (api);
   if (fn != NULL)
     {

Modified: gnunet/src/hostlist/hostlist-client.c
===================================================================
--- gnunet/src/hostlist/hostlist-client.c       2009-10-20 20:33:59 UTC (rev 
9234)
+++ gnunet/src/hostlist/hostlist-client.c       2009-10-21 12:44:37 UTC (rev 
9235)
@@ -607,10 +607,10 @@
 process_stat (void *cls,
              const char *subsystem,
              const char *name,
-             unsigned long long value,
+             uint64_t value,
              int is_persistent)
 {
-  hostlist_delay.value = (uint64_t) value;
+  hostlist_delay.value = value;
   return GNUNET_OK;
 }
 

Modified: gnunet/src/include/gnunet_statistics_service.h
===================================================================
--- gnunet/src/include/gnunet_statistics_service.h      2009-10-20 20:33:59 UTC 
(rev 9234)
+++ gnunet/src/include/gnunet_statistics_service.h      2009-10-21 12:44:37 UTC 
(rev 9235)
@@ -64,7 +64,7 @@
 typedef int (*GNUNET_STATISTICS_Iterator) (void *cls,
                                            const char *subsystem,
                                            const char *name,
-                                           unsigned long long value,
+                                           uint64_t value,
                                            int is_persistent);
 
 /**
@@ -129,7 +129,7 @@
 void
 GNUNET_STATISTICS_set (struct GNUNET_STATISTICS_Handle *handle,
                        const char *name,
-                       unsigned long long value, int make_persistent);
+                       uint64_t value, int make_persistent);
 
 /**
  * Set statistic value for the peer.  Will always use our
@@ -143,7 +143,7 @@
 void
 GNUNET_STATISTICS_update (struct GNUNET_STATISTICS_Handle *handle,
                           const char *name,
-                          long long delta, int make_persistent);
+                          int64_t delta, int make_persistent);
 
 
 

Modified: gnunet/src/statistics/gnunet-statistics.c
===================================================================
--- gnunet/src/statistics/gnunet-statistics.c   2009-10-20 20:33:59 UTC (rev 
9234)
+++ gnunet/src/statistics/gnunet-statistics.c   2009-10-21 12:44:37 UTC (rev 
9235)
@@ -65,11 +65,13 @@
 static int
 printer (void *cls,
          const char *subsystem,
-         const char *name, unsigned long long value, int is_persistent)
+         const char *name, 
+        uint64_t value, int is_persistent)
 {
   FPRINTF (stdout,
            "%s%-20s %-40s: %16llu\n",
-           is_persistent ? "!" : " ", subsystem, _(name), value);
+           is_persistent ? "!" : " ", subsystem, _(name),
+          (unsigned long long) value);
   return GNUNET_OK;
 }
 
@@ -127,7 +129,7 @@
           ret = 1;
           return;
         }
-      GNUNET_STATISTICS_set (h, name, val, persistent);
+      GNUNET_STATISTICS_set (h, name, (uint64_t) val, persistent);
       GNUNET_STATISTICS_destroy (h);
       return;
     }

Modified: gnunet/src/statistics/statistics_api.c
===================================================================
--- gnunet/src/statistics/statistics_api.c      2009-10-20 20:33:59 UTC (rev 
9234)
+++ gnunet/src/statistics/statistics_api.c      2009-10-21 12:44:37 UTC (rev 
9235)
@@ -88,7 +88,7 @@
   /**
    * Associated value.
    */
-  unsigned long long value;
+  uint64_t value;
 
   /**
    * Flag for SET/UPDATE actions.
@@ -630,7 +630,7 @@
 add_setter_action (struct GNUNET_STATISTICS_Handle *h,
                    const char *name,
                    int make_persistent,
-                   unsigned long long value, enum ActionType type)
+                   uint64_t value, enum ActionType type)
 {
   struct ActionItem *ai;
   size_t slen;
@@ -674,7 +674,7 @@
 void
 GNUNET_STATISTICS_set (struct GNUNET_STATISTICS_Handle *handle,
                        const char *name,
-                       unsigned long long value, int make_persistent)
+                       uint64_t value, int make_persistent)
 {
   add_setter_action (handle, name, make_persistent, value, ACTION_SET);
 }
@@ -692,7 +692,7 @@
 void
 GNUNET_STATISTICS_update (struct GNUNET_STATISTICS_Handle *handle,
                           const char *name,
-                          long long delta, int make_persistent)
+                          int64_t delta, int make_persistent)
 {
   add_setter_action (handle, name, make_persistent,
                      (unsigned long long) delta, ACTION_UPDATE);





reply via email to

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