Improve periodic activities flags logic

This commit is contained in:
emanuele-f 2020-02-25 11:21:47 +01:00
parent 2d672c9438
commit 3cd4532b3e
3 changed files with 15 additions and 25 deletions

View file

@ -393,9 +393,14 @@ void ThreadedActivity::runScript(char *script_path, NetworkInterface *iface, tim
/* Set the deadline and the threaded activity in the vm so they can be accessed */
l->setThreadedActivityData(this, thstats, deadline);
if(thstats)
if(thstats) {
thstats->setCurrentProgress(0);
/* Reset the internal state for the current execution */
thstats->setNotExecutedAttivity(false);
thstats->setSlowPeriodicActivity(false);
}
gettimeofday(&begin, NULL);
updateThreadedActivityStatsBegin(iface, &begin);
@ -417,13 +422,12 @@ void ThreadedActivity::runScript(char *script_path, NetworkInterface *iface, tim
thstats->setDeadline(time(NULL) + getPeriodicity());
if((max_duration_ms > 0) && (msec_diff > 2*max_duration_ms)) {
thstats->setSlowPeriodicActivity();
} else
thstats->clearErrors();
thstats->setSlowPeriodicActivity(true);
}
}
} else if(deadline) {
if(isDeadlineApproaching(deadline))
thstats->setSlowPeriodicActivity();
thstats->setSlowPeriodicActivity(true);
}
if(l && !reuse_vm)