2025-01-14 14:42:39 +00:00
|
|
|
/* Node-type for stats streaming.
|
2017-09-03 10:53:32 +02:00
|
|
|
*
|
2025-01-14 14:42:39 +00:00
|
|
|
* Author: Steffen Vogel <post@steffenvogel.de>
|
|
|
|
* SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2017-09-03 10:53:32 +02:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2017-09-04 23:03:00 +02:00
|
|
|
#include <jansson.h>
|
|
|
|
|
2025-01-14 14:42:39 +00:00
|
|
|
#include <villas/list.hpp>
|
2019-06-23 13:35:42 +02:00
|
|
|
#include <villas/stats.hpp>
|
2020-03-04 13:06:28 +01:00
|
|
|
#include <villas/task.hpp>
|
2021-08-10 10:12:48 -04:00
|
|
|
|
|
|
|
namespace villas {
|
|
|
|
namespace node {
|
2017-09-03 10:53:32 +02:00
|
|
|
|
2025-01-14 14:42:39 +00:00
|
|
|
// Forward declarations
|
2021-08-10 10:12:48 -04:00
|
|
|
class NodeCompat;
|
2021-06-21 16:11:42 -04:00
|
|
|
|
2019-02-15 09:40:38 +01:00
|
|
|
struct stats_node_signal {
|
2025-01-14 14:42:39 +00:00
|
|
|
Node *node;
|
|
|
|
char *node_str;
|
2019-02-15 09:40:38 +01:00
|
|
|
|
2025-01-14 14:42:39 +00:00
|
|
|
enum villas::Stats::Metric metric;
|
|
|
|
enum villas::Stats::Type type;
|
2019-02-15 09:40:38 +01:00
|
|
|
};
|
|
|
|
|
2017-09-03 10:53:32 +02:00
|
|
|
struct stats_node {
|
2025-01-14 14:42:39 +00:00
|
|
|
double rate;
|
2017-09-04 23:03:00 +02:00
|
|
|
|
2025-01-14 14:42:39 +00:00
|
|
|
struct Task task;
|
2017-09-03 10:53:32 +02:00
|
|
|
|
2025-01-14 14:42:39 +00:00
|
|
|
struct List signals; // List of type struct stats_node_signal
|
2017-09-03 10:53:32 +02:00
|
|
|
};
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int stats_node_type_start(SuperNode *sn);
|
|
|
|
|
|
|
|
int stats_node_init(NodeCompat *n);
|
|
|
|
|
|
|
|
int stats_node_destroy(NodeCompat *n);
|
|
|
|
|
|
|
|
char *stats_node_print(NodeCompat *n);
|
|
|
|
|
|
|
|
int stats_node_parse(NodeCompat *n, json_t *json);
|
|
|
|
|
|
|
|
int stats_node_prepare(NodeCompat *n);
|
|
|
|
|
|
|
|
int stats_node_start(NodeCompat *n);
|
2017-09-03 10:53:32 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int stats_node_stop(NodeCompat *n);
|
2017-09-03 10:53:32 +02:00
|
|
|
|
2025-01-14 14:42:39 +00:00
|
|
|
int stats_node_read(NodeCompat *n, struct Sample *const smps[], unsigned cnt);
|
2017-09-03 10:53:32 +02:00
|
|
|
|
2021-02-16 14:15:14 +01:00
|
|
|
int stats_node_parse_signal(struct stats_node_signal *s, json_t *json);
|
2019-02-15 09:40:38 +01:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int stats_node_signal_destroy(struct stats_node_signal *s);
|
2017-09-03 10:53:32 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int stats_node_signal_parse(struct stats_node_signal *s, json_t *json);
|
2017-09-03 10:53:32 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int stats_node_poll_fds(NodeCompat *n, int fds[]);
|
2017-09-03 10:53:32 +02:00
|
|
|
|
2025-01-14 14:42:39 +00:00
|
|
|
} // namespace node
|
|
|
|
} // namespace villas
|