even more stats, more logging
authorChristian Grothoff <christian@grothoff.org>
Wed, 19 Oct 2011 13:11:26 +0000 (13:11 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 19 Oct 2011 13:11:26 +0000 (13:11 +0000)
src/fs/gnunet-service-fs_cp.c
src/fs/gnunet-service-fs_pe.c

index 7643bdc9e04ea5ce10c28ec85aa279f10599ca5e..35a21f07a2376ec81cc62c33a8e6b55954e30210 100644 (file)
@@ -551,11 +551,10 @@ ats_reserve_callback (void *cls, const struct GNUNET_PeerIdentity *peer,
   struct GSF_ConnectedPeer *cp = cls;
   struct GSF_PeerTransmitHandle *pth;
 
-  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
-                  "fs-ats-r",
-                  "Reserved %d bytes / need to wait %llu ms for reservation\n",
-                  (int) amount,
-                  (unsigned long long) res_delay.rel_value);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Reserved %d bytes / need to wait %llu ms for reservation\n",
+             (int) amount,
+             (unsigned long long) res_delay.rel_value);
   cp->rc = NULL;
   if (0 == amount)
   {
@@ -595,10 +594,9 @@ GSF_peer_connect_handler_ (const struct GNUNET_PeerIdentity *peer,
   char *fn;
   uint32_t trust;
 
-  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
-                  "fs-ats-r",
-                  "Connected to peer %s\n",
-                  GNUNET_i2s (peer));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Connected to peer %s\n",
+             GNUNET_i2s (peer));
   cp = GNUNET_malloc (sizeof (struct GSF_ConnectedPeer));
   cp->ppd.pid = GNUNET_PEER_intern (peer);
   cp->ppd.transmission_delay = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_ZERO);
@@ -697,6 +695,10 @@ GSF_handle_p2p_migration_stop_ (void *cls,
     GNUNET_break (0);
     return GNUNET_OK;
   }
+  GNUNET_STATISTICS_update (GSF_stats,
+                           gettext_noop
+                           ("# migration stop messages received"),
+                           1, GNUNET_NO);
   bt = GNUNET_TIME_relative_ntoh (msm->duration);
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               _("Migration of content to peer `%s' blocked for %llu ms\n"),
index ed59c59e603e3e7d6f2066764c83bf85939decc1..10c522299e5f6b0da057a9fdff9c31302d7d9ca1 100644 (file)
@@ -302,6 +302,9 @@ transmit_message_callback (void *cls, size_t buf_size, void *buf)
   {
     /* failed, try again... */
     pp->task = GNUNET_SCHEDULER_add_now (&schedule_peer_transmission, pp);
+    GNUNET_STATISTICS_update (GSF_stats,
+                             gettext_noop ("# transmission failed (core has no bandwidth)"), 1,
+                             GNUNET_NO);
     return 0;
   }
   rp = GNUNET_CONTAINER_heap_peek (pp->priority_heap);
@@ -350,6 +353,7 @@ schedule_peer_transmission (void *cls,
   struct PeerPlan *pp = cls;
   struct GSF_RequestPlan *rp;
   size_t msize;
+  struct GNUNET_TIME_Relative delay;
 
   pp->task = GNUNET_SCHEDULER_NO_TASK;
   if (pp->pth != NULL)
@@ -357,6 +361,14 @@ schedule_peer_transmission (void *cls,
     GSF_peer_transmit_cancel_ (pp->pth);
     pp->pth = NULL;
   }
+  GNUNET_STATISTICS_set (GSF_stats,
+                        gettext_noop ("# query delay heap size"), 
+                        GNUNET_CONTAINER_heap_get_size (pp->delay_heap),
+                        GNUNET_NO);
+  GNUNET_STATISTICS_set (GSF_stats,
+                        gettext_noop ("# query priority heap size"), 
+                        GNUNET_CONTAINER_heap_get_size (pp->priority_heap),
+                        GNUNET_NO);
   /* move ready requests to priority queue */
   while ((NULL != (rp = GNUNET_CONTAINER_heap_peek (pp->delay_heap))) &&
          (GNUNET_TIME_absolute_get_remaining
@@ -377,19 +389,26 @@ schedule_peer_transmission (void *cls,
 #endif
       return;                   /* both queues empty */
     }
+    delay = GNUNET_TIME_absolute_get_remaining (rp->earliest_transmission);
 #if DEBUG_FS
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Sleeping for %llu ms before retrying requests on plan %p.\n",
                 (unsigned long long)
-                GNUNET_TIME_absolute_get_remaining
-                (rp->earliest_transmission).rel_value, pp);
+                delay.rel_value, pp);
 #endif
+    GNUNET_STATISTICS_set (GSF_stats,
+                          gettext_noop ("# delay heap timeout"), 
+                          delay.rel_value,
+                          GNUNET_NO);
+    
     pp->task =
-        GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining
-                                      (rp->earliest_transmission),
+      GNUNET_SCHEDULER_add_delayed (delay,
                                       &schedule_peer_transmission, pp);
     return;
   }
+  GNUNET_STATISTICS_update (GSF_stats,
+                            gettext_noop ("# query plans executed"), 1,
+                            GNUNET_NO);
   /* process from priority heap */
   rp = GNUNET_CONTAINER_heap_peek (pp->priority_heap);
 #if DEBUG_FS > 1