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

signal_generator: show total amount of missed steps

This commit is contained in:
Steffen Vogel 2018-04-19 15:42:27 +02:00
parent 6b5cad2ec9
commit cae12694ea
2 changed files with 8 additions and 1 deletions

View file

@ -69,6 +69,7 @@ struct signal_generator {
struct timespec started; /**< Point in time when this node was started. */
int counter; /**< The number of packets already emitted. */
int missed_steps; /**< Total number of missed steps. */
};
/** @see node_type::print */

View file

@ -175,6 +175,7 @@ int signal_generator_start(struct node *n)
int ret;
struct signal_generator *s = (struct signal_generator *) n->_vd;
s->missed_steps = 0;
s->counter = 0;
s->started = time_now();
s->last = alloc(sizeof(double) * s->values);
@ -203,6 +204,9 @@ int signal_generator_stop(struct node *n)
return ret;
}
if (s->missed_steps > 0)
warn("Node %s missed a total of %d steps.", node_name(n), s->missed_steps);
free(s->last);
return 0;
@ -222,8 +226,10 @@ int signal_generator_read(struct node *n, struct sample *smps[], unsigned cnt)
if (s->rt) {
/* Block until 1/p->rate seconds elapsed */
steps = task_wait(&s->task);
if (steps > 1)
if (steps > 1) {
warn("Missed steps: %u", steps-1);
s->missed_steps += steps-1;
}
ts = time_now();
}