mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
added some periodic status messages
git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@129 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
parent
d082441e88
commit
c9de966c57
3 changed files with 37 additions and 10 deletions
|
@ -81,4 +81,10 @@ int path_start(struct path *p);
|
|||
*/
|
||||
int path_stop(struct path *p);
|
||||
|
||||
/** Show some basic statistics for a path
|
||||
*
|
||||
* @param p A pointer to the path struct
|
||||
*/
|
||||
void path_stats(struct path *p);
|
||||
|
||||
#endif /* _PATH_H_ */
|
||||
|
|
|
@ -123,3 +123,11 @@ int path_stop(struct path *p)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void path_stats(struct path *p)
|
||||
{
|
||||
info("%12s " MAG("=>") " %-12s: %-8u %-8u %-8u",
|
||||
p->in->name, p->out->name,
|
||||
p->received, p->delayed,
|
||||
p->duplicated);
|
||||
}
|
||||
|
|
|
@ -75,8 +75,8 @@ static void start()
|
|||
for (struct path *p = paths; p; p = p->next) {
|
||||
path_start(p);
|
||||
|
||||
info("Starting path: %12s " GRN("=>") " %s " GRN("=>") " %-12s",
|
||||
p->in->name, settings.name, p->out->name);
|
||||
info("Starting path: %12s " GRN("=>") " %-12s",
|
||||
p->in->name, p->out->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,13 +85,10 @@ static void stop()
|
|||
/* Join all threads and print statistics */
|
||||
for (struct path *p = paths; p; p = p->next) {
|
||||
path_stop(p);
|
||||
path_stats(p);
|
||||
|
||||
info("Stopping path: %12s " RED("=>") " %s " RED("=>") " %-12s",
|
||||
p->in->name, settings.name, p->out->name);
|
||||
|
||||
info(" %u messages received", p->received);
|
||||
info(" %u messages duplicated", p->duplicated);
|
||||
info(" %u messages delayed", p->delayed);
|
||||
info("Stopping path: %12s " RED("=>") " %-12s",
|
||||
p->in->name, p->out->name);
|
||||
}
|
||||
|
||||
/* Close all sockets we listen on */
|
||||
|
@ -178,8 +175,24 @@ int main(int argc, char *argv[])
|
|||
/* Connect all nodes and start one thread per path */
|
||||
start();
|
||||
|
||||
/* Main thread is sleeping */
|
||||
pause();
|
||||
if (V >= 5) {
|
||||
struct path *p = paths;
|
||||
|
||||
info("");
|
||||
info("Runtime Statistics:");
|
||||
info("%12s " MAG("=>") " %-12s: %-8s %-8s %-8s",
|
||||
"Source", "Destination", "#Recv", "#Delay", "#Duplicated");
|
||||
info("--------------------------------------------------------------");
|
||||
|
||||
while (1) {
|
||||
sleep(5);
|
||||
path_stats(p);
|
||||
|
||||
p = (p->next) ? p->next : paths;
|
||||
}
|
||||
}
|
||||
else
|
||||
pause();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue