aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ats-tests/perf_ats.c20
-rw-r--r--src/ats-tests/perf_ats_logging.c126
2 files changed, 115 insertions, 31 deletions
diff --git a/src/ats-tests/perf_ats.c b/src/ats-tests/perf_ats.c
index 67ff7d0af2..a3f60d375b 100644
--- a/src/ats-tests/perf_ats.c
+++ b/src/ats-tests/perf_ats.c
@@ -359,21 +359,21 @@ static size_t
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 @@ comm_handle_ping (void *cls, const struct GNUNET_PeerIdentity *other,
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];
diff --git a/src/ats-tests/perf_ats_logging.c b/src/ats-tests/perf_ats_logging.c
index 51c09c2668..2979dd6472 100644
--- a/src/ats-tests/perf_ats_logging.c
+++ b/src/ats-tests/perf_ats_logging.c
@@ -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
+{
+ /**
+ * 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
{
- struct LoggingTimestep *next;
- struct LoggingTimestep *prev;
+ /**
+ * Next in DLL
+ */
+ struct PeerLoggingTimestep *next;
+ /**
+ * Prev in DLL
+ */
+ struct PeerLoggingTimestep *prev;
+
+ /**
+ * Logging timestamp
+ */
struct GNUNET_TIME_Absolute timestamp;
/**
@@ -61,16 +112,37 @@ struct LoggingTimestep
* 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 @@ write_to_file ()
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 @@ write_to_file ()
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 @@ collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
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 @@ perf_logging_stop ()
{
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 @@ perf_logging_stop ()
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 @@ perf_logging_start (char * testname, struct BenchmarkPeer *masters, int num_mast
GNUNET_log(GNUNET_ERROR_TYPE_INFO,
_("Start logging `%s'\n"), testname);
- peers = masters;
num_peers = num_masters;
name = testname;