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

fixed fixed rate feature and removed inaccurate statistics

git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@222 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
Steffen Vogel 2014-09-09 09:03:06 +00:00
parent a325c83f4f
commit ec7457861a
3 changed files with 37 additions and 43 deletions

View file

@ -39,18 +39,16 @@ struct path
/** Last known message number */
unsigned int sequence;
/** Counter for sent messages */
unsigned long sent;
/** Counter for received messages */
unsigned long received;
/** Counter for messages which arrived reordered */
unsigned long delayed;
/** Counter for messages which arrived multiple times */
unsigned long duplicated;
/** Counter for received messages with invalid version or type */
unsigned long invalid;
/** Counter for skipped or filtered messages by hook */
unsigned long skipped;
/** Counter for sent messages to all outgoing nodes*/
unsigned int sent;
/** Counter for received messages from all incoming nodes */
unsigned int received;
/** Counter for invalid messages */
unsigned int invalid;
/** Counter for skipped messages due to hooks */
unsigned int skipped;
/** Counter for dropped messages due to reordering */
unsigned int dropped;
/** The thread id for this path */
pthread_t recv_tid;

View file

@ -64,6 +64,7 @@ static void * path_send(void *arg)
/** Receive messages */
static void * path_run(void *arg)
{
int lag;
struct path *p = (struct path *) arg;
struct msg *m = malloc(sizeof(struct msg));
@ -73,37 +74,21 @@ static void * path_run(void *arg)
/* Main thread loop */
while (1) {
msg_recv(m, p->in); /* Receive message */
lag = m->sequence - p->sequence;
p->received++;
/** Check header fields */
if (m->version != MSG_VERSION) {
p->invalid++;
continue;
}
else if (m->type != MSG_TYPE_DATA) {
if (m->version != MSG_VERSION ||
m->type != MSG_TYPE_DATA) {
p->invalid++;
continue;
}
/* Check sequence number */
if (m->sequence == 0) {
path_stats(p);
info("Simulation started");
p->sequence = 0;
p->received = 1;
p->sent = 0;
p->skipped = 0;
p->delayed = 0;
p->duplicated = 0;
p->invalid = 0;
}
else if (m->sequence < p->sequence) {
p->delayed++;
continue;
}
else if (m->sequence == p->sequence) {
p->duplicated++;
/* Sequence no. is lower than expected */
if (lag <= 0) {
p->dropped++;
continue;
}
@ -112,15 +97,27 @@ static void * path_run(void *arg)
continue;
}
/* Check sequence number */
if (m->sequence == 0) {
path_stats(p);
info("Simulation started");
p->sent = 0;
p->received = 0;
p->invalid = 0;
p->skipped = 0;
p->dropped = 0;
}
/* Update last known sequence number */
p->sequence = m->sequence;
p->last = m;
/* At fixed rate mode, messages are send by another thread */
// if (p->rate)
// p->last = m;
// else {
if (!p->rate) {
msg_send(m, p->out);
p->sent++;
// }
}
}
free(m);
@ -154,7 +151,6 @@ void path_stats(struct path *p)
{
info("%12s " MAG("=>") " %-12s: %-8u %-8u %-8u %-8u %-8u",
p->in->name, p->out->name,
p->sent, p->received, p->delayed,
p->duplicated, p->invalid
p->sent, p->received, p->dropped, p->skipped, p->invalid
);
}

View file

@ -199,7 +199,7 @@ int main(int argc, char *argv[])
info("Runtime Statistics:");
info("%12s " MAG("=>") " %-12s: %-8s %-8s %-8s %-8s %-8s",
"Source", "Destination", "#Sent", "#Recv", "#Delay", "#Dupl", "#Inval");
"Source", "Destination", "#Sent", "#Recv", "#Drop", "#Skip", "#Inval");
info("---------------------------------------------------------------------------");
while (1) {