2 This file is part of GNUnet.
3 (C) 2010-2013 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 * @file ats/perf_ats_logging.c
22 * @brief ats benchmark: logging for performance tests
23 * @author Christian Grothoff
24 * @author Matthias Wachs
27 #include "gnunet_util_lib.h"
30 #define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 500)
32 static GNUNET_SCHEDULER_TaskIdentifier log_task;
34 static struct BenchmarkPeer *peers;
44 collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
48 log_task = GNUNET_SCHEDULER_NO_TASK;
50 struct BenchmarkPeer *m;
51 struct BenchmarkPartner *p;
53 for (c_m = 0; c_m < num_peers; c_m++)
56 for (c_s = 0; c_s < m->num_partners; c_s++)
58 p = &peers[c_m].partners[c_s];
59 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
60 "Master [%u]: slave [%u]\n",
65 if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
68 log_task = GNUNET_SCHEDULER_add_delayed (LOGGING_FREQUENCY,
69 &collect_log_task, NULL);
76 struct GNUNET_SCHEDULER_TaskContext tc;
78 if (GNUNET_SCHEDULER_NO_TASK != log_task)
79 GNUNET_SCHEDULER_cancel (log_task);
80 log_task = GNUNET_SCHEDULER_NO_TASK;
81 tc.reason = GNUNET_SCHEDULER_REASON_SHUTDOWN;
82 collect_log_task (NULL, &tc);
84 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
91 perf_logging_start (struct BenchmarkPeer *masters, int num_masters)
93 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
94 _("Start logging\n"));
97 num_peers = num_masters;
99 /* Schedule logging task */
100 log_task = GNUNET_SCHEDULER_add_now (&collect_log_task, NULL);
102 /* end of file perf_ats_logging.c */