GNUnet  0.10.x
Data Structures | Macros | Functions
ats-testing-log.c File Reference

ats benchmark: logging for performance tests More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "ats-testing.h"
Include dependency graph for ats-testing-log.c:

Go to the source code of this file.

Data Structures

struct  PartnerLoggingTimestep
 A single logging time step for a partner. More...
 
struct  PeerLoggingTimestep
 A single logging time step for a peer. More...
 
struct  LoggingPeer
 Entry for a benchmark peer. More...
 
struct  LoggingHandle
 

Macros

#define THROUGHPUT_TEMPLATE
 
#define RTT_TEMPLATE
 
#define BW_TEMPLATE
 
#define LOG_ITEMS_TIME   2
 
#define LOG_ITEMS_PER_PEER   17
 
#define LOG_ITEM_BYTES_SENT   1
 
#define LOG_ITEM_MSGS_SENT   2
 
#define LOG_ITEM_THROUGHPUT_SENT   3
 
#define LOG_ITEM_BYTES_RECV   4
 
#define LOG_ITEM_MSGS_RECV   5
 
#define LOG_ITEM_THROUGHPUT_RECV   6
 
#define LOG_ITEM_APP_RTT   7
 
#define LOG_ITEM_ATS_BW_IN   8
 
#define LOG_ITEM_ATS_BW_OUT   9
 
#define LOG_ITEM_ATS_COSTS_LAN   10
 
#define LOG_ITEM_ATS_WAN   11
 
#define LOG_ITEM_ATS_WLAN   12
 
#define LOG_ITEM_ATS_DELAY   13
 
#define LOG_ITEM_ATS_DISTANCE   14
 
#define LOG_ITEM_ATS_NETWORKTYPE   15
 
#define LOG_ITEM_ATS_UTIL_UP   16
 
#define LOG_ITEM_ATS_UTIL_DOWN   17
 

Functions

static void write_throughput_gnuplot_script (char *fn, struct LoggingPeer *lp, char **fs, int slaves)
 
static void write_rtt_gnuplot_script (char *fn, struct LoggingPeer *lp, char **fs, int slaves)
 
static void write_bw_gnuplot_script (char *fn, struct LoggingPeer *lp, char **fs, int slaves)
 
void GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, const char *experiment_name, int plots)
 Write logging data to file. More...
 
void GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l)
 Log all data now. More...
 
static void collect_log_task (void *cls)
 
void GNUNET_ATS_TEST_logging_stop (struct LoggingHandle *l)
 Stop logging. More...
 
void GNUNET_ATS_TEST_logging_clean_up (struct LoggingHandle *l)
 Clean up logging data. More...
 
struct LoggingHandleGNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency, const char *testname, struct BenchmarkPeer *masters, int num_masters, int num_slaves, int verbose)
 Start logging. More...
 

Detailed Description

ats benchmark: logging for performance tests

Author
Christian Grothoff
Matthias Wachs

Definition in file ats-testing-log.c.

Macro Definition Documentation

◆ THROUGHPUT_TEMPLATE

#define THROUGHPUT_TEMPLATE
Value:
"#!/usr/bin/gnuplot \n" \
"set datafile separator ';' \n" \
"set title \"Throughput between Master and Slaves\" \n" \
"set xlabel \"Time in ms\" \n" \
"set ylabel \"Bytes/s\" \n" \
"set grid \n"

Definition at line 30 of file ats-testing-log.c.

Referenced by write_throughput_gnuplot_script().

◆ RTT_TEMPLATE

#define RTT_TEMPLATE
Value:
"#!/usr/bin/gnuplot \n" \
"set datafile separator ';' \n" \
"set title \"Application level roundtrip time between Master and Slaves\" \n" \
"set xlabel \"Time in ms\" \n" \
"set ylabel \"ms\" \n" \
"set grid \n"

Definition at line 37 of file ats-testing-log.c.

Referenced by write_rtt_gnuplot_script().

◆ BW_TEMPLATE

#define BW_TEMPLATE
Value:
"#!/usr/bin/gnuplot \n" \
"set datafile separator ';' \n" \
"set title \"Bandwidth inbound and outbound between Master and Slaves\" \n" \
"set xlabel \"Time in ms\" \n" \
"set ylabel \"Bytes / s \" \n" \
"set grid \n"

Definition at line 44 of file ats-testing-log.c.

Referenced by write_bw_gnuplot_script().

◆ LOG_ITEMS_TIME

#define LOG_ITEMS_TIME   2

◆ LOG_ITEMS_PER_PEER

#define LOG_ITEMS_PER_PEER   17

Definition at line 52 of file ats-testing-log.c.

◆ LOG_ITEM_BYTES_SENT

#define LOG_ITEM_BYTES_SENT   1

Definition at line 54 of file ats-testing-log.c.

◆ LOG_ITEM_MSGS_SENT

#define LOG_ITEM_MSGS_SENT   2

Definition at line 55 of file ats-testing-log.c.

◆ LOG_ITEM_THROUGHPUT_SENT

#define LOG_ITEM_THROUGHPUT_SENT   3

Definition at line 56 of file ats-testing-log.c.

Referenced by write_throughput_gnuplot_script().

◆ LOG_ITEM_BYTES_RECV

#define LOG_ITEM_BYTES_RECV   4

Definition at line 57 of file ats-testing-log.c.

◆ LOG_ITEM_MSGS_RECV

#define LOG_ITEM_MSGS_RECV   5

Definition at line 58 of file ats-testing-log.c.

◆ LOG_ITEM_THROUGHPUT_RECV

#define LOG_ITEM_THROUGHPUT_RECV   6

Definition at line 59 of file ats-testing-log.c.

Referenced by write_throughput_gnuplot_script().

◆ LOG_ITEM_APP_RTT

#define LOG_ITEM_APP_RTT   7

Definition at line 60 of file ats-testing-log.c.

Referenced by write_rtt_gnuplot_script().

◆ LOG_ITEM_ATS_BW_IN

#define LOG_ITEM_ATS_BW_IN   8

Definition at line 61 of file ats-testing-log.c.

Referenced by write_bw_gnuplot_script().

◆ LOG_ITEM_ATS_BW_OUT

#define LOG_ITEM_ATS_BW_OUT   9

Definition at line 62 of file ats-testing-log.c.

