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

moved timestamps into separate struct member

This commit is contained in:
Steffen Vogel 2015-11-16 11:24:29 +01:00
parent 572ef55952
commit 154a118634
3 changed files with 15 additions and 13 deletions

View file

@ -63,9 +63,11 @@ struct path
struct hist hist_gap_recv; /**< Histogram for inter message arrival time (as seen by this instance) */
struct hist hist_gap_seq; /**< Histogram of sequence number displacement of received messages */
struct timespec ts_recv; /**< Last message received */
struct timespec ts_sent; /**< Last message sent */
struct timespec ts_last; /**< Previous message received (old value of path::ts_recv) */
struct {
struct timespec recv; /**< Last message received */
struct timespec sent; /**< Last message sent */
struct timespec last; /**< Previous message received (old value of path::ts__recv) */
} ts;
unsigned int sent; /**< Counter for sent messages to all outgoing nodes */
unsigned int received; /**< Counter for received messages from all incoming nodes */

View file

@ -30,7 +30,7 @@ REGISTER_HOOK("print", 99, hook_print, HOOK_MSG)
int hook_print(struct path *p, struct hook *h, int when)
{
struct msg *m = p->current;
double offset = time_delta(&MSG_TS(m), &p->ts_recv);
double offset = time_delta(&MSG_TS(m), &p->ts.recv);
int flags = MSG_PRINT_ALL;
/* We dont show the offset if its to large */
@ -47,8 +47,8 @@ int hook_ts(struct path *p, struct hook *h, int when)
{
struct msg *m = p->current;
m->ts.sec = p->ts_recv.tv_sec;
m->ts.nsec = p->ts_recv.tv_nsec;
m->ts.sec = p->ts.recv.tv_sec;
m->ts.nsec = p->ts.recv.tv_nsec;
return 0;
}
@ -262,7 +262,7 @@ int hook_skip_first(struct path *p, struct hook *h, int when)
break;
case HOOK_PATH_RESTART:
private->started = p->ts_recv;
private->started = p->ts.recv;
break;
case HOOK_PATH_START:
@ -270,7 +270,7 @@ int hook_skip_first(struct path *p, struct hook *h, int when)
break;
case HOOK_POST: {
double delta = time_delta(&private->started, &p->ts_recv);
double delta = time_delta(&private->started, &p->ts.recv);
return delta < private->wait
? -1 /* skip */
: 0; /* send */
@ -348,7 +348,7 @@ int hook_stats(struct path *p, struct hook *h, int when)
case HOOK_PRE:
/* Exclude first message from statistics */
if (p->received > 0) {
double gap = time_delta(&p->ts_last, &p->ts_recv);
double gap = time_delta(&p->ts.last, &p->ts.recv);
hist_put(&p->hist_gap_recv, gap);
}
@ -359,7 +359,7 @@ int hook_stats(struct path *p, struct hook *h, int when)
/* Exclude first message from statistics */
if (p->received > 0) {
int dist = cur->sequence - (int32_t) prev->sequence;
double delay = time_delta(&MSG_TS(cur), &p->ts_recv);
double delay = time_delta(&MSG_TS(cur), &p->ts.recv);
double gap = time_delta(&MSG_TS(prev), &MSG_TS(cur));
hist_put(&p->hist_gap_msg, gap);

View file

@ -35,7 +35,7 @@ static void path_write(struct path *p)
debug(15, "Sent %u messages to node '%s'", sent, n->name);
p->sent += sent;
p->ts_sent = time_now(); /** @todo use hardware timestamps for socket node type */
p->ts.sent = time_now(); /** @todo use hardware timestamps for socket node type */
}
}
@ -98,8 +98,8 @@ static void * path_run(void *arg)
continue;
/** @todo Replace this timestamp by hardware timestamping */
p->ts_last = p->ts_recv;
p->ts_recv = time_now();
p->ts.last = p->ts.recv;
p->ts.recv = time_now();
debug(15, "Received %u messages from node '%s'", recv, p->in->name);