2017-07-06 23:48:19 +02:00
|
|
|
/** Node type: Node-type for testing Round-trip Time.
|
|
|
|
*
|
|
|
|
* @file
|
2022-12-14 17:41:58 +01:00
|
|
|
* @author Steffen Vogel <post@steffenvogel.de>
|
2022-03-15 09:28:57 -04:00
|
|
|
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
|
2022-07-04 18:20:03 +02:00
|
|
|
* @license Apache 2.0
|
2017-07-06 23:48:19 +02:00
|
|
|
*********************************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
#include <villas/list.hpp>
|
2021-05-10 00:12:30 +02:00
|
|
|
#include <villas/format.hpp>
|
2020-03-04 13:06:28 +01:00
|
|
|
#include <villas/task.hpp>
|
2017-07-06 23:48:19 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
namespace villas {
|
|
|
|
namespace node {
|
|
|
|
|
2017-09-16 15:34:16 +02:00
|
|
|
/* Forward declarations */
|
2021-08-10 10:12:48 -04:00
|
|
|
class NodeCompat;
|
|
|
|
struct Sample;
|
|
|
|
|
2017-09-16 15:34:16 +02:00
|
|
|
struct test_rtt;
|
|
|
|
|
2017-07-06 23:48:19 +02:00
|
|
|
struct test_rtt_case {
|
|
|
|
double rate;
|
2019-04-08 08:59:51 +02:00
|
|
|
unsigned values;
|
2021-05-10 00:12:30 +02:00
|
|
|
unsigned limit; /**< The number of samples we take per test. */
|
2017-09-16 15:34:16 +02:00
|
|
|
|
|
|
|
char *filename;
|
2019-04-08 10:15:24 +02:00
|
|
|
char *filename_formatted;
|
2021-02-16 14:15:14 +01:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
NodeCompat *node;
|
2017-07-06 23:48:19 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct test_rtt {
|
2021-05-10 00:12:30 +02:00
|
|
|
struct Task task; /**< The periodic task for test_rtt_read() */
|
2021-08-10 10:12:48 -04:00
|
|
|
Format *formatter;/**< The format of the output file */
|
2021-05-10 00:12:30 +02:00
|
|
|
FILE *stream;
|
2017-09-16 15:34:16 +02:00
|
|
|
|
2021-05-10 00:12:30 +02:00
|
|
|
double cooldown; /**< Number of seconds to wait beween tests. */
|
2017-09-16 15:34:16 +02:00
|
|
|
|
2021-05-10 00:12:30 +02:00
|
|
|
int current; /**< Index of current test in test_rtt::cases */
|
2017-09-16 15:34:16 +02:00
|
|
|
int counter;
|
2017-07-06 23:48:19 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
struct List cases; /**< List of test cases */
|
2017-07-06 23:48:19 +02:00
|
|
|
|
2021-05-10 00:12:30 +02:00
|
|
|
char *output; /**< The directory where we place the results. */
|
|
|
|
char *prefix; /**< An optional prefix in the filename. */
|
2017-07-06 23:48:19 +02:00
|
|
|
};
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
char * test_rtt_print(NodeCompat *n);
|
|
|
|
|
|
|
|
int test_rtt_parse(NodeCompat *n, json_t *json);
|
|
|
|
|
|
|
|
int test_rtt_prepare(NodeCompat *n);
|
|
|
|
|
|
|
|
int test_rtt_init(NodeCompat *n);
|
|
|
|
|
|
|
|
int test_rtt_destroy(NodeCompat *n);
|
2017-07-06 23:48:19 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int test_rtt_start(NodeCompat *n);
|
2017-07-06 23:48:19 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int test_rtt_stop(NodeCompat *n);
|
2017-07-06 23:48:19 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int test_rtt_read(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
|
2017-07-06 23:48:19 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int test_rtt_write(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
|
2017-07-06 23:48:19 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int test_rtt_poll_fds(NodeCompat *n, int fds[]);
|
2017-07-06 23:48:19 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
} /* namespace node */
|
|
|
|
} /* namespace villas */
|