/*
This file is part of GNUnet.
- Copyright (C) 2010-2013 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2010-2013 GNUnet e.V.
- GNUnet is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ Affero General Public License for more details.
*/
/**
* @file ats-tests/ats-testing-log.c
/**
* Logging task
*/
- struct GNUNET_SCHEDULER_Task * log_task;
+ struct GNUNET_SCHEDULER_Task *log_task;
/**
* Reference to perf_ats' masters
int num_slaves;
int running;
int verbose;
- char *name;
+ const char *name;
struct GNUNET_TIME_Relative frequency;
/**
void
GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l,
- char *experiment_name, int plots)
+ const char *experiment_name,
+ int plots)
{
struct GNUNET_DISK_FileHandle *f[l->num_slaves];
struct GNUNET_DISK_FileHandle *f_m;
- char *tmp_exp_name;
+ const char *tmp_exp_name;
char *filename_master;
char *filename_slaves[l->num_slaves];
char *data;
}
else
{
- mlt->total_throughput_send = 0;
+ mlt->total_throughput_recv = 0;
//mlt->total_throughput_recv = prev_log_mlt->total_throughput_recv; /* no msgs received */
}
}
else
{
mlt->total_throughput_send = mult * mlt->total_bytes_sent;
- mlt->total_throughput_send = mult * mlt->total_bytes_received;
+ mlt->total_throughput_recv = mult * mlt->total_bytes_received;
}
if (GNUNET_YES == l->verbose)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Master[%u] delta: %llu us, bytes (sent/received): %u / %u; throughput send/recv: %u / %u\n", c_m,
- delta.rel_value_us,
- mlt->total_bytes_sent,
- mlt->total_bytes_received,
- mlt->total_throughput_send,
- mlt->total_throughput_recv);
+ "Master[%u] delta: %llu us, bytes (sent/received): %u / %u; throughput send/recv: %u / %u\n",
+ c_m,
+ (unsigned long long) delta.rel_value_us,
+ mlt->total_bytes_sent,
+ mlt->total_bytes_received,
+ mlt->total_throughput_send,
+ mlt->total_throughput_recv);
}
mlt->slaves_log = GNUNET_malloc (bp->peer->num_partners *
if (GNUNET_YES == l->verbose)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Master [%u] -> Slave [%u]: delta: %llu us, bytes (sent/received): %u / %u; throughput send/recv: %u / %u\n",
- c_m, c_s,
- delta.rel_value_us,
- mlt->total_bytes_sent,
- mlt->total_bytes_received,
- slt->throughput_sent,
- slt->throughput_recv);
+ "Master [%u] -> Slave [%u]: delta: %llu us, bytes (sent/received): %u / %u; throughput send/recv: %u / %u\n",
+ c_m, c_s,
+ (unsigned long long) delta.rel_value_us,
+ mlt->total_bytes_sent,
+ mlt->total_bytes_received,
+ slt->throughput_sent,
+ slt->throughput_recv);
}
else
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
}
}
+
static void
-collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+collect_log_task (void *cls)
{
struct LoggingHandle *l = cls;
- l->log_task = NULL;
+ l->log_task = NULL;
GNUNET_ATS_TEST_logging_now (l);
-
- if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
- return;
-
l->log_task = GNUNET_SCHEDULER_add_delayed (l->frequency,
- &collect_log_task, l);
+ &collect_log_task,
+ l);
}
+
/**
* Stop logging
*
return;
if (NULL != l->log_task)
+ {
GNUNET_SCHEDULER_cancel (l->log_task);
- l->log_task = NULL;
+ l->log_task = NULL;
+ }
l->running = GNUNET_NO;
GNUNET_log(GNUNET_ERROR_TYPE_INFO,
*/
struct LoggingHandle *
GNUNET_ATS_TEST_logging_start(struct GNUNET_TIME_Relative log_frequency,
- char *testname, struct BenchmarkPeer *masters, int num_masters, int num_slaves,
- int verbose)
+ const char *testname,
+ struct BenchmarkPeer *masters,
+ int num_masters,
+ int num_slaves,
+ int verbose)
{
struct LoggingHandle *l;
int c_m;
+
GNUNET_log(GNUNET_ERROR_TYPE_INFO,
_("Start logging `%s'\n"), testname);
return l;
}
/* end of file ats-testing-log.c */
-