1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

test_rtt: Print estimated test durations

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
Steffen Vogel 2024-05-28 10:42:33 +02:00 committed by pipeacosta
parent 0601ede07b
commit b4b86aa220
2 changed files with 28 additions and 10 deletions

View file

@ -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<int> getPollFDs();
virtual const std::string &getDetails();
double getEstimatedDuration() const;
};
class TestRTTNodeFactory : public NodeFactory {

View file

@ -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<int> 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_;