Referenced by write_bw_gnuplot_script().

◆ LOG_ITEM_ATS_COSTS_LAN

#define LOG_ITEM_ATS_COSTS_LAN   10

Definition at line 63 of file ats-testing-log.c.

◆ LOG_ITEM_ATS_WAN

#define LOG_ITEM_ATS_WAN   11

Definition at line 64 of file ats-testing-log.c.

◆ LOG_ITEM_ATS_WLAN

#define LOG_ITEM_ATS_WLAN   12

Definition at line 65 of file ats-testing-log.c.

◆ LOG_ITEM_ATS_DELAY

#define LOG_ITEM_ATS_DELAY   13

Definition at line 66 of file ats-testing-log.c.

◆ LOG_ITEM_ATS_DISTANCE

#define LOG_ITEM_ATS_DISTANCE   14

Definition at line 67 of file ats-testing-log.c.

◆ LOG_ITEM_ATS_NETWORKTYPE

#define LOG_ITEM_ATS_NETWORKTYPE   15

Definition at line 68 of file ats-testing-log.c.

◆ LOG_ITEM_ATS_UTIL_UP

#define LOG_ITEM_ATS_UTIL_UP   16

Definition at line 69 of file ats-testing-log.c.

◆ LOG_ITEM_ATS_UTIL_DOWN

#define LOG_ITEM_ATS_UTIL_DOWN   17

Definition at line 70 of file ats-testing-log.c.

Function Documentation

◆ write_throughput_gnuplot_script()

static void write_throughput_gnuplot_script ( char *  fn,
struct LoggingPeer lp,
char **  fs,
int  slaves 
)
static

Definition at line 251 of file ats-testing-log.c.

References data, BenchmarkPartner::dest, removetrailingwhitespace::f, GNUNET_asprintf(), GNUNET_DISK_file_close(), GNUNET_DISK_file_open(), GNUNET_DISK_file_write(), GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_USER_EXEC, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_log, GNUNET_SYSERR, LOG_ITEM_THROUGHPUT_RECV, LOG_ITEM_THROUGHPUT_SENT, LOG_ITEMS_TIME, BenchmarkPeer::no, BenchmarkPeer::partners, peer, LoggingPeer::peer, and THROUGHPUT_TEMPLATE.

Referenced by GNUNET_ATS_TEST_logging_write_to_file().

252 {
253  struct GNUNET_DISK_FileHandle *f;
254  char * gfn;
255  char *data;
256  int c_s;
257 
258  GNUNET_asprintf (&gfn, "gnuplot_throughput_%s",fn);
259  fprintf (stderr, "Writing throughput plot for master %u and %u slaves to `%s'\n",
260  lp->peer->no, slaves, gfn);
261 
262  f = GNUNET_DISK_file_open (gfn,
266  if (NULL == f)
267  {
268  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", gfn);
269  GNUNET_free (gfn);
270  return;
271  }
272 
273  /* Write header */
275  strlen(THROUGHPUT_TEMPLATE)))
277  "Cannot write data to plot file `%s'\n", gfn);
278 
279  /* Write master data */
280  GNUNET_asprintf (&data,
281  "plot '%s' using 2:%u with lines title 'Master %u send total', \\\n" \
282  "'%s' using 2:%u with lines title 'Master %u receive total', \\\n",
285  if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data)))
286  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn);
287  GNUNET_free (data);
288 
289  for (c_s = 0; c_s < slaves; c_s++)
290  {
291  GNUNET_asprintf (&data, "'%s' using 2:%u with lines title 'Master %u - Slave %u send', \\\n" \
292  "'%s' using 2:%u with lines title 'Master %u - Slave %u receive'%s\n",
293  fs[c_s],
295  lp->peer->no,
296  lp->peer->partners[c_s].dest->no,
297  fs[c_s],
299  lp->peer->no,
300  lp->peer->partners[c_s].dest->no,
301  (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1");
302  if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data)))
303  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn);
304  GNUNET_free (data);
305  }
306 
309  "Cannot close gnuplot file `%s'\n", gfn);
310  else
312  "Data successfully written to plot file `%s'\n", gfn);
313  GNUNET_free (gfn);
314 }
Create file if it doesn&#39;t exist.
int GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
Definition: disk.c:1817
struct BenchmarkPartner * partners
Array of partners with num_slaves entries (if master) or num_master entries (if slave) ...
Definition: ats-testing.h:191
struct BenchmarkPeer * peer
Peer.
int GNUNET_asprintf(char **buf, const char *format,...)
Like asprintf, just portable.
int no
Unique identifier.
Definition: ats-testing.h:121
static char * fn
Filename of the unique file.
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition: disk.c:1049
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
Open the file for writing.
static struct GNUNET_FS_Handle * fs
Handle to FS service.
Definition: gnunet-fs.c:36
#define LOG_ITEMS_TIME
#define GNUNET_log(kind,...)
#define LOG_ITEM_THROUGHPUT_SENT
#define LOG_ITEM_THROUGHPUT_RECV
uint32_t data
The data value.
struct GNUNET_DISK_FileHandle * GNUNET_DISK_file_open(const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
Open a file.
Definition: disk.c:1673
Handle used to access files (and pipes).
struct BenchmarkPeer * dest
The partner peer.
Definition: ats-testing.h:285
#define GNUNET_free(ptr)
Wrapper around free.
#define THROUGHPUT_TEMPLATE
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_rtt_gnuplot_script()

static void write_rtt_gnuplot_script ( char *  fn,
struct LoggingPeer lp,
char **  fs,
int  slaves 
)
static

Definition at line 318 of file ats-testing-log.c.

References data, BenchmarkPartner::dest, removetrailingwhitespace::f, GNUNET_asprintf(), GNUNET_DISK_file_close(), GNUNET_DISK_file_open(), GNUNET_DISK_file_write(), GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_USER_EXEC, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_log, GNUNET_SYSERR, LOG_ITEM_APP_RTT, LOG_ITEMS_TIME, BenchmarkPeer::no, BenchmarkPeer::partners, peer, LoggingPeer::peer, and RTT_TEMPLATE.

Referenced by GNUNET_ATS_TEST_logging_write_to_file().

319 {
320  struct GNUNET_DISK_FileHandle *f;
321  char * gfn;
322  char *data;
323  int c_s;
324 
325  GNUNET_asprintf (&gfn, "gnuplot_rtt_%s",fn);
326  fprintf (stderr, "Writing rtt plot for master %u to `%s'\n",
327  lp->peer->no, gfn);
328 
329  f = GNUNET_DISK_file_open (gfn,
333  if (NULL == f)
334  {
335  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", gfn);
336  GNUNET_free (gfn);
337  return;
338  }
339 
340  /* Write header */
342  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn);
343 
344  for (c_s = 0; c_s < slaves; c_s++)
345  {
346  GNUNET_asprintf (&data, "%s'%s' using 2:%u with lines title 'Master %u - Slave %u '%s\n",
347  (0 == c_s) ? "plot " :"",
348  fs[c_s],
350  lp->peer->no,
351  lp->peer->partners[c_s].dest->no,
352  (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1");
353  if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data)))
354  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn);
355  GNUNET_free (data);
356  }
357 
359  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", gfn);
360  else
361  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Data successfully written to plot file `%s'\n", gfn);
362  GNUNET_free (gfn);
363 }
#define LOG_ITEM_APP_RTT
#define RTT_TEMPLATE
Create file if it doesn&#39;t exist.
int GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
Definition: disk.c:1817
struct BenchmarkPartner * partners
Array of partners with num_slaves entries (if master) or num_master entries (if slave) ...
Definition: ats-testing.h:191
struct BenchmarkPeer * peer
Peer.
int GNUNET_asprintf(char **buf, const char *format,...)
Like asprintf, just portable.
int no
Unique identifier.
Definition: ats-testing.h:121
static char * fn
Filename of the unique file.
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition: disk.c:1049
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
Open the file for writing.
static struct GNUNET_FS_Handle * fs
Handle to FS service.
Definition: gnunet-fs.c:36
#define LOG_ITEMS_TIME
#define GNUNET_log(kind,...)
uint32_t data
The data value.
struct GNUNET_DISK_FileHandle * GNUNET_DISK_file_open(const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
Open a file.
Definition: disk.c:1673
Handle used to access files (and pipes).
struct BenchmarkPeer * dest
The partner peer.
Definition: ats-testing.h:285
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_bw_gnuplot_script()

static void write_bw_gnuplot_script ( char *  fn,
struct LoggingPeer lp,
char **  fs,
int  slaves 
)
static

Definition at line 366 of file ats-testing-log.c.

References BW_TEMPLATE, data, removetrailingwhitespace::f, GNUNET_asprintf(), GNUNET_DISK_file_close(), GNUNET_DISK_file_open(), GNUNET_DISK_file_write(), GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_USER_EXEC, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_log, GNUNET_SYSERR, LOG_ITEM_ATS_BW_IN, LOG_ITEM_ATS_BW_OUT, LOG_ITEMS_TIME, BenchmarkPeer::no, peer, and LoggingPeer::peer.

Referenced by GNUNET_ATS_TEST_logging_write_to_file().

367 {
368  struct GNUNET_DISK_FileHandle *f;
369  char * gfn;
370  char *data;
371  int c_s;
372 
373  GNUNET_asprintf (&gfn, "gnuplot_bw_%s",fn);
374  fprintf (stderr, "Writing bandwidth plot for master %u to `%s'\n",
375  lp->peer->no, gfn);
376 
377  f = GNUNET_DISK_file_open (gfn,
381  if (NULL == f)
382  {
383  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", gfn);
384  GNUNET_free (gfn);
385  return;
386  }
387 
388  /* Write header */
391  "Cannot write data to plot file `%s'\n", gfn);
392 
393  for (c_s = 0; c_s < slaves; c_s++)
394  {
395  GNUNET_asprintf (&data, "%s"\
396  "'%s' using 2:%u with lines title 'BW out master %u - Slave %u ', \\\n" \
397  "'%s' using 2:%u with lines title 'BW in master %u - Slave %u '"\
398  "%s\n",
399  (0 == c_s) ? "plot " :"",
400  fs[c_s],
402  lp->peer->no, c_s,
403  fs[c_s],
405  lp->peer->no, c_s,
406  (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1");
407  if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data)))
408  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file `%s'\n", gfn);
409  GNUNET_free (data);
410  }
411 
413  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", gfn);
414  else
415  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Data successfully written to plot file `%s'\n", gfn);
416  GNUNET_free (gfn);
417 }
Create file if it doesn&#39;t exist.
int GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
Definition: disk.c:1817
#define LOG_ITEM_ATS_BW_IN
struct BenchmarkPeer * peer
Peer.
#define BW_TEMPLATE
int GNUNET_asprintf(char **buf, const char *format,...)
Like asprintf, just portable.
int no
Unique identifier.
Definition: ats-testing.h:121
static char * fn
Filename of the unique file.
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition: disk.c:1049
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
Open the file for writing.
static struct GNUNET_FS_Handle * fs
Handle to FS service.
Definition: gnunet-fs.c:36
#define LOG_ITEMS_TIME
#define GNUNET_log(kind,...)
#define LOG_ITEM_ATS_BW_OUT
uint32_t data
The data value.
struct GNUNET_DISK_FileHandle * GNUNET_DISK_file_open(const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
Open a file.
Definition: disk.c:1673
Handle used to access files (and pipes).
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_logging_write_to_file()

void GNUNET_ATS_TEST_logging_write_to_file ( struct LoggingHandle l,
const char *  test_name,
int  plots 
)

Write logging data to file.

Parameters
llogging handle to use
test_namename of the current test
plotscreate gnuplots: GNUNET_YES or GNUNET_NO

Definition at line 421 of file ats-testing-log.c.

References GNUNET_TIME_Absolute::abs_value_us, PartnerLoggingTimestep::app_rtt, PartnerLoggingTimestep::ats_delay, PartnerLoggingTimestep::ats_distance, PartnerLoggingTimestep::ats_network_type, PartnerLoggingTimestep::ats_utilization_in, PartnerLoggingTimestep::ats_utilization_out, PartnerLoggingTimestep::bandwidth_in, PartnerLoggingTimestep::bandwidth_out, data, removetrailingwhitespace::f, GNUNET_asprintf(), GNUNET_break, GNUNET_DISK_file_close(), GNUNET_DISK_file_open(), GNUNET_DISK_file_write(), GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_log, GNUNET_log_strerror_file, GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_difference(), GNUNET_YES, LoggingPeer::head, LoggingHandle::lp, LoggingHandle::name, PeerLoggingTimestep::next, BenchmarkPeer::no, LoggingHandle::num_masters, BenchmarkPeer::num_partners, LoggingHandle::num_slaves, LoggingPeer::peer, PartnerLoggingTimestep::pref_bandwidth, PartnerLoggingTimestep::pref_delay, GNUNET_TIME_Relative::rel_value_us, PartnerLoggingTimestep::slave, PeerLoggingTimestep::slaves_log, LoggingPeer::start, PartnerLoggingTimestep::throughput_recv, PartnerLoggingTimestep::throughput_sent, PeerLoggingTimestep::timestamp, PartnerLoggingTimestep::total_bytes_received, PeerLoggingTimestep::total_bytes_received, PartnerLoggingTimestep::total_bytes_sent, PeerLoggingTimestep::total_bytes_sent, PartnerLoggingTimestep::total_messages_received, PeerLoggingTimestep::total_messages_received, PartnerLoggingTimestep::total_messages_sent, PeerLoggingTimestep::total_messages_sent, PeerLoggingTimestep::total_throughput_recv, PeerLoggingTimestep::total_throughput_send, LoggingHandle::verbose, write_bw_gnuplot_script(), write_rtt_gnuplot_script(), and write_throughput_gnuplot_script().

Referenced by experiment_done_cb().

424 {
425  struct GNUNET_DISK_FileHandle *f[l->num_slaves];
426  struct GNUNET_DISK_FileHandle *f_m;
427  const char *tmp_exp_name;
428  char *filename_master;
429  char *filename_slaves[l->num_slaves];
430  char *data;
431  struct PeerLoggingTimestep *cur_lt;
432  struct PartnerLoggingTimestep *plt;
433  struct GNUNET_TIME_Absolute timestamp;
434  int c_m;
435  int c_s;
436 
437 
438  timestamp = GNUNET_TIME_absolute_get();
439 
440  tmp_exp_name = experiment_name;
441  for (c_m = 0; c_m < l->num_masters; c_m++)
442  {
443  GNUNET_asprintf (&filename_master, "%s_%llu_master%u_%s",
444  experiment_name, timestamp.abs_value_us, c_m, l->name);
445  fprintf (stderr, "Writing data for master %u to file `%s'\n",
446  c_m,filename_master);
447 
448  f_m = GNUNET_DISK_file_open (filename_master,
451  if (NULL == f_m)
452  {
453  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open log file `%s'\n", filename_master);
454  GNUNET_free (filename_master);
455  return;
456  }
457 
458  GNUNET_asprintf (&data, "# master %u; experiment : %s\n"
459  "timestamp; timestamp delta; #messages sent; #bytes sent; #throughput sent; #messages received; #bytes received; #throughput received; \n" ,
460  c_m, experiment_name);
461  if (GNUNET_SYSERR == GNUNET_DISK_file_write(f_m, data, strlen(data)))
463  "Cannot write data to log file `%s'\n",filename_master);
464  GNUNET_free (data);
465 
466  for (c_s = 0; c_s < l->lp[c_m].peer->num_partners; c_s++)
467  {
468  GNUNET_asprintf (&filename_slaves[c_s], "%s_%llu_master%u_slave_%u_%s",
469  tmp_exp_name, timestamp.abs_value_us, c_m, c_s, l->name);
470 
471  fprintf (stderr, "Writing data for master %u slave %u to file `%s'\n",
472  c_m, c_s, filename_slaves[c_s]);
473 
474  f[c_s] = GNUNET_DISK_file_open (filename_slaves[c_s],
477  if (NULL == f[c_s])
478  {
479  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open log file `%s'\n", filename_slaves[c_s]);
480  GNUNET_free (filename_slaves[c_s]);
482  GNUNET_free (filename_master);
483  return;
484  }
485 
486  /* Header */
487  GNUNET_asprintf (&data, "# master %u; slave %u ; experiment : %s\n"
488  "timestamp; timestamp delta; #messages sent; #bytes sent; #throughput sent; #messages received; #bytes received; #throughput received; " \
489  "rtt; bw in; bw out; ats_cost_lan; ats_cost_wlan; ats_delay; ats_distance; ats_network_type; ats_utilization_up ;ats_utilization_down;" \
490  "pref bandwidth; pref delay\n",
491  c_m, c_s, experiment_name);
492  if (GNUNET_SYSERR == GNUNET_DISK_file_write(f[c_s], data, strlen(data)))
494  "Cannot write data to log file `%s'\n",filename_slaves[c_s]);
495  GNUNET_free (data);
496  }
497 
498  for (cur_lt = l->lp[c_m].head; NULL != cur_lt; cur_lt = cur_lt->next)
499  {
500  if (l->verbose)
501  fprintf (stderr,
502  "Master [%u]: timestamp %llu %llu ; %u %u %u ; %u %u %u\n",
503  l->lp[c_m].peer->no,
504  (long long unsigned int) cur_lt->timestamp.abs_value_us,
505  (long long unsigned int) GNUNET_TIME_absolute_get_difference(l->lp[c_m].start,
506  cur_lt->timestamp).rel_value_us / 1000,
507  cur_lt->total_messages_sent,
508  cur_lt->total_bytes_sent,
509  cur_lt->total_throughput_send,
510  cur_lt->total_messages_received,
511  cur_lt->total_bytes_received,
512  cur_lt->total_throughput_recv);
513 
514  /* Assembling master string */
515  GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u;\n",
516  (long long unsigned int) cur_lt->timestamp.abs_value_us,
517  (long long unsigned int) GNUNET_TIME_absolute_get_difference(l->lp[c_m].start,
518  cur_lt->timestamp).rel_value_us / 1000,
519  cur_lt->total_messages_sent,
520  cur_lt->total_bytes_sent,
521  cur_lt->total_throughput_send,
522  cur_lt->total_messages_received,
523  cur_lt->total_bytes_received,
524  cur_lt->total_throughput_recv);
525 
526  if (GNUNET_SYSERR == GNUNET_DISK_file_write(f_m, data, strlen(data)))
528  "Cannot write data to master file %u\n", c_m);
529  GNUNET_free (data);
530 
531 
532  for (c_s = 0; c_s < l->lp[c_m].peer->num_partners; c_s++)
533  {
534  plt = &cur_lt->slaves_log[c_s];
535  /* Log partners */
536 
537  /* Assembling slave string */
538  GNUNET_asprintf(&data,
539  "%llu;%llu;%u;%u;%u;%u;%u;%u;%.3f;%u;%u;%u;%u;%u;%u;%u;%.3f;%.3f\n",
540  (long long unsigned int) cur_lt->timestamp.abs_value_us,
541  (long long unsigned int) GNUNET_TIME_absolute_get_difference(l->lp[c_m].start,
542  cur_lt->timestamp).rel_value_us / 1000,
543  plt->total_messages_sent,
544  plt->total_bytes_sent,
545  plt->throughput_sent,
548  plt->throughput_recv,
549  (double) plt->app_rtt / 1000,
550  plt->bandwidth_in,
551  plt->bandwidth_out,
552  plt->ats_delay,
553  plt->ats_distance,
554  plt->ats_network_type,
555  plt->ats_utilization_out,
556  plt->ats_utilization_in,
557  plt->pref_bandwidth,
558  plt->pref_delay);
559 
560  if (l->verbose)
561  fprintf (stderr,
562  "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %llu bw_in %u bw_out %u \n",
563  plt->slave->no,
564  plt->total_messages_sent,
565  plt->total_bytes_sent,
566  plt->throughput_sent,
569  plt->throughput_recv,
570  plt->app_rtt,
571  (long long unsigned int) plt->ats_delay.rel_value_us,
572  plt->bandwidth_in,
573  plt->bandwidth_out);
574 
575  if (GNUNET_SYSERR == GNUNET_DISK_file_write(f[c_s], data, strlen(data)))
577  "Cannot write data to log file `%s'\n", filename_slaves[c_s]);
578  GNUNET_free (data);
579 
580  }
581  }
582 
583  for (c_s = 0; c_s < l->lp[c_m].peer->num_partners; c_s++)
584  {
585  if (GNUNET_SYSERR == GNUNET_DISK_file_close(f[c_s]))
586  {
588  "Cannot close log file for master[%u] slave[%u]\n", c_m, c_s);
589  continue;
590  }
592  "Data file successfully written to log file for `%s'\n",
593  filename_slaves[c_s]);
594  }
595 
597  {
599  "close",
600  filename_master);
601  GNUNET_free (filename_master);
602  return;
603  }
605  "Data file successfully written to log file for master `%s'\n", filename_master);
606 
607  if (GNUNET_YES == plots)
608  {
609  write_throughput_gnuplot_script (filename_master, &l->lp[c_m], filename_slaves, l->num_slaves);
610  write_rtt_gnuplot_script (filename_master, &l->lp[c_m], filename_slaves, l->num_slaves);
611  write_bw_gnuplot_script (filename_master, &l->lp[c_m], filename_slaves, l->num_slaves);
612  }
613  }
614  GNUNET_free (filename_master);
615 }
unsigned int total_bytes_sent
Total number of bytes this peer has sent.
static void write_rtt_gnuplot_script(char *fn, struct LoggingPeer *lp, char **fs, int slaves)
Create file if it doesn&#39;t exist.
A single logging time step for a partner.
const char * name
int GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
Definition: disk.c:1817
uint64_t rel_value_us
The actual value.
struct PeerLoggingTimestep * head
DLL for logging entries: head.
unsigned int throughput_recv
Total inbound throughput for master in Bytes / s.
unsigned int total_messages_received
Total number of messages this peer has received.
static void write_bw_gnuplot_script(char *fn, struct LoggingPeer *lp, char **fs, int slaves)
struct PartnerLoggingTimestep * slaves_log
Logs for slaves.
enum GNUNET_NetworkType ats_network_type
struct BenchmarkPeer * slave
Peer.
struct BenchmarkPeer * peer
Peer.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
struct LoggingPeer * lp
Log structure of length num_peers.
uint64_t abs_value_us
The actual value.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
unsigned int total_bytes_sent
Total number of bytes this peer has sent.
A single logging time step for a peer.
int GNUNET_asprintf(char **buf, const char *format,...)
Like asprintf, just portable.
unsigned int total_messages_sent
Total number of messages this peer has sent.
int num_partners
Number of partners.
Definition: ats-testing.h:196
int no
Unique identifier.
Definition: ats-testing.h:121
#define GNUNET_log_strerror_file(level, cmd, filename)
Log an error message at log-level &#39;level&#39; that indicates a failure of the command &#39;cmd&#39; with the mess...
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition: disk.c:1049
struct GNUNET_TIME_Absolute start
Start time.
unsigned int app_rtt
Current application level delay.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
unsigned int total_messages_received
Total number of messages this peer has received.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
unsigned int throughput_sent
Total outbound throughput for master in Bytes / s.
Open the file for writing.
unsigned int total_throughput_send
Total outbound throughput for master in Bytes / s.
struct GNUNET_TIME_Relative ats_delay
struct GNUNET_TIME_Absolute timestamp
Logging timestamp.
unsigned int total_messages_sent
Total number of messages this peer has sent.
#define GNUNET_log(kind,...)
unsigned int total_throughput_recv
Total inbound throughput for master in Bytes / s.
struct PeerLoggingTimestep * next
Next in DLL.
int num_masters
Reference to perf_ats&#39; masters.
Time for absolute times used by GNUnet, in microseconds.
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_difference(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Absolute end)
Compute the time difference between the given start and end times.
Definition: time.c:353
unsigned int total_bytes_received
Total number of bytes this peer has received.
uint32_t data
The data value.
static void write_throughput_gnuplot_script(char *fn, struct LoggingPeer *lp, char **fs, int slaves)
struct GNUNET_DISK_FileHandle * GNUNET_DISK_file_open(const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
Open a file.
Definition: disk.c:1673
Handle used to access files (and pipes).
unsigned int total_bytes_received
Total number of bytes this peer has received.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_logging_now()

void GNUNET_ATS_TEST_logging_now ( struct LoggingHandle l)

Log all data now.

Parameters
llogging handle to use

Definition at line 623 of file ats-testing-log.c.

References PartnerLoggingTimestep::app_rtt, PartnerLoggingTimestep::ats_delay, PartnerLoggingTimestep::ats_distance, PartnerLoggingTimestep::ats_network_type, PartnerLoggingTimestep::ats_utilization_in, PartnerLoggingTimestep::ats_utilization_out, PartnerLoggingTimestep::bandwidth_in, BenchmarkPartner::bandwidth_in, PartnerLoggingTimestep::bandwidth_out, BenchmarkPartner::bandwidth_out, BenchmarkPartner::bytes_received, BenchmarkPartner::bytes_sent, GNUNET_ATS_Properties::delay, BenchmarkPartner::dest, GNUNET_ATS_Properties::distance, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_malloc, GNUNET_new, GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_difference(), GNUNET_TIME_UNIT_SECONDS, GNUNET_YES, LoggingPeer::head, LoggingHandle::lp, BenchmarkPartner::messages_received, BenchmarkPartner::messages_sent, BenchmarkPeer::no, LoggingHandle::num_masters, BenchmarkPeer::num_partners, p, BenchmarkPeer::partners, LoggingPeer::peer, PartnerLoggingTimestep::pref_bandwidth, BenchmarkPartner::pref_bandwidth, PartnerLoggingTimestep::pref_delay, BenchmarkPartner::pref_delay, PeerLoggingTimestep::prev, BenchmarkPartner::props, GNUNET_TIME_Relative::rel_value_us, LoggingHandle::running, GNUNET_ATS_Properties::scope, PartnerLoggingTimestep::slave, PeerLoggingTimestep::slaves_log, LoggingPeer::start, LoggingPeer::tail, PartnerLoggingTimestep::throughput_recv, PartnerLoggingTimestep::throughput_sent, PeerLoggingTimestep::timestamp, PartnerLoggingTimestep::total_app_rtt, BenchmarkPartner::total_app_rtt, PartnerLoggingTimestep::total_bytes_received, PeerLoggingTimestep::total_bytes_received, BenchmarkPeer::total_bytes_received, PartnerLoggingTimestep::total_bytes_sent, PeerLoggingTimestep::total_bytes_sent, BenchmarkPeer::total_bytes_sent, PartnerLoggingTimestep::total_messages_received, PeerLoggingTimestep::total_messages_received, BenchmarkPeer::total_messages_received, PartnerLoggingTimestep::total_messages_sent, PeerLoggingTimestep::total_messages_sent, BenchmarkPeer::total_messages_sent, PeerLoggingTimestep::total_throughput_recv, PeerLoggingTimestep::total_throughput_send, GNUNET_ATS_Properties::utilization_out, and LoggingHandle::verbose.

Referenced by collect_log_task().

624 {
625  struct LoggingPeer *bp;
626  struct PeerLoggingTimestep *mlt;
627  struct PeerLoggingTimestep *prev_log_mlt;
628  struct PartnerLoggingTimestep *slt;
629  struct PartnerLoggingTimestep *prev_log_slt;
630  struct BenchmarkPartner *p;
632  int c_s;
633  int c_m;
634  unsigned int app_rtt;
635  double mult;
636 
637  if (GNUNET_YES != l->running)
638  return;
639 
640  for (c_m = 0; c_m < l->num_masters; c_m++)
641  {
642  bp = &l->lp[c_m];
643  mlt = GNUNET_new (struct PeerLoggingTimestep);
644  GNUNET_CONTAINER_DLL_insert_tail(l->lp[c_m].head, l->lp[c_m].tail, mlt);
645  prev_log_mlt = mlt->prev;
646 
647  /* Collect data */
648  /* Current master state */
654 
655  /* Throughput */
656  if (NULL == prev_log_mlt)
657  {
658  /* Get difference to start */
660  }
661  else
662  {
663  /* Get difference to last timestep */
665  }
666 
667  /* Multiplication factor for throughput calculation */
668  mult = (double) GNUNET_TIME_UNIT_SECONDS.rel_value_us / (delta.rel_value_us);
669 
670  /* Total throughput */
671  if (NULL != prev_log_mlt)
672  {
673  if (mlt->total_bytes_sent - mlt->prev->total_bytes_sent > 0)
674  {
675  mlt->total_throughput_send = mult * (mlt->total_bytes_sent - mlt->prev->total_bytes_sent);
676  }
677  else
678  {
679  mlt->total_throughput_send = 0;
680  // mlt->total_throughput_send = prev_log_mlt->total_throughput_send; /* no msgs send */
681  }
682 
683  if (mlt->total_bytes_received - mlt->prev->total_bytes_received > 0)
684  {
686  }
687  else
688  {
689  mlt->total_throughput_recv = 0;
690  //mlt->total_throughput_recv = prev_log_mlt->total_throughput_recv; /* no msgs received */
691  }
692  }
693  else
694  {
695  mlt->total_throughput_send = mult * mlt->total_bytes_sent;
696  mlt->total_throughput_recv = mult * mlt->total_bytes_received;
697  }
698 
699  if (GNUNET_YES == l->verbose)
700  {
702  "Master[%u] delta: %llu us, bytes (sent/received): %u / %u; throughput send/recv: %u / %u\n",
703  c_m,
704  (unsigned long long) delta.rel_value_us,
705  mlt->total_bytes_sent,
708  mlt->total_throughput_recv);
709  }
710 
712  sizeof (struct PartnerLoggingTimestep));
713 
714  for (c_s = 0; c_s < bp->peer->num_partners; c_s++)
715  {
717  "Collect logging data master[%u] slave [%u]\n", c_m, c_s);
718 
719  p = &bp->peer->partners[c_s];
720  slt = &mlt->slaves_log[c_s];
721 
722  slt->slave = p->dest;
723  /* Bytes sent from master to this slave */
724  slt->total_bytes_sent = p->bytes_sent;
725  /* Messages sent from master to this slave */
727  /* Bytes master received from this slave */
729  /* Messages master received from this slave */
731  slt->total_app_rtt = p->total_app_rtt;
732  /* ats performance information */
733  slt->ats_delay = p->props.delay;
734  slt->ats_distance = p->props.distance;
735  slt->ats_network_type = p->props.scope;
738  slt->bandwidth_in = p->bandwidth_in;
739  slt->bandwidth_out = p->bandwidth_out;
740  slt->pref_bandwidth = p->pref_bandwidth;
741  slt->pref_delay = p->pref_delay;
742 
743  /* Total application level rtt */
744  if (NULL == prev_log_mlt)
745  {
746  if (0 != slt->total_messages_sent)
747  app_rtt = slt->total_app_rtt / slt->total_messages_sent;
748  else
749  app_rtt = 0;
750  }
751  else
752  {
753  prev_log_slt = &prev_log_mlt->slaves_log[c_s];
754  if ((slt->total_messages_sent - prev_log_slt->total_messages_sent) > 0)
755  app_rtt = (slt->total_app_rtt - prev_log_slt->total_app_rtt) /
756  (slt->total_messages_sent - prev_log_slt->total_messages_sent);
757  else
758  {
759  app_rtt = prev_log_slt->app_rtt; /* No messages were */
760  }
761  }
762  slt->app_rtt = app_rtt;
763 
764  /* Partner throughput */
765  if (NULL != prev_log_mlt)
766  {
767  prev_log_slt = &prev_log_mlt->slaves_log[c_s];
768  if (slt->total_bytes_sent > prev_log_slt->total_bytes_sent)
769  slt->throughput_sent = mult * (slt->total_bytes_sent - prev_log_slt->total_bytes_sent);
770  else
771  slt->throughput_sent = 0;
772 
773  if (slt->total_bytes_received > prev_log_slt->total_bytes_received)
774  slt->throughput_recv = mult *
775  (slt->total_bytes_received - prev_log_slt->total_bytes_received);
776  else
777  slt->throughput_recv = 0;
778  }
779  else
780  {
781  slt->throughput_sent = mult * slt->total_bytes_sent;
782  slt->throughput_recv = mult * slt->total_bytes_received;
783  }
784 
785  if (GNUNET_YES == l->verbose)
786  {
788  "Master [%u] -> Slave [%u]: delta: %llu us, bytes (sent/received): %u / %u; throughput send/recv: %u / %u\n",
789  c_m, c_s,
790  (unsigned long long) delta.rel_value_us,
791  mlt->total_bytes_sent,
793  slt->throughput_sent,
794  slt->throughput_recv);
795  }
796  else
798  "Master [%u]: slave [%u]\n",
799  bp->peer->no, p->dest->no);
800  }
801  }
802 }
unsigned int total_bytes_sent
Total number of bytes this peer has sent.
unsigned int total_bytes_sent
Total number of bytes this peer has sent.
Definition: ats-testing.h:217
unsigned int messages_sent
Number of messages sent to this partner.
Definition: ats-testing.h:315
unsigned int total_bytes_received
Total number of bytes this peer has received.
Definition: ats-testing.h:227
A single logging time step for a partner.
uint64_t rel_value_us
The actual value.
static struct GNUNET_TIME_Relative delta
Definition: speedup.c:35
struct PeerLoggingTimestep * head
DLL for logging entries: head.
unsigned int throughput_recv
Total inbound throughput for master in Bytes / s.
unsigned int total_messages_received
Total number of messages this peer has received.
#define GNUNET_TIME_UNIT_SECONDS
One second.
double pref_bandwidth
Current preference values for bandwidth.
Definition: ats-testing.h:350
struct BenchmarkPartner * partners
Array of partners with num_slaves entries (if master) or num_master entries (if slave) ...
Definition: ats-testing.h:191
unsigned int total_messages_received
Total number of messages this peer has received.
Definition: ats-testing.h:222
struct PartnerLoggingTimestep * slaves_log
Logs for slaves.
enum GNUNET_NetworkType ats_network_type
struct BenchmarkPeer * slave
Peer.
unsigned int bytes_received
Number of bytes received from this partner.
Definition: ats-testing.h:330
struct BenchmarkPeer * peer
Peer.
struct PeerLoggingTimestep * prev
Prev in DLL.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct LoggingPeer * lp
Log structure of length num_peers.
unsigned int total_messages_sent
Total number of messages this peer has sent.
Definition: ats-testing.h:212
unsigned int total_bytes_sent
Total number of bytes this peer has sent.
A single logging time step for a peer.
unsigned int total_messages_sent
Total number of messages this peer has sent.
int num_partners
Number of partners.
Definition: ats-testing.h:196
int no
Unique identifier.
Definition: ats-testing.h:121
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
unsigned int total_app_rtt
Accumulated RTT for all messages.
Definition: ats-testing.h:310
uint32_t bandwidth_in
Bandwidth assigned inbound.
Definition: ats-testing.h:340
double pref_delay
Current preference values for delay.
Definition: ats-testing.h:355
unsigned int total_app_rtt
Accumulated RTT for all messages.
Information about a benchmarking partner.
Definition: ats-testing.h:275
struct GNUNET_TIME_Relative delay
Delay.
unsigned int messages_received
Number of messages received from this partner.
Definition: ats-testing.h:325
uint32_t bandwidth_out
Bandwidth assigned outbound.
Definition: ats-testing.h:345
struct GNUNET_TIME_Absolute start
Start time.
unsigned int app_rtt
Current application level delay.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
Entry for a benchmark peer.
unsigned int total_messages_received
Total number of messages this peer has received.
unsigned int throughput_sent
Total outbound throughput for master in Bytes / s.
unsigned int total_throughput_send
Total outbound throughput for master in Bytes / s.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
struct GNUNET_TIME_Relative ats_delay
enum GNUNET_NetworkType scope
Which network scope does the respective address belong to? This property does not change...
struct GNUNET_TIME_Absolute timestamp
Logging timestamp.
unsigned int bytes_sent
Number of bytes sent to this partner.
Definition: ats-testing.h:320
unsigned int total_messages_sent
Total number of messages this peer has sent.
struct PeerLoggingTimestep * tail
DLL for logging entries: tail.
#define GNUNET_log(kind,...)
unsigned int total_throughput_recv
Total inbound throughput for master in Bytes / s.
int num_masters
Reference to perf_ats&#39; masters.
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_difference(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Absolute end)
Compute the time difference between the given start and end times.
Definition: time.c:353
struct GNUNET_ATS_Properties props
Current ATS properties.
Definition: ats-testing.h:335
unsigned int total_bytes_received
Total number of bytes this peer has received.
unsigned int distance
Distance on network layer (required for distance-vector routing) in hops.
struct BenchmarkPeer * dest
The partner peer.
Definition: ats-testing.h:285
#define GNUNET_malloc(size)
Wrapper around malloc.
unsigned int total_bytes_received
Total number of bytes this peer has received.
Time for relative time used by GNUnet, in microseconds.
uint32_t utilization_out
Actual traffic on this connection from this peer to the other peer.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ collect_log_task()

static void collect_log_task ( void *  cls)
static

Definition at line 806 of file ats-testing-log.c.

References LoggingHandle::frequency, GNUNET_ATS_TEST_logging_now(), GNUNET_SCHEDULER_add_delayed(), l, and LoggingHandle::log_task.

Referenced by GNUNET_ATS_TEST_logging_start().

807 {
808  struct LoggingHandle *l = cls;
809 
810  l->log_task = NULL;
814  l);
815 }
static void collect_log_task(void *cls)
static struct LoggingHandle * l
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1246
struct GNUNET_TIME_Relative frequency
struct GNUNET_SCHEDULER_Task * log_task
Logging task.
void GNUNET_ATS_TEST_logging_now(struct LoggingHandle *l)
Log all data now.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_logging_stop()

void GNUNET_ATS_TEST_logging_stop ( struct LoggingHandle l)

Stop logging.

Parameters
lthe logging handle

Definition at line 824 of file ats-testing-log.c.

References _, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_YES, LoggingHandle::log_task, and LoggingHandle::running.

Referenced by do_shutdown(), experiment_done_cb(), and GNUNET_ATS_TEST_logging_clean_up().

825 {
826  if (GNUNET_YES!= l->running)
827  return;
828 
829  if (NULL != l->log_task)
830  {
832  l->log_task = NULL;
833  }
834  l->running = GNUNET_NO;
835 
837  _("Stop logging\n"));
838 }
#define GNUNET_NO
Definition: gnunet_common.h:81
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
struct GNUNET_SCHEDULER_Task * log_task
Logging task.
#define GNUNET_log(kind,...)
#define GNUNET_YES
Definition: gnunet_common.h:80
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:965
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_logging_clean_up()

void GNUNET_ATS_TEST_logging_clean_up ( struct LoggingHandle l)

Clean up logging data.

Stop logging.

Parameters
lthe logging handle

Definition at line 846 of file ats-testing-log.c.

References GNUNET_ATS_TEST_logging_stop(), GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_YES, LoggingPeer::head, LoggingHandle::lp, LoggingHandle::num_masters, LoggingHandle::running, PeerLoggingTimestep::slaves_log, and LoggingPeer::tail.

Referenced by do_shutdown().

847 {
848  int c_m;
849  struct PeerLoggingTimestep *cur;
850 
851  if (GNUNET_YES == l->running)
853 
854  for (c_m = 0; c_m < l->num_masters; c_m++)
855  {
856  while (NULL != (cur = l->lp[c_m].head))
857  {
858  GNUNET_CONTAINER_DLL_remove (l->lp[c_m].head, l->lp[c_m].tail, cur);
859  GNUNET_free (cur->slaves_log);
860  GNUNET_free (cur);
861  }
862  }
863 
864  GNUNET_free (l->lp);
865  GNUNET_free (l);
866 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct PeerLoggingTimestep * head
DLL for logging entries: head.
struct PartnerLoggingTimestep * slaves_log
Logs for slaves.
struct LoggingPeer * lp
Log structure of length num_peers.
A single logging time step for a peer.
void GNUNET_ATS_TEST_logging_stop(struct LoggingHandle *l)
Stop logging.
struct PeerLoggingTimestep * tail
DLL for logging entries: tail.
int num_masters
Reference to perf_ats&#39; masters.
#define GNUNET_YES
Definition: gnunet_common.h:80
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_logging_start()

struct LoggingHandle* GNUNET_ATS_TEST_logging_start ( struct GNUNET_TIME_Relative  log_frequency,
const char *  testname,
struct BenchmarkPeer masters,
int  num_masters,
int  num_slaves,
int  verbose 
)

Start logging.

Parameters
log_frequencythe logging frequency
testnamethe testname
mastersthe master peers used for benchmarking
num_mastersthe number of master peers
num_slavesthe number of slave peers
verboseverbose logging
Returns
the logging handle or NULL on error

Definition at line 881 of file ats-testing-log.c.

References _, collect_log_task(), LoggingHandle::frequency, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_malloc, GNUNET_new, GNUNET_SCHEDULER_add_now(), GNUNET_TIME_absolute_get(), GNUNET_YES, l, LoggingHandle::log_task, LoggingHandle::lp, LoggingHandle::name, LoggingHandle::num_masters, LoggingHandle::num_slaves, LoggingPeer::peer, LoggingHandle::running, LoggingPeer::start, verbose, and LoggingHandle::verbose.

Referenced by topology_setup_done().

887 {
888  struct LoggingHandle *l;
889  int c_m;
890 
892  _("Start logging `%s'\n"), testname);
893 
894  l = GNUNET_new (struct LoggingHandle);
896  l->num_slaves = num_slaves;
897  l->name = testname;
898  l->frequency = log_frequency;
899  l->verbose = verbose;
900  l->lp = GNUNET_malloc (num_masters * sizeof (struct LoggingPeer));
901 
902  for (c_m = 0; c_m < num_masters; c_m ++)
903  {
904  l->lp[c_m].peer = &masters[c_m];
905  l->lp[c_m].start = GNUNET_TIME_absolute_get();
906  }
907 
908  /* Schedule logging task */
910  l->running = GNUNET_YES;
911 
912  return l;
913 }
const char * name
static void collect_log_task(void *cls)
struct BenchmarkPeer * peer
Peer.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct LoggingPeer * lp
Log structure of length num_peers.
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
static struct LoggingHandle * l
static int verbose
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
struct GNUNET_TIME_Absolute start
Start time.
struct GNUNET_TIME_Relative frequency
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
Entry for a benchmark peer.
struct GNUNET_SCHEDULER_Task * log_task
Logging task.
#define GNUNET_log(kind,...)
int num_masters
Reference to perf_ats&#39; masters.
#define GNUNET_YES
Definition: gnunet_common.h:80
#define GNUNET_malloc(size)
Wrapper around malloc.
Here is the call graph for this function:
Here is the caller graph for this function: