]> rtime.felk.cvut.cz Git - can-benchmark.git/blobdiff - latester/latester.c
Generate files without switches and update strips
[can-benchmark.git] / latester / latester.c
index a25fd10cb33978c3c7f6eb32aa2cbdf4f8a9e7e9..6a78872afeb1ebd25e627485d6713cb0594c8296 100644 (file)
@@ -60,8 +60,6 @@ struct options {
        unsigned count;
        unsigned oneattime;
        char *name;
        unsigned count;
        unsigned oneattime;
        char *name;
-       int histogram;
-       int file;
        int length;
        int userhist;
 
        int length;
        int userhist;
 
@@ -509,8 +507,7 @@ void process_final_rx(int s)
        mi->ts_rx_final = ts_user;
        mi->received = frame;
 
        mi->ts_rx_final = ts_user;
        mi->received = frame;
 
-       if (opt.histogram)
-               histogram_add(&histogram, get_msg_latency_us(mi));
+       histogram_add(&histogram, get_msg_latency_us(mi));
 
        ret = write(completion_pipe[1], &mi, sizeof(mi));
        if (ret == -1)
 
        ret = write(completion_pipe[1], &mi, sizeof(mi));
        if (ret == -1)
@@ -634,8 +631,6 @@ struct poptOption optionsTable[] = {
        { "oneattime",'o', POPT_ARG_NONE,                         &opt.oneattime,0,  "Send the next message only when the previous was finally received"},
        { "verbose",'v', POPT_ARG_NONE,                           NULL, 'v',         "Send the next message only when the previous was finally received"},
        { "name",   'n', POPT_ARG_STRING,                         &opt.name, 0,      "Prefix of the generated files"},
        { "oneattime",'o', POPT_ARG_NONE,                         &opt.oneattime,0,  "Send the next message only when the previous was finally received"},
        { "verbose",'v', POPT_ARG_NONE,                           NULL, 'v',         "Send the next message only when the previous was finally received"},
        { "name",   'n', POPT_ARG_STRING,                         &opt.name, 0,      "Prefix of the generated files"},
-       { "file",   'f', POPT_ARG_NONE,                           &opt.file, 0,      "Store all message data in a file", "filename"},
-       { "histogram", 'h', POPT_ARG_NONE,                        &opt.histogram, 0, "Store histogram in file", "filename"},
        { "length", 'l', POPT_ARG_INT|POPT_ARGFLAG_SHOW_DEFAULT,  &opt.length, 0,    "The length of generated messages", "bytes"},
        { "userhist", 'u', POPT_ARG_NONE,                         &opt.userhist, 0,  "Generate histogram from userspace timestamps"},
        POPT_AUTOHELP
        { "length", 'l', POPT_ARG_INT|POPT_ARGFLAG_SHOW_DEFAULT,  &opt.length, 0,    "The length of generated messages", "bytes"},
        { "userhist", 'u', POPT_ARG_NONE,                         &opt.userhist, 0,  "Generate histogram from userspace timestamps"},
        POPT_AUTOHELP
@@ -670,14 +665,14 @@ int parse_options(int argc, const char *argv[])
        if (opt.oneattime && opt.period_us)
                error(1, 0, "oneattime and period cannot be specified at the same time");
 
        if (opt.oneattime && opt.period_us)
                error(1, 0, "oneattime and period cannot be specified at the same time");
 
-       if (opt.name && opt.file) {
+       if (opt.name) {
                char *f = talloc_asprintf(local, "%s-msgs.txt", opt.name);
                opt.f_msgs = fopen(f, "w");
                if (!opt.f_msgs)
                        error(1, errno, "fopen: %s", f);
        }
 
                char *f = talloc_asprintf(local, "%s-msgs.txt", opt.name);
                opt.f_msgs = fopen(f, "w");
                if (!opt.f_msgs)
                        error(1, errno, "fopen: %s", f);
        }
 
-       if (opt.name && opt.histogram) {
+       if (opt.name) {
                char *f = talloc_asprintf(local, "%s-hist.txt", opt.name);
                opt.f_hist = fopen(f, "w");
                if (!opt.f_hist)
                char *f = talloc_asprintf(local, "%s-hist.txt", opt.name);
                opt.f_hist = fopen(f, "w");
                if (!opt.f_hist)
@@ -718,9 +713,7 @@ int main(int argc, const char *argv[])
        for (i=0; i<MAX_INFOS; i++)
                msg_infos[i].id = -1;
 
        for (i=0; i<MAX_INFOS; i++)
                msg_infos[i].id = -1;
 
-       if (opt.histogram) {
-               histogram_init(&histogram, 5000000, 1);
-       }
+       histogram_init(&histogram, 5000000, 1);
 
        ret = pipe(completion_pipe);
        if (ret == -1)
 
        ret = pipe(completion_pipe);
        if (ret == -1)
@@ -749,8 +742,7 @@ int main(int argc, const char *argv[])
                        ret = read(completion_pipe[0], &mi, sizeof(mi));
                        if (ret < sizeof(mi))
                                error(1, errno, "read completion returned %d", ret);
                        ret = read(completion_pipe[0], &mi, sizeof(mi));
                        if (ret < sizeof(mi))
                                error(1, errno, "read completion returned %d", ret);
-                       if (opt.file)
-                               msg_info_print(opt.f_msgs, mi);
+                       msg_info_print(opt.f_msgs, mi);
                        msg_info_free(mi);
                        completed++;
                }
                        msg_info_free(mi);
                        completed++;
                }
@@ -782,12 +774,9 @@ int main(int argc, const char *argv[])
        close(completion_pipe[0]);
        close(completion_pipe[1]);
 
        close(completion_pipe[0]);
        close(completion_pipe[1]);
 
-       if (opt.histogram) {
-               histogram_fprint(&histogram, opt.f_hist);
-               fclose(opt.f_hist);
-       }
-       if (opt.file)
-               fclose(opt.f_msgs);
+       histogram_fprint(&histogram, opt.f_hist);
+       fclose(opt.f_hist);
+       fclose(opt.f_msgs);
 
        
        fprintf(opt.f_stat, "sent=%d\n", count);
 
        
        fprintf(opt.f_stat, "sent=%d\n", count);