gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r15954 - gnunet/src/fragmentation


From: gnunet
Subject: [GNUnet-SVN] r15954 - gnunet/src/fragmentation
Date: Thu, 14 Jul 2011 14:04:07 +0200

Author: grothoff
Date: 2011-07-14 14:04:07 +0200 (Thu, 14 Jul 2011)
New Revision: 15954

Modified:
   gnunet/src/fragmentation/defragmentation.c
   gnunet/src/fragmentation/fragmentation.c
Log:
nicer stats, bugfix

Modified: gnunet/src/fragmentation/defragmentation.c
===================================================================
--- gnunet/src/fragmentation/defragmentation.c  2011-07-14 11:28:36 UTC (rev 
15953)
+++ gnunet/src/fragmentation/defragmentation.c  2011-07-14 12:04:07 UTC (rev 
15954)
@@ -270,6 +270,10 @@
   fa.header.type = htons (GNUNET_MESSAGE_TYPE_FRAGMENT_ACK);
   fa.fragment_id = htonl (mc->fragment_id);
   fa.bits = GNUNET_htonll (mc->bits);
+  GNUNET_STATISTICS_update (mc->dc->stats,
+                           _("# acknowledgements sent for fragment"),
+                           1,
+                           GNUNET_NO);
   dc->ackp (dc->cls, mc->fragment_id, &fa.header);
 }
 
@@ -445,7 +449,7 @@
       return GNUNET_SYSERR;
     }
   GNUNET_STATISTICS_update (dc->stats,
-                           _("Fragments received"),
+                           _("# fragments received"),
                            1,
                            GNUNET_NO);
   mc = dc->head;
@@ -509,7 +513,7 @@
     {
       duplicate = GNUNET_YES;
       GNUNET_STATISTICS_update (dc->stats,
-                               _("Duplicate fragments received"),
+                               _("# duplicate fragments received"),
                                1,
                                GNUNET_NO);
     }
@@ -533,7 +537,7 @@
        (0 == mc->bits) )
     {
       GNUNET_STATISTICS_update (dc->stats,
-                               _("Messages defragmented"),
+                               _("# messages defragmented"),
                                1,
                                GNUNET_NO);
       /* message complete, notify! */

Modified: gnunet/src/fragmentation/fragmentation.c
===================================================================
--- gnunet/src/fragmentation/fragmentation.c    2011-07-14 11:28:36 UTC (rev 
15953)
+++ gnunet/src/fragmentation/fragmentation.c    2011-07-14 12:04:07 UTC (rev 
15954)
@@ -49,6 +49,11 @@
   struct GNUNET_TIME_Relative delay;
 
   /**
+   * Next allowed transmission time.
+   */
+  struct GNUNET_TIME_Absolute delay_until;
+
+  /**
    * Time we transmitted the last message of the last round.
    */
   struct GNUNET_TIME_Absolute last_round;
@@ -173,11 +178,11 @@
   if (NULL != fc->tracker)
     GNUNET_BANDWIDTH_tracker_consume (fc->tracker, fsize);    
   GNUNET_STATISTICS_update (fc->stats,
-                           _("Fragments transmitted"),
+                           _("# fragments transmitted"),
                            1, GNUNET_NO);
   if (0 != fc->last_round.abs_value)
     GNUNET_STATISTICS_update (fc->stats,
-                             _("Fragments retransmitted"),
+                             _("# fragments retransmitted"),
                              1, GNUNET_NO);
 
   /* select next message to calculate delay */
@@ -201,6 +206,7 @@
       fc->wack = GNUNET_YES;
     }
   fc->proc_busy = GNUNET_YES;
+  fc->delay_until = GNUNET_TIME_relative_to_absolute (delay);
   fc->proc (fc->proc_cls, &fh->header);
 }
 
@@ -237,12 +243,12 @@
   uint64_t bits;
   
   GNUNET_STATISTICS_update (stats,
-                           _("Messages fragmented"),
+                           _("# messages fragmented"),
                            1, GNUNET_NO);
   GNUNET_assert (mtu >= 1024 + sizeof (struct FragmentHeader));
   size = ntohs (msg->size);
   GNUNET_STATISTICS_update (stats,
-                           _("Total size of fragmented messages"),
+                           _("# total size of fragmented messages"),
                            size, GNUNET_NO);
   GNUNET_assert (size > mtu);
   fc = GNUNET_malloc (sizeof (struct GNUNET_FRAGMENT_Context) + size);
@@ -281,8 +287,9 @@
   GNUNET_assert (fc->proc_busy == GNUNET_YES);
   fc->proc_busy = GNUNET_NO;
   GNUNET_assert (fc->task == GNUNET_SCHEDULER_NO_TASK);
-  fc->task = GNUNET_SCHEDULER_add_now (&transmit_next,
-                                      fc);
+  fc->task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining 
(fc->delay_until),
+                                          &transmit_next,
+                                          fc);
 }
 
 
@@ -322,11 +329,15 @@
       ndelay = GNUNET_TIME_absolute_get_duration (fc->last_round);
       fc->delay.rel_value = (ndelay.rel_value + 3 * fc->delay.rel_value) / 4;
     }
+  GNUNET_STATISTICS_update (fc->stats,
+                           _("# fragment acknowledgements received"),
+                           1,
+                           GNUNET_NO);
   if (abits != (fc->acks & abits))
     {
       /* ID collission or message reordering, count! This should be rare! */
       GNUNET_STATISTICS_update (fc->stats,
-                               _("Bits removed from ACK"),
+                               _("# bits removed from fragmentation ACKs"),
                                1, GNUNET_NO);
     }
   fc->acks = abits;
@@ -340,6 +351,10 @@
     }
 
   /* all done */
+  GNUNET_STATISTICS_update (fc->stats,
+                           _("# fragmentation transmissions completed"),
+                           1,
+                           GNUNET_NO);
   if (fc->task != GNUNET_SCHEDULER_NO_TASK)
     {
       GNUNET_SCHEDULER_cancel (fc->task);




reply via email to

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