[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29385 - gnunet/src/ats-tests
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29385 - gnunet/src/ats-tests |
Date: |
Wed, 18 Sep 2013 17:38:22 +0200 |
Author: wachs
Date: 2013-09-18 17:38:21 +0200 (Wed, 18 Sep 2013)
New Revision: 29385
Modified:
gnunet/src/ats-tests/perf_ats.c
gnunet/src/ats-tests/perf_ats_logging.c
Log:
logging for master
Modified: gnunet/src/ats-tests/perf_ats.c
===================================================================
--- gnunet/src/ats-tests/perf_ats.c 2013-09-18 15:27:43 UTC (rev 29384)
+++ gnunet/src/ats-tests/perf_ats.c 2013-09-18 15:38:21 UTC (rev 29385)
@@ -437,6 +437,8 @@
progress_task = GNUNET_SCHEDULER_add_now (&print_progress, NULL );
/* Start sending test messages */
+ if (GNUNET_YES == logging)
+ perf_logging_start (testname, mps, num_masters);
for (c_m = 0; c_m < num_masters; c_m++)
{
for (c_s = 0; c_s < num_slaves; c_s++)
@@ -455,8 +457,7 @@
if (pref_val != GNUNET_ATS_PREFERENCE_END)
mps[c_m].ats_task = GNUNET_SCHEDULER_add_now (&ats_pref_task, &mps[c_m]);
}
- if (GNUNET_YES == logging)
- perf_logging_start (testname, mps, num_masters);
+
}
static void
Modified: gnunet/src/ats-tests/perf_ats_logging.c
===================================================================
--- gnunet/src/ats-tests/perf_ats_logging.c 2013-09-18 15:27:43 UTC (rev
29384)
+++ gnunet/src/ats-tests/perf_ats_logging.c 2013-09-18 15:38:21 UTC (rev
29385)
@@ -27,7 +27,7 @@
#include "gnunet_util_lib.h"
#include "perf_ats.h"
-#define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MILLISECONDS, 500)
+#define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MILLISECONDS, 100)
static GNUNET_SCHEDULER_TaskIdentifier log_task;
@@ -37,10 +37,30 @@
struct LoggingTimestep
{
+ struct LoggingTimestep *next;
+ struct LoggingTimestep *prev;
+
struct GNUNET_TIME_Absolute timestamp;
- struct LoggingTimestep *next;
- struct LoggingTimestep *prev;
+ /**
+ * 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;
};
struct LoggingPeer
@@ -67,6 +87,9 @@
char *data;
struct LoggingTimestep *cur;
int c_m;
+ unsigned int throughput_recv;
+ unsigned int throughput_send;
+ double mult;
GNUNET_asprintf (&filename, "%llu_%s.data",
GNUNET_TIME_absolute_get().abs_value_us,name);
@@ -84,15 +107,36 @@
{
for (cur = lp[c_m].head; NULL != cur; cur = cur->next)
{
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Master [%u]: timestamp %llu \n", lp[c_m].peer->no, cur->timestamp);
+ mult = (1.0 * 1000 * 1000) / (LOGGING_FREQUENCY.rel_value_us);
+ if (NULL != cur->prev)
+ {
+ throughput_send = cur->total_bytes_sent - cur->prev->total_bytes_sent;
+ throughput_recv = cur->total_bytes_received -
cur->prev->total_bytes_received;
+ }
+ else
+ {
+ throughput_send = cur->total_bytes_sent;
+ throughput_recv = cur->total_bytes_received;
+ }
+ throughput_send *= mult;
+ throughput_recv *= mult;
- GNUNET_asprintf (&data, "%llu;\n", cur->timestamp);
+ GNUNET_log(GNUNET_ERROR_TYPE_INFO,
+ "Master [%u]: timestamp %llu %llu %u %u %u ; %u %u %u\n",
lp[c_m].peer->no,
+ cur->timestamp,
GNUNET_TIME_absolute_get_difference(lp[c_m].start,cur->timestamp).rel_value_us
/ 1000,
+ cur->total_messages_sent, cur->total_bytes_sent, throughput_send,
+ cur->total_messages_received, cur->total_bytes_received,
throughput_recv);
+
+ 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,
+ cur->total_messages_sent, cur->total_bytes_sent, throughput_send,
+ cur->total_messages_received, cur->total_bytes_received,
throughput_recv);
+
if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data)))
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to log file
`%s'\n", filename);
GNUNET_free (data);
-
}
}
@@ -121,15 +165,22 @@
{
lt = GNUNET_malloc (sizeof (struct LoggingTimestep));
GNUNET_CONTAINER_DLL_insert_tail(lp[c_m].head, lp[c_m].tail, lt);
+
+ /* 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;
for (c_s = 0; c_s < lp[c_m].peer->num_partners; c_s++)
{
p = &peers[c_m].partners[c_s];
-
+/*
GNUNET_log(GNUNET_ERROR_TYPE_INFO,
"Master [%u]: slave [%u]\n",
lp->peer->no, p->dest->no);
+*/
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29385 - gnunet/src/ats-tests,
gnunet <=