mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-16 00:00:02 +01:00
improved output format of helper programs
git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@92 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
parent
5fc9b5adc6
commit
5a9ea722b3
3 changed files with 29 additions and 1 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
@ -64,6 +65,13 @@ int main(int argc, char *argv[])
|
|||
|
||||
while (1) {
|
||||
msg_recv(&m, &n);
|
||||
|
||||
#if 1
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
fprintf(stdout, "%17.6f", ts.tv_sec + ts.tv_nsec / 1e9);
|
||||
#endif
|
||||
|
||||
msg_fprint(stdout, &m);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
@ -74,6 +75,13 @@ int main(int argc, char *argv[])
|
|||
while (!feof(stdin)) {
|
||||
msg_fscan(stdin, &m);
|
||||
msg_send(&m, &n);
|
||||
|
||||
#if 1
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
fprintf(stdout, "%17.6f", ts.tv_sec + ts.tv_nsec / 1e9);
|
||||
#endif
|
||||
|
||||
msg_fprint(stdout, &m);
|
||||
}
|
||||
|
||||
|
|
14
src/test.c
14
src/test.c
|
@ -74,6 +74,12 @@ int main(int argc, char *argv[])
|
|||
double rtt, rtt_max = LLONG_MIN, rtt_min = LLONG_MAX, avg = 0;
|
||||
int run = 0;
|
||||
|
||||
|
||||
#if 1 /* Print header */
|
||||
fprintf(stdout, "%17s", "timestamp");
|
||||
#endif
|
||||
fprintf(stdout, "%10s%10s%10s%10s\n", "rtt", "min", "max", "avg");
|
||||
|
||||
while (1) {
|
||||
clock_gettime(CLOCK_REALTIME, ts1);
|
||||
msg_send(&m, &n);
|
||||
|
@ -89,7 +95,13 @@ int main(int argc, char *argv[])
|
|||
avg += rtt;
|
||||
run++;
|
||||
|
||||
info("rtt %.3f min %.3f max %.3f avg %.3f", 1e3 * rtt, 1e3 * rtt_min, 1e3 * rtt_max, 1e3 * avg / run);
|
||||
#if 1
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
fprintf(stdout, "%17.6f", ts.tv_sec + ts.tv_nsec / 1e9);
|
||||
#endif
|
||||
|
||||
fprintf(stdout, "%10.3f%10.3f%10.3f%10.3f\n", 1e3 * rtt, 1e3 * rtt_min, 1e3 * rtt_max, 1e3 * avg / run);
|
||||
|
||||
m.sequence++;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue