From: Michal Sojka Date: Fri, 28 Aug 2009 07:25:18 +0000 (+0200) Subject: Graphs are generated optionally in milliseconds X-Git-Url: https://rtime.felk.cvut.cz/gitweb/canping.git/commitdiff_plain/c6909617dbb0c2b519fb23c1d9c6ec8c95b4484e Graphs are generated optionally in milliseconds This in controlled by CANPING_MS environment variable --- diff --git a/src/vca_canping.c b/src/vca_canping.c index 64ea3c2..b29f465 100644 --- a/src/vca_canping.c +++ b/src/vca_canping.c @@ -170,8 +170,12 @@ void histogram_fprint(struct histogram *h, FILE *f) sum += h->data[i]; cum = sum; for (i = 0; i < h->allocated; i++) { - if (h->data[i] != 0) - fprintf(f, "%d %lld\n", i*h->resolution, cum); + if (h->data[i] != 0) { + if (!getenv("CANPING_MS")) + fprintf(f, "%d %lld\n", i*h->resolution, cum); + else + fprintf(f, "%g %lld\n", 1e-3*(i*h->resolution), cum); + } cum -= h->data[i]; } } @@ -402,8 +406,12 @@ void *master_thread(void *arg) int i; snprintf(buf, sizeof(buf), "%s-%d.dat", option_save_all_times, ping_id); f = fopen(buf, "w"); - for (i=0; itimes[i]); + for (i=0; itimes[i]); + else + fprintf(f, "%g\n", 1e-3*td->times[i]); + } fclose(f); }