mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
test_rtt: Print estimated test durations
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
parent
f6c7434a61
commit
c4afbf5453
2 changed files with 28 additions and 10 deletions
|
@ -62,6 +62,7 @@ protected:
|
||||||
|
|
||||||
int start();
|
int start();
|
||||||
int stop();
|
int stop();
|
||||||
|
double getEstimatedDuration() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
Task task; // The periodic task for test_rtt_read()
|
Task task; // The periodic task for test_rtt_read()
|
||||||
|
@ -76,14 +77,14 @@ protected:
|
||||||
|
|
||||||
bool shutdown;
|
bool shutdown;
|
||||||
|
|
||||||
enum Mode {
|
enum Mode {
|
||||||
MIN,
|
MIN,
|
||||||
MAX,
|
MAX,
|
||||||
STOP_COUNT,
|
STOP_COUNT,
|
||||||
STOP_DURATION,
|
STOP_DURATION,
|
||||||
AT_LEAST_COUNT,
|
AT_LEAST_COUNT,
|
||||||
AT_LEAST_DURATION
|
AT_LEAST_DURATION
|
||||||
} mode;
|
} mode;
|
||||||
|
|
||||||
virtual int _read(struct Sample *smps[], unsigned cnt);
|
virtual int _read(struct Sample *smps[], unsigned cnt);
|
||||||
|
|
||||||
|
@ -107,6 +108,8 @@ public:
|
||||||
virtual std::vector<int> getPollFDs();
|
virtual std::vector<int> getPollFDs();
|
||||||
|
|
||||||
virtual const std::string &getDetails();
|
virtual const std::string &getDetails();
|
||||||
|
|
||||||
|
double getEstimatedDuration() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TestRTTNodeFactory : public NodeFactory {
|
class TestRTTNodeFactory : public NodeFactory {
|
||||||
|
|
|
@ -83,6 +83,10 @@ json_t *TestRTT::Case::getMetadata() {
|
||||||
"received", received, "missed", missed, "warmup", json_warmup);
|
"received", received, "missed", missed, "warmup", json_warmup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double TestRTT::Case::getEstimatedDuration() const {
|
||||||
|
return (count_warmup + count) * rate;
|
||||||
|
}
|
||||||
|
|
||||||
int TestRTT::prepare() {
|
int TestRTT::prepare() {
|
||||||
unsigned max_values = 0;
|
unsigned max_values = 0;
|
||||||
|
|
||||||
|
@ -291,8 +295,9 @@ int TestRTT::parse(json_t *json) {
|
||||||
|
|
||||||
const std::string &TestRTT::getDetails() {
|
const std::string &TestRTT::getDetails() {
|
||||||
if (details.empty()) {
|
if (details.empty()) {
|
||||||
details = fmt::format("output={}, prefix={}, #cases={}, shutdown={}",
|
details = fmt::format(
|
||||||
output, prefix, cases.size(), shutdown);
|
"output={}, prefix={}, #cases={}, shutdown={}, estimated_duration={}s",
|
||||||
|
output, prefix, cases.size(), shutdown, getEstimatedDuration());
|
||||||
}
|
}
|
||||||
|
|
||||||
return details;
|
return details;
|
||||||
|
@ -445,6 +450,16 @@ int TestRTT::_write(struct Sample *smps[], unsigned cnt) {
|
||||||
|
|
||||||
std::vector<int> TestRTT::getPollFDs() { return {task.getFD()}; }
|
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_) {
|
int TestRTTNodeFactory::start(SuperNode *sn_) {
|
||||||
sn = sn_;
|
sn = sn_;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue