From 19982bf49bfe0e62f456131bc1f639f228571c33 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 27 May 2024 18:09:31 +0200 Subject: [PATCH] test_rtt: Improve statistics Signed-off-by: Steffen Vogel --- include/villas/nodes/test_rtt.hpp | 7 ++++--- lib/nodes/test_rtt.cpp | 18 +++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/include/villas/nodes/test_rtt.hpp b/include/villas/nodes/test_rtt.hpp index dc3f98d81..560d545ad 100644 --- a/include/villas/nodes/test_rtt.hpp +++ b/include/villas/nodes/test_rtt.hpp @@ -33,15 +33,16 @@ protected: warmup; // Number of seconds to wait between before recording samples. double cooldown; // Number of seconds to wait between tests. unsigned values; - unsigned missed; unsigned limit; // The number of samples we send per test. unsigned sent; unsigned received; + unsigned missed; unsigned limit_warmup; // The number of samples we send during warmup. unsigned sent_warmup; unsigned received_warmup; + unsigned missed_warmup; struct timespec started; struct timespec stopped; @@ -55,8 +56,8 @@ protected: Case(TestRTT *n, int id, int rate, float warmup, float cooldown, int values, int limit, int limit_warmup, const std::string &filename) : node(n), id(id), rate(rate), warmup(warmup), cooldown(cooldown), - values(values), missed(0), limit(limit), sent(0), received(0), - limit_warmup(limit_warmup), sent_warmup(0), received_warmup(0), + values(values), limit(limit), sent(0), received(0), missed(0), + limit_warmup(limit_warmup), sent_warmup(0), received_warmup(0), missed_warmup(0), filename(filename){}; int start(); diff --git a/lib/nodes/test_rtt.cpp b/lib/nodes/test_rtt.cpp index ffabd02fb..8da30b7b1 100644 --- a/lib/nodes/test_rtt.cpp +++ b/lib/nodes/test_rtt.cpp @@ -26,7 +26,7 @@ static SuperNode *sn = nullptr; int TestRTT::Case::start() { node->logger->info("Starting case #{}/{}: filename={}, rate={}/s, values={}, " - "limit={}smps, warmup={}s, cooldown={}s", + "limit={}smps, warmup={:.3f}s, cooldown={:.3f}s", id + 1, node->cases.size(), filename_formatted, rate, values, limit, warmup, cooldown); @@ -59,7 +59,7 @@ int TestRTT::Case::stop() { if (ret) throw SystemError("Failed to close file"); - node->logger->info("Stopping case #{}/{}: sent={}, received={}, duration={:.2}", id + 1, node->cases.size(), sent, received, time_delta(&started, &stopped)); + node->logger->info("Stopping case #{}/{}: limit={}smps, sent={}smps, received={}smps, missed={}smps, duration={:.3f}s", id + 1, node->cases.size(), limit, sent, received, missed, time_delta(&started, &stopped)); return 0; } @@ -68,15 +68,15 @@ json_t *TestRTT::Case::getMetadata() { json_t *json_warmup = nullptr; if (limit_warmup > 0) { - json_warmup = json_pack("{ s: i, s: i, s: i }", "limit", limit_warmup, - "sent", sent_warmup, "received", received_warmup); + json_warmup = json_pack("{ s: i, s: i, s: i, s: i }", "limit", limit_warmup, + "sent", sent_warmup, "received", received_warmup, "missed", missed_warmup); } return json_pack( "{ s: i, s: f, s: i, s: f, s: f, s: i, s: i, s: i, s: i, s: o* }", "id", id, "rate", rate, "values", values, "started", time_to_double(&started), - "stopped", time_to_double(&stopped), "missed", missed, "limit", limit, - "sent", sent, "received", received, "warmup", json_warmup); + "stopped", time_to_double(&stopped), "limit", limit, + "sent", sent, "received", received, "missed", missed, "warmup", json_warmup); } int TestRTT::prepare() { @@ -296,7 +296,11 @@ int TestRTT::_read(struct Sample *smps[], unsigned cnt) { auto steps = task.wait(); if (steps > 1) { logger->warn("Skipped {} steps", steps - 1); - current->missed += steps - 1; + + if (current->sent_warmup < current->limit_warmup) + current->missed_warmup += steps - 1; + else + current->missed += steps - 1; } // Cooldown of case completed..