diff --git a/include/villas/nodes/test_rtt.hpp b/include/villas/nodes/test_rtt.hpp index d46cc9c8e..a808a62e9 100644 --- a/include/villas/nodes/test_rtt.hpp +++ b/include/villas/nodes/test_rtt.hpp @@ -62,6 +62,7 @@ protected: int start(); int stop(); + double getEstimatedDuration() const; }; Task task; // The periodic task for test_rtt_read() @@ -76,14 +77,14 @@ protected: bool shutdown; - enum Mode { - MIN, - MAX, - STOP_COUNT, - STOP_DURATION, - AT_LEAST_COUNT, - AT_LEAST_DURATION - } mode; + enum Mode { + MIN, + MAX, + STOP_COUNT, + STOP_DURATION, + AT_LEAST_COUNT, + AT_LEAST_DURATION + } mode; virtual int _read(struct Sample *smps[], unsigned cnt); @@ -107,6 +108,8 @@ public: virtual std::vector getPollFDs(); virtual const std::string &getDetails(); + + double getEstimatedDuration() const; }; class TestRTTNodeFactory : public NodeFactory { diff --git a/lib/nodes/test_rtt.cpp b/lib/nodes/test_rtt.cpp index f37197e67..d7dd19884 100644 --- a/lib/nodes/test_rtt.cpp +++ b/lib/nodes/test_rtt.cpp @@ -83,6 +83,10 @@ json_t *TestRTT::Case::getMetadata() { "received", received, "missed", missed, "warmup", json_warmup); } +double TestRTT::Case::getEstimatedDuration() const { + return (count_warmup + count) * rate; +} + int TestRTT::prepare() { unsigned max_values = 0; @@ -291,8 +295,9 @@ int TestRTT::parse(json_t *json) { const std::string &TestRTT::getDetails() { if (details.empty()) { - details = fmt::format("output={}, prefix={}, #cases={}, shutdown={}", - output, prefix, cases.size(), shutdown); + details = fmt::format( + "output={}, prefix={}, #cases={}, shutdown={}, estimated_duration={}s", + output, prefix, cases.size(), shutdown, getEstimatedDuration()); } return details; @@ -445,6 +450,16 @@ int TestRTT::_write(struct Sample *smps[], unsigned cnt) { std::vector TestRTT::getPollFDs() { return {task.getFD()}; } +double TestRTT : getEstimatedDuration() const { + double duration = 0; + + for (auto &c : cases) { + duration += c.getEstimatedDuration(); + } + + return duration; +} + int TestRTTNodeFactory::start(SuperNode *sn_) { sn = sn_;