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

added histogram for sequence number offsets (lost, duplicated and reordered packages)

git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@223 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
Steffen Vogel 2014-09-09 09:03:11 +00:00
parent ec7457861a
commit e90662d5f6
5 changed files with 35 additions and 0 deletions

View file

@ -20,4 +20,7 @@
/** Socket priority */
#define SOCKET_PRIO 7
/* Some parameters for histogram statistics */
#define HIST_SEQ 33
#endif /* _CONFIG_H_ */

View file

@ -49,6 +49,8 @@ struct path
unsigned int skipped;
/** Counter for dropped messages due to reordering */
unsigned int dropped;
/** Counter for received messages according to their sequence no displacement */
unsigned int histogram[HIST_SEQ];
/** The thread id for this path */
pthread_t recv_tid;

View file

@ -70,6 +70,9 @@ double timespec_delta(struct timespec *start, struct timespec *end);
/** Get period as timespec from rate */
struct timespec timespec_rate(double rate);
/** Dump histogram data in Matlab format */
void hist_dump(unsigned *hist, int length);
/** Append an element to a single linked list */
#define list_add(list, elm) do { \
elm->next = list; \

View file

@ -79,6 +79,13 @@ static void * path_run(void *arg)
p->received++;
if (HIST_SEQ/2 + lag >= HIST_SEQ)
p->histogram[HIST_SEQ-1]++;
else if (HIST_SEQ/2 + lag < 0)
p->histogram[0]++;
else
p->histogram[HIST_SEQ/2 + lag]++;
/** Check header fields */
if (m->version != MSG_VERSION ||
m->type != MSG_TYPE_DATA) {
@ -144,6 +151,11 @@ int path_stop(struct path *p)
pthread_join(p->sent_tid, NULL);
}
if (p->received) {
path_stats(p);
hist_dump(p->histogram, HIST_SEQ);
}
return 0;
}

View file

@ -121,3 +121,18 @@ struct timespec timespec_rate(double rate)
return ts;
}
void hist_dump(unsigned *hist, int length)
{
char tok[16];
char buf[length * sizeof(tok)];
memset(buf, 0, sizeof(buf));
/* Print in Matlab vector format */
for (int i = 0; i < length; i++) {
snprintf(tok, sizeof(tok), "%u ", hist[i]);
strncat(buf, tok, sizeof(buf)-strlen(buf));
}
info("hist = [ %s]", buf);
}