gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29407 - gnunet/src/ats-tests


From: gnunet
Subject: [GNUnet-SVN] r29407 - gnunet/src/ats-tests
Date: Thu, 19 Sep 2013 09:45:10 +0200

Author: wachs
Date: 2013-09-19 09:45:09 +0200 (Thu, 19 Sep 2013)
New Revision: 29407

Modified:
   gnunet/src/ats-tests/perf_ats.c
   gnunet/src/ats-tests/perf_ats_logging.c
Log:
slave logging


Modified: gnunet/src/ats-tests/perf_ats.c
===================================================================
--- gnunet/src/ats-tests/perf_ats.c     2013-09-19 06:49:16 UTC (rev 29406)
+++ gnunet/src/ats-tests/perf_ats.c     2013-09-19 07:45:09 UTC (rev 29407)
@@ -359,21 +359,21 @@
 comm_send_ready (void *cls, size_t size, void *buf)
 {
   static char msgbuf[TEST_MESSAGE_SIZE];
-  struct BenchmarkPartner *partner = cls;
+  struct BenchmarkPartner *p = cls;
   struct GNUNET_MessageHeader *msg;
 
   if (GNUNET_YES == test_core)
-    partner->cth = NULL;
+    p->cth = NULL;
   else
-    partner->tth = NULL;
+    p->tth = NULL;
 
   GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Master [%u]: Sending PING to [%u]\n",
-      partner->me->no, partner->dest->no);
+      p->me->no, p->dest->no);
 
-  partner->messages_sent++;
-  partner->bytes_sent += TEST_MESSAGE_SIZE;
-  partner->me->total_messages_sent++;
-  partner->me->total_bytes_sent += TEST_MESSAGE_SIZE;
+  p->messages_sent++;
+  p->bytes_sent += TEST_MESSAGE_SIZE;
+  p->me->total_messages_sent++;
+  p->me->total_bytes_sent += TEST_MESSAGE_SIZE;
 
   msg = (struct GNUNET_MessageHeader *) &msgbuf;
   memset (&msgbuf, 'a', TEST_MESSAGE_SIZE);
@@ -661,8 +661,8 @@
   struct BenchmarkPartner *p = NULL;
   for (c_m = 0; c_m < num_masters; c_m++)
   {
-    if (0
-        == memcmp (other, &me->partners[c_m].dest->id,
+    /* Find a partner with other as destination */
+    if (0 == memcmp (other, &me->partners[c_m].dest->id,
             sizeof(struct GNUNET_PeerIdentity)))
     {
       p = &me->partners[c_m];

Modified: gnunet/src/ats-tests/perf_ats_logging.c
===================================================================
--- gnunet/src/ats-tests/perf_ats_logging.c     2013-09-19 06:49:16 UTC (rev 
29406)
+++ gnunet/src/ats-tests/perf_ats_logging.c     2013-09-19 07:45:09 UTC (rev 
29407)
@@ -27,19 +27,70 @@
 #include "gnunet_util_lib.h"
 #include "perf_ats.h"
 
-#define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_MILLISECONDS, 100)
+#define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_MILLISECONDS, 500)
 
+
+/**
+ * Logging task
+ */
 static GNUNET_SCHEDULER_TaskIdentifier log_task;
 
-static struct BenchmarkPeer *peers;
+/**
+ * Reference to perf_ats' masters
+ */
 static int num_peers;
 static char *name;
 
-struct LoggingTimestep
+/**
+ * A single logging time step for a partner
+ */
+struct PartnerLoggingTimestep
 {
-  struct LoggingTimestep *next;
-  struct LoggingTimestep *prev;
+  /**
+   * Peer
+   */
+  struct BenchmarkPeer *slave;
 
+  /**
+   * Total number of messages this peer has sent
+   */
+  unsigned int total_messages_sent;
+
+  /**
+   * Total number of bytes this peer has sent
+   */
+  unsigned int total_bytes_sent;
+
+  /**
+   * Total number of messages this peer has received
+   */
+  unsigned int total_messages_received;
+
+  /**
+   * Total number of bytes this peer has received
+   */
+  unsigned int total_bytes_received;
+};
+
+
+/**
+ * A single logging time step for a peer
+ */
+struct PeerLoggingTimestep
+{
+  /**
+   * Next in DLL
+   */
+  struct PeerLoggingTimestep *next;
+
+  /**
+   * Prev in DLL
+   */
+  struct PeerLoggingTimestep *prev;
+
+  /**
+   * Logging timestamp
+   */
   struct GNUNET_TIME_Absolute timestamp;
 
   /**
@@ -61,16 +112,37 @@
    * Total number of bytes this peer has received
    */
   unsigned int total_bytes_received;
+
+  /**
+   * Logs for slaves
+   */
+  struct PartnerLoggingTimestep *slaves_log;
 };
 
+/**
+ * Entry for a benchmark peer
+ */
 struct LoggingPeer
 {
+  /**
+   * Peer
+   */
   struct BenchmarkPeer *peer;
 
+  /**
+   * Start time
+   */
   struct GNUNET_TIME_Absolute start;
 
-  struct LoggingTimestep *head;
-  struct LoggingTimestep *tail;
+  /**
+   * DLL for logging entries: head
+   */
+  struct PeerLoggingTimestep *head;
+
+  /**
+   * DLL for logging entries: tail
+   */
+  struct PeerLoggingTimestep *tail;
 };
 
 /**
@@ -85,8 +157,9 @@
   struct GNUNET_DISK_FileHandle *f;
   char * filename;
   char *data;
-  struct LoggingTimestep *cur;
+  struct PeerLoggingTimestep *cur;
   int c_m;
+  //int c_s;
   unsigned int throughput_recv;
   unsigned int throughput_send;
   double mult;
@@ -128,6 +201,8 @@
           cur->total_messages_sent, cur->total_bytes_sent, throughput_send,
           cur->total_messages_received, cur->total_bytes_received, 
throughput_recv);
 
+//      for ()
+
       GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u\n",
           cur->timestamp,
           
GNUNET_TIME_absolute_get_difference(lp[c_m].start,cur->timestamp).rel_value_us 
/ 1000,
@@ -156,31 +231,40 @@
 {
   int c_m;
   int c_s;
-  struct LoggingTimestep *lt;
+  struct PeerLoggingTimestep *mlt;
+  struct PartnerLoggingTimestep *slt;
   struct BenchmarkPartner *p;
 
   log_task = GNUNET_SCHEDULER_NO_TASK;
 
   for (c_m = 0; c_m < num_peers; c_m++)
   {
-    lt = GNUNET_malloc (sizeof (struct LoggingTimestep));
-    GNUNET_CONTAINER_DLL_insert_tail(lp[c_m].head, lp[c_m].tail, lt);
+    mlt = GNUNET_malloc (sizeof (struct PeerLoggingTimestep));
+    GNUNET_CONTAINER_DLL_insert_tail(lp[c_m].head, lp[c_m].tail, mlt);
 
     /* Collect data */
-    lt->timestamp = GNUNET_TIME_absolute_get();
-    lt->total_bytes_sent = lp[c_m].peer->total_bytes_sent;
-    lt->total_messages_sent = lp[c_m].peer->total_messages_sent;
-    lt->total_bytes_received = lp[c_m].peer->total_bytes_received;
-    lt->total_messages_received = lp[c_m].peer->total_messages_received;
+    mlt->timestamp = GNUNET_TIME_absolute_get();
+    mlt->total_bytes_sent = lp[c_m].peer->total_bytes_sent;
+    mlt->total_messages_sent = lp[c_m].peer->total_messages_sent;
+    mlt->total_bytes_received = lp[c_m].peer->total_bytes_received;
+    mlt->total_messages_received = lp[c_m].peer->total_messages_received;
 
+    mlt->slaves_log = GNUNET_malloc (lp[c_m].peer->num_partners *
+        sizeof (struct PartnerLoggingTimestep));
+
     for (c_s = 0; c_s < lp[c_m].peer->num_partners; c_s++)
     {
-      p = &peers[c_m].partners[c_s];
-/*
+      p = &lp[c_m].peer->partners[c_s];
+      slt = &mlt->slaves_log[c_s];
+      slt->slave = p->dest;
+      slt->total_bytes_sent = p->dest->total_bytes_sent;
+      slt->total_messages_sent = p->dest->total_messages_sent;
+      slt->total_bytes_received = p->dest->total_bytes_received;
+      slt->total_messages_received = p->dest->total_messages_received;
+
       GNUNET_log(GNUNET_ERROR_TYPE_INFO,
           "Master [%u]: slave [%u]\n",
           lp->peer->no, p->dest->no);
-*/
     }
   }
 
@@ -197,7 +281,7 @@
 {
   int c_m;
   struct GNUNET_SCHEDULER_TaskContext tc;
-  struct LoggingTimestep *cur;
+  struct PeerLoggingTimestep *cur;
 
   if (GNUNET_SCHEDULER_NO_TASK != log_task)
     GNUNET_SCHEDULER_cancel (log_task);
@@ -215,6 +299,7 @@
     while (NULL != (cur = lp[c_m].head))
     {
       GNUNET_CONTAINER_DLL_remove (lp[c_m].head, lp[c_m].tail, cur);
+      GNUNET_free (cur->slaves_log);
       GNUNET_free (cur);
     }
   }
@@ -229,7 +314,6 @@
   GNUNET_log(GNUNET_ERROR_TYPE_INFO,
       _("Start logging `%s'\n"), testname);
 
-  peers = masters;
   num_peers = num_masters;
   name = testname;
 




reply via email to

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