mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
update VILLAScommon submodule
This commit is contained in:
parent
05ac6dd61f
commit
ebf2943240
44 changed files with 122 additions and 57 deletions
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit a5aece6b78d5472119d40368ede23a53782faaaf
|
||||
Subproject commit da710c8ec3e94b810fe6bb8a98b0ac1debcdcf26
|
|
@ -88,7 +88,7 @@ struct stats_type_description {
|
|||
|
||||
struct stats {
|
||||
enum state state;
|
||||
struct hist histograms[STATS_METRIC_COUNT];
|
||||
villas::Hist histograms[STATS_METRIC_COUNT];
|
||||
};
|
||||
|
||||
extern struct stats_metric_description stats_metrics[];
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
return ret;
|
||||
|
||||
/* Properly terminate current instance */
|
||||
killme(SIGTERM);
|
||||
utils::killme(SIGTERM);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
virtual int execute(json_t *args, json_t **resp)
|
||||
{
|
||||
killme(SIGTERM);
|
||||
utils::killme(SIGTERM);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include <villas/signal.h>
|
||||
#include <villas/timing.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static size_t csv_sprint_single(struct io *io, char *buf, size_t len, const struct sample *smp)
|
||||
{
|
||||
size_t off = 0;
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <villas/plugin.h>
|
||||
#include <villas/formats/protobuf.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static enum signal_type protobuf_detect_format(Villas__Node__Value *val)
|
||||
{
|
||||
switch (val->value_case) {
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <villas/utils.hpp>
|
||||
|
||||
using namespace std::complex_literals;
|
||||
using namespace villas::utils;
|
||||
|
||||
namespace villas {
|
||||
namespace node {
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include <villas/utils.hpp>
|
||||
#include <villas/sample.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static int io_print_lines(struct io *io, struct sample *smps[], unsigned cnt)
|
||||
{
|
||||
int ret;
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
|
||||
#include <villas/nodes/socket.hpp>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
int if_init(struct interface *i, struct rtnl_link *link)
|
||||
{
|
||||
i->nl_link = link;
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <villas/kernel/kernel.h>
|
||||
#include <villas/utils.hpp>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static const double max_percent_value = 0xffffffff;
|
||||
|
||||
int tc_netem_parse(struct rtnl_qdisc **netem, json_t *cfg)
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <villas/node.h>
|
||||
#include <villas/signal.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
int mapping_parse_str(struct mapping_entry *me, const char *str, struct vlist *nodes)
|
||||
{
|
||||
char *cpy, *node, *type, *field, *end, *lasts;
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <villas/utils.hpp>
|
||||
#include <villas/memory.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static struct memory_allocation * memory_heap_alloc(struct memory_type *m, size_t len, size_t alignment)
|
||||
{
|
||||
int ret;
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
#include <villas/utils.hpp>
|
||||
#include <villas/kernel/kernel.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static size_t pgsz = -1;
|
||||
static size_t hugepgsz = -1;
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <villas/utils.hpp>
|
||||
#include <villas/memory/ib.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
struct ibv_mr * memory_ib_get_mr(void *ptr)
|
||||
{
|
||||
struct memory_allocation *ma;
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <villas/memory.h>
|
||||
#include <villas/utils.hpp>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static struct memory_allocation * memory_managed_alloc(struct memory_type *m, size_t len, size_t alignment)
|
||||
{
|
||||
/* Simple first-fit allocation */
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
#include <villas/kernel/tc_netem.h>
|
||||
#endif /* WITH_NETEM */
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
int node_init(struct node *n, struct node_type *vt)
|
||||
{
|
||||
int ret;
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <villas/node.h>
|
||||
#include <villas/node_direction.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
int node_direction_prepare(struct node_direction *nd, struct node *n)
|
||||
{
|
||||
assert(nd->state == STATE_CHECKED);
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include <villas/utils.hpp>
|
||||
#include <villas/format_type.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static void amqp_default_ssl_info(struct amqp_ssl_info *s)
|
||||
{
|
||||
s->verify_peer = 1;
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include <villas/nodes/comedi.hpp>
|
||||
#include <villas/utils.hpp>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
/* Utility functions to dump a comedi_cmd graciously taken from comedilib demo */
|
||||
static char* comedi_cmd_trigger_src(unsigned int src, char *buf);
|
||||
static void comedi_dump_cmd(comedi_cmd *cmd, int debug_level);
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <villas/plugin.h>
|
||||
#include <villas/io.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static char * file_format_name(const char *format, struct timespec *ts)
|
||||
{
|
||||
struct tm tm;
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#define CONFIG_SV_DEFAULT_PRIORITY 4
|
||||
#define CONFIG_SV_DEFAULT_VLAN_ID 0
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
const struct iec61850_type_descriptor type_descriptors[] = {
|
||||
/* name, iec_type, type, size, supported */
|
||||
{ "boolean", iec61850_type::BOOLEAN, SIGNAL_TYPE_BOOLEAN, 1, false, false },
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#define CONFIG_SV_DEFAULT_PRIORITY 4
|
||||
#define CONFIG_SV_DEFAULT_VLAN_ID 0
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static void iec61850_sv_listener(SVSubscriber subscriber, void *ctx, SVSubscriber_ASDU asdu)
|
||||
{
|
||||
struct node *n = (struct node *) ctx;
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include <villas/memory/ib.h>
|
||||
#include <villas/timing.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static int ib_disconnect(struct node *n)
|
||||
{
|
||||
struct infiniband *ib = (struct infiniband *) n->_vd;
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include <villas/nodes/influxdb.hpp>
|
||||
#include <villas/memory.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
int influxdb_parse(struct node *n, json_t *json)
|
||||
{
|
||||
struct influxdb *i = (struct influxdb *) n->_vd;
|
||||
|
@ -226,4 +228,4 @@ __attribute__((destructor(110)))
|
|||
static void deregister_plugin() {
|
||||
if (plugins.state != STATE_DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <villas/nodes/loopback.hpp>
|
||||
#include <villas/memory.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
int loopback_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct loopback *l = (struct loopback *) n->_vd;
|
||||
|
@ -180,4 +182,4 @@ __attribute__((destructor(110)))
|
|||
static void deregister_plugin() {
|
||||
if (plugins.state != STATE_DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <villas/utils.hpp>
|
||||
#include <villas/format_type.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static void mqtt_log_cb(struct mosquitto *mosq, void *userdata, int level, const char *str)
|
||||
{
|
||||
switch (level) {
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <villas/utils.hpp>
|
||||
#include <villas/format_type.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
int nanomsg_reverse(struct node *n)
|
||||
{
|
||||
struct nanomsg *m = (struct nanomsg *) n->_vd;
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <villas/plugin.h>
|
||||
#include <villas/node/config.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
/* Some global settings */
|
||||
static char *name = nullptr;
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ extern "C" {
|
|||
static pthread_t re_pthread;
|
||||
|
||||
using namespace villas::node;
|
||||
using namespace villas::utils;
|
||||
|
||||
static struct plugin p;
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#include <villas/timing.h>
|
||||
#include <villas/utils.hpp>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
int shmem_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct shmem *shm = (struct shmem *) n->_vd;
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <villas/plugin.h>
|
||||
#include <villas/nodes/signal_generator.hpp>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static enum signal_generator::type signal_generator_lookup_type(const char *type)
|
||||
{
|
||||
if (!strcmp(type, "random"))
|
||||
|
@ -331,4 +333,4 @@ __attribute__((destructor(110)))
|
|||
static void deregister_plugin() {
|
||||
if (plugins.state != STATE_DESTROYED)
|
||||
vlist_remove_all(&plugins, &p);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
static struct plugin p;
|
||||
|
||||
using namespace villas::node;
|
||||
using namespace villas::utils;
|
||||
|
||||
int socket_type_start(villas::node::SuperNode *sn)
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#define STATS_METRICS 6
|
||||
|
||||
using namespace villas::node;
|
||||
using namespace villas::utils;
|
||||
|
||||
static struct vlist *nodes; /** The global list of nodes */
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include <villas/plugin.h>
|
||||
#include <villas/nodes/test_rtt.hpp>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static struct plugin p;
|
||||
|
||||
static int test_rtt_case_start(struct test_rtt *t, int id)
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include <villas/nodes/uldaq.hpp>
|
||||
#include <villas/memory.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static unsigned num_devs = ULDAQ_MAX_DEV_COUNT;
|
||||
static DaqDeviceDescriptor descriptors[ULDAQ_MAX_DEV_COUNT];
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
#include <villas/formats/msg_format.h>
|
||||
#include <villas/super_node.hpp>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
#define DEFAULT_WEBSOCKET_BUFFER_SIZE (1 << 12)
|
||||
|
||||
/* Private static storage */
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <villas/plugin.h>
|
||||
#include <villas/format_type.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
static void *context;
|
||||
|
||||
#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_MAJOR_VERSION >= 4 && ZMQ_MINOR_VERSION >= 2 && ZMQ_MINOR_VERSION >= 3
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <villas/path_destination.h>
|
||||
|
||||
using namespace villas;
|
||||
using namespace villas::utils;
|
||||
|
||||
static void * path_run_single(void *arg)
|
||||
{
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include <villas/signal.h>
|
||||
#include <villas/list.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
int sample_init(struct sample *s)
|
||||
{
|
||||
struct pool *p = sample_pool(s);
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <villas/node.h>
|
||||
#include <villas/mapping.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
int signal_init(struct signal *s)
|
||||
{
|
||||
s->enabled = true;
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <villas/utils.hpp>
|
||||
#include <villas/kernel/nl.h>
|
||||
|
||||
using namespace villas::utils;
|
||||
|
||||
char * socket_print_addr(struct sockaddr *saddr)
|
||||
{
|
||||
union sockaddr_union *sa = (union sockaddr_union *) saddr;
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
#include <villas/node.h>
|
||||
#include <villas/table.hpp>
|
||||
|
||||
using namespace villas;
|
||||
using namespace villas::utils;
|
||||
|
||||
struct stats_metric_description stats_metrics[] = {
|
||||
{ "skipped", STATS_METRIC_SMPS_SKIPPED, "samples", "Skipped samples and the distance between them" },
|
||||
{ "reordered", STATS_METRIC_SMPS_REORDERED, "samples", "Reordered samples and the distance between them" },
|
||||
|
@ -94,7 +97,7 @@ int stats_init(struct stats *s, int buckets, int warmup)
|
|||
assert(s->state == STATE_DESTROYED);
|
||||
|
||||
for (int i = 0; i < STATS_METRIC_COUNT; i++)
|
||||
hist_init(&s->histograms[i], buckets, warmup);
|
||||
new (&s->histograms[i]) Hist(buckets, warmup);
|
||||
|
||||
s->state = STATE_INITIALIZED;
|
||||
|
||||
|
@ -106,7 +109,7 @@ int stats_destroy(struct stats *s)
|
|||
assert(s->state != STATE_DESTROYED);
|
||||
|
||||
for (int i = 0; i < STATS_METRIC_COUNT; i++)
|
||||
hist_destroy(&s->histograms[i]);
|
||||
s->histograms[i].~Hist();
|
||||
|
||||
s->state = STATE_DESTROYED;
|
||||
|
||||
|
@ -117,7 +120,7 @@ void stats_update(struct stats *s, enum stats_metric id, double val)
|
|||
{
|
||||
assert(s->state == STATE_INITIALIZED);
|
||||
|
||||
hist_put(&s->histograms[id], val);
|
||||
s->histograms[id].put(val);
|
||||
}
|
||||
|
||||
json_t * stats_json(struct stats *s)
|
||||
|
@ -128,9 +131,9 @@ json_t * stats_json(struct stats *s)
|
|||
|
||||
for (int i = 0; i < STATS_METRIC_COUNT; i++) {
|
||||
struct stats_metric_description *d = &stats_metrics[i];
|
||||
struct hist *h = &s->histograms[i];
|
||||
const Hist &h = s->histograms[i];
|
||||
|
||||
json_object_set_new(obj, d->name, hist_json(h));
|
||||
json_object_set_new(obj, d->name, h.toJson());
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
@ -141,11 +144,11 @@ void stats_reset(struct stats *s)
|
|||
assert(s->state == STATE_INITIALIZED);
|
||||
|
||||
for (int i = 0; i < STATS_METRIC_COUNT; i++)
|
||||
hist_reset(&s->histograms[i]);
|
||||
s->histograms[i].reset();
|
||||
}
|
||||
|
||||
static std::vector<TableColumn> stats_columns = {
|
||||
{ 10, TableColumn::align::LEFT, "Node", "%s" },
|
||||
{ 10, TableColumn::align::LEFT, "Node", "%s" },
|
||||
{ 10, TableColumn::align::RIGHT, "Recv", "%ju", "pkts" },
|
||||
{ 10, TableColumn::align::RIGHT, "Sent", "%ju", "pkts" },
|
||||
{ 10, TableColumn::align::RIGHT, "Drop", "%ju", "pkts" },
|
||||
|
@ -179,32 +182,32 @@ void stats_print_periodic(struct stats *s, FILE *f, enum stats_format fmt, struc
|
|||
case STATS_FORMAT_HUMAN:
|
||||
stats_table.row(11,
|
||||
node_name_short(n),
|
||||
(uintmax_t) hist_total(&s->histograms[STATS_METRIC_OWD]),
|
||||
(uintmax_t) hist_total(&s->histograms[STATS_METRIC_AGE]),
|
||||
(uintmax_t) hist_total(&s->histograms[STATS_METRIC_SMPS_REORDERED]),
|
||||
(uintmax_t) hist_total(&s->histograms[STATS_METRIC_SMPS_SKIPPED]),
|
||||
(double) hist_last(&s->histograms[STATS_METRIC_OWD]),
|
||||
(double) hist_mean(&s->histograms[STATS_METRIC_OWD]),
|
||||
(double) 1.0 / hist_last(&s->histograms[STATS_METRIC_GAP_RECEIVED]),
|
||||
(double) 1.0 / hist_mean(&s->histograms[STATS_METRIC_GAP_RECEIVED]),
|
||||
(double) hist_mean(&s->histograms[STATS_METRIC_AGE]),
|
||||
(double) hist_highest(&s->histograms[STATS_METRIC_AGE])
|
||||
(uintmax_t) s->histograms[STATS_METRIC_OWD].getTotal(),
|
||||
(uintmax_t) s->histograms[STATS_METRIC_AGE].getTotal(),
|
||||
(uintmax_t) s->histograms[STATS_METRIC_SMPS_REORDERED].getTotal(),
|
||||
(uintmax_t) s->histograms[STATS_METRIC_SMPS_SKIPPED].getTotal(),
|
||||
(double) s->histograms[STATS_METRIC_OWD].getLast(),
|
||||
(double) s->histograms[STATS_METRIC_OWD].getMean(),
|
||||
(double) 1.0 / s->histograms[STATS_METRIC_GAP_RECEIVED].getLast(),
|
||||
(double) 1.0 / s->histograms[STATS_METRIC_GAP_RECEIVED].getMean(),
|
||||
(double) s->histograms[STATS_METRIC_AGE].getMean(),
|
||||
(double) s->histograms[STATS_METRIC_AGE].getHighest()
|
||||
);
|
||||
break;
|
||||
|
||||
case STATS_FORMAT_JSON: {
|
||||
json_t *json_stats = json_pack("{ s: s, s: i, s: i, s: i, s: i, s: f, s: f, s: f, s: f, s: f, s: f }",
|
||||
"node", node_name(n),
|
||||
"recv", hist_total(&s->histograms[STATS_METRIC_OWD]),
|
||||
"sent", hist_total(&s->histograms[STATS_METRIC_AGE]),
|
||||
"dropped", hist_total(&s->histograms[STATS_METRIC_SMPS_REORDERED]),
|
||||
"skipped", hist_total(&s->histograms[STATS_METRIC_SMPS_SKIPPED]),
|
||||
"owd_last", 1.0 / hist_last(&s->histograms[STATS_METRIC_OWD]),
|
||||
"owd_mean", 1.0 / hist_mean(&s->histograms[STATS_METRIC_OWD]),
|
||||
"rate_last", 1.0 / hist_last(&s->histograms[STATS_METRIC_GAP_SAMPLE]),
|
||||
"rate_mean", 1.0 / hist_mean(&s->histograms[STATS_METRIC_GAP_SAMPLE]),
|
||||
"age_mean", hist_mean(&s->histograms[STATS_METRIC_AGE]),
|
||||
"age_max", hist_highest(&s->histograms[STATS_METRIC_AGE])
|
||||
"recv", s->histograms[STATS_METRIC_OWD].getTotal(),
|
||||
"sent", s->histograms[STATS_METRIC_AGE].getTotal(),
|
||||
"dropped", s->histograms[STATS_METRIC_SMPS_REORDERED].getTotal(),
|
||||
"skipped", s->histograms[STATS_METRIC_SMPS_SKIPPED].getTotal(),
|
||||
"owd_last", 1.0 / s->histograms[STATS_METRIC_OWD].getLast(),
|
||||
"owd_mean", 1.0 / s->histograms[STATS_METRIC_OWD].getMean(),
|
||||
"rate_last", 1.0 / s->histograms[STATS_METRIC_GAP_SAMPLE].getLast(),
|
||||
"rate_mean", 1.0 / s->histograms[STATS_METRIC_GAP_SAMPLE].getMean(),
|
||||
"age_mean", s->histograms[STATS_METRIC_AGE].getMean(),
|
||||
"age_max", s->histograms[STATS_METRIC_AGE].getHighest()
|
||||
);
|
||||
json_dumpf(json_stats, f, 0);
|
||||
break;
|
||||
|
@ -224,7 +227,7 @@ void stats_print(struct stats *s, FILE *f, enum stats_format fmt, int verbose)
|
|||
struct stats_metric_description *d = &stats_metrics[i];
|
||||
|
||||
info("%s: %s", d->name, d->desc);
|
||||
hist_print(&s->histograms[i], verbose);
|
||||
s->histograms[i].print(verbose);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -243,36 +246,36 @@ union signal_data stats_get_value(const struct stats *s, enum stats_metric sm, e
|
|||
{
|
||||
assert(s->state == STATE_INITIALIZED);
|
||||
|
||||
const struct hist *h = &s->histograms[sm];
|
||||
const Hist &h = s->histograms[sm];
|
||||
union signal_data d;
|
||||
|
||||
switch (st) {
|
||||
case STATS_TYPE_TOTAL:
|
||||
d.i = h->total;
|
||||
d.i = h.getTotal();
|
||||
break;
|
||||
|
||||
case STATS_TYPE_LAST:
|
||||
d.f = h->last;
|
||||
d.f = h.getLast();
|
||||
break;
|
||||
|
||||
case STATS_TYPE_HIGHEST:
|
||||
d.f = h->highest;
|
||||
d.f = h.getHighest();
|
||||
break;
|
||||
|
||||
case STATS_TYPE_LOWEST:
|
||||
d.f = h->lowest;
|
||||
d.f = h.getLowest();
|
||||
break;
|
||||
|
||||
case STATS_TYPE_MEAN:
|
||||
d.f = hist_mean(h);
|
||||
d.f = h.getMean();
|
||||
break;
|
||||
|
||||
case STATS_TYPE_STDDEV:
|
||||
d.f = hist_stddev(h);
|
||||
d.f = h.getStddev();
|
||||
break;
|
||||
|
||||
case STATS_TYPE_VAR:
|
||||
d.f = hist_var(h);
|
||||
d.f = h.getVar();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
using namespace villas;
|
||||
using namespace villas::node;
|
||||
using namespace villas::utils;
|
||||
|
||||
SuperNode::SuperNode() :
|
||||
state(STATE_INITIALIZED),
|
||||
|
|
|
@ -168,7 +168,7 @@ check: if (optarg == endptr)
|
|||
{
|
||||
int ret;
|
||||
|
||||
struct hist hist;
|
||||
Hist hist(hist_buckets, hist_warmup);
|
||||
struct timespec send, recv;
|
||||
|
||||
struct sample *smp_send = (struct sample *) new char[SAMPLE_LENGTH(2)];
|
||||
|
@ -197,10 +197,6 @@ check: if (optarg == endptr)
|
|||
if (ret)
|
||||
throw RuntimeError("Failed to start node {}: reason={}", node_name(node), ret);
|
||||
|
||||
ret = hist_init(&hist, hist_buckets, hist_warmup);
|
||||
if (ret)
|
||||
throw RuntimeError("Failed to initialize histogram");
|
||||
|
||||
/* Print header */
|
||||
fprintf(stdout, "%17s%5s%10s%10s%10s%10s%10s\n", "timestamp", "seq", "rtt", "min", "max", "mean", "stddev");
|
||||
|
||||
|
@ -222,30 +218,26 @@ check: if (optarg == endptr)
|
|||
if (rtt < 0)
|
||||
logger->warn("Negative RTT: {}", rtt);
|
||||
|
||||
hist_put(&hist, rtt);
|
||||
hist.put(rtt);
|
||||
|
||||
smp_send->sequence++;
|
||||
|
||||
fprintf(stdout, "%10lu.%06lu%5" PRIu64 "%10.3f%10.3f%10.3f%10.3f%10.3f\n",
|
||||
recv.tv_sec, recv.tv_nsec / 1000, smp_send->sequence,
|
||||
1e3 * rtt, 1e3 * hist.lowest, 1e3 * hist.highest,
|
||||
1e3 * hist_mean(&hist), 1e3 * hist_stddev(&hist));
|
||||
1e3 * rtt, 1e3 * hist.getLowest(), 1e3 * hist.getHighest(),
|
||||
1e3 * hist.getMean(), 1e3 * hist.getStddev());
|
||||
}
|
||||
|
||||
struct stat st;
|
||||
if (!fstat(fd, &st)) {
|
||||
FILE *f = fdopen(fd, "w");
|
||||
hist_dump_matlab(&hist, f);
|
||||
hist.dumpMatlab(f);
|
||||
fclose(f);
|
||||
}
|
||||
else
|
||||
throw RuntimeError("Invalid file descriptor: {}", fd);
|
||||
|
||||
hist_print(&hist, 1);
|
||||
|
||||
ret = hist_destroy(&hist);
|
||||
if (ret)
|
||||
throw RuntimeError("Failed to destroy histogram");
|
||||
hist.print(true);
|
||||
|
||||
ret = node_stop(node);
|
||||
if (ret)
|
||||
|
|
Loading…
Add table
Reference in a new issue