]> rtime.felk.cvut.cz Git - can-benchmark.git/commitdiff
latester: Log command line and duration
authorMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 10 Dec 2010 14:59:30 +0000 (15:59 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Fri, 10 Dec 2010 14:59:30 +0000 (15:59 +0100)
latester/latester.c

index fb299aa2c754b41313f171606c189de1e4a78354..24015f1a0097925e760ed848949f8baf87cdb799 100644 (file)
@@ -81,6 +81,7 @@ struct {
        unsigned enobufs;
        unsigned overrun;
        unsigned lost;
+       struct timespec tic, tac;
 } stats;
 
 int num_interfaces = 0;
@@ -582,6 +583,8 @@ void *measure_thread(void *arg)
        if (opt.oneattime)
                SEND();
 
+       get_tstamp(&stats.tic);
+
        while (!finish_flag &&
               (opt.count == 0 || count < opt.count || msg_in_progress != 0)) {
 
@@ -631,6 +634,8 @@ void *measure_thread(void *arg)
                }
        }
 
+       get_tstamp(&stats.tac);
+
        for (i=0; i<num_interfaces; i++)
                close(pfd[i].fd);
 
@@ -800,6 +805,14 @@ int main(int argc, const char *argv[])
        fclose(opt.f_hist);
        fclose(opt.f_msgs);
 
+
+       fprintf(opt.f_stat, "cmdline='");
+       for (i=0; i<argc; i++)
+               fprintf(opt.f_stat, "%s%s", argv[i], i < argc-1 ? " " : "");
+       fprintf(opt.f_stat, "'\n");
+
+       timespec_subtract(&diff, &stats.tac, &stats.tic);
+       fprintf(opt.f_stat, "duration=%s # seconds\n", tstamp_str(NULL, &diff));
        
        fprintf(opt.f_stat, "sent=%d\n", count);
        fprintf(opt.f_stat, "overrun=%d\n", stats.overrun);