[ewg] [PATCH] Perftest: Add flag not to fail test even when cpufreq_ondemand module is set

orenmeron orenmeron at dev.mellanox.co.il
Tue Nov 11 11:02:10 PST 2008


commit 92718b997b1127a3afab386885ce6b07d869dc1b
Author: Oren Meron <orenmeron at mtlsws18.lab.mtl.com>
Date:   Tue Nov 11 19:58:39 2008 +0200

    Add flag not to fail test even when cpufreq_ondemand module is set

    Signed-off-by: Oren Meron <orenmeron at dev.mellanox.co.il>


diff --git a/clock_test.c b/clock_test.c
index 3effb46..b585d74 100755 (executable)

--- a/clock_test.c
+++ b/clock_test.c
@@ -4,8 +4,9 @@
 
 int main()
 {
+       int no_cpu_freq_fail = 0;
        double mhz;
-       mhz = get_cpu_mhz();
+       mhz = get_cpu_mhz(no_cpu_freq_fail);
        cycles_t c1, c2;
 
        if (!mhz) {
diff --git a/get_clock.c b/get_clock.c
index eceb515..0acb074 100755 (executable)

--- a/get_clock.c
+++ b/get_clock.c
@@ -132,7 +132,7 @@ static double sample_get_cpu_mhz(void)
        return b;
 }
 
-static double proc_get_cpu_mhz(void)
+static double proc_get_cpu_mhz(int no_cpu_freq_fail)
 {
        FILE* f;
        char buf[256];
@@ -157,7 +157,12 @@ static double proc_get_cpu_mhz(void)
                if (mhz != m) {
                        fprintf(stderr, "Conflicting CPU frequency values"
                                " detected: %lf != %lf\n", mhz, m);
-                       return 0.0;
+                       if (no_cpu_freq_fail) {
+                               fprintf(stderr, "Test integrity may be harmed !\n");
+                       }else{
+                               return 0.0;
+                       }
+                       continue;
                }
        }
        fclose(f);
@@ -165,11 +170,11 @@ static double proc_get_cpu_mhz(void)
 }
 
 
-double get_cpu_mhz(void)
+double get_cpu_mhz(int no_cpu_freq_fail)
 {
        double sample, proc, delta;
        sample = sample_get_cpu_mhz();
-       proc = proc_get_cpu_mhz();
+       proc = proc_get_cpu_mhz(no_cpu_freq_fail);
 
        if (!proc || !sample)
                return 0;
diff --git a/get_clock.h b/get_clock.h
index 4dd912e..8985568 100755 (executable)

--- a/get_clock.h
+++ b/get_clock.h
@@ -76,6 +76,6 @@ static inline cycles_t get_cycles()
 #include <asm/timex.h>
 #endif
 
-extern double get_cpu_mhz(void);
+extern double get_cpu_mhz(int);
 
 #endif
diff --git a/rdma_bw.c b/rdma_bw.c
index d27a87f..0a6c6ac 100755 (executable)

--- a/rdma_bw.c
+++ b/rdma_bw.c
@@ -886,7 +886,7 @@ static void print_report(unsigned int iters, unsigned size, int duplex,
                        }
                }
 
-       cycles_to_units = get_cpu_mhz() * 1000000;
+       cycles_to_units = get_cpu_mhz(0) * 1000000;
 
        tsize = duplex ? 2 : 1;
        tsize = tsize * size;
diff --git a/rdma_lat.c b/rdma_lat.c
index 6ade2b7..09a5f78 100755 (executable)

--- a/rdma_lat.c
+++ b/rdma_lat.c
@@ -974,7 +974,7 @@ static void print_report(struct report_options * options,
                cycles_to_units = 1;
                units = "cycles";
        } else {
-               cycles_to_units = get_cpu_mhz();
+               cycles_to_units = get_cpu_mhz(0);
                units = "usec";
        }
 
diff --git a/read_bw.c b/read_bw.c
index 1501977..c470e59 100755 (executable)

--- a/read_bw.c
+++ b/read_bw.c
@@ -472,10 +472,11 @@ static void usage(const char *argv0)
        printf("  -b, --bidirectional    measure bidirectional bandwidth (default unidirectional)\n");
        printf("  -V, --version          display version number\n");
        printf("  -e, --events           sleep on CQ events (default poll)\n");
+       printf("  -F, --CPU-freq         do not fail even if cpufreq_ondemand module is loaded\n");
 }
 
 static void print_report(unsigned int iters, unsigned size, int duplex,
-                        cycles_t *tposted, cycles_t *tcompleted)
+                        cycles_t *tposted, cycles_t *tcompleted, int no_cpu_freq_fail)
 {
        double cycles_to_units;
        unsigned long tsize;    /* Transferred size, in megabytes */
@@ -498,7 +499,7 @@ static void print_report(unsigned int iters, unsigned size, int duplex,
                        }
                }
 
-       cycles_to_units = get_cpu_mhz() * 1000000;
+       cycles_to_units = get_cpu_mhz(no_cpu_freq_fail) * 1000000;
 
        tsize = duplex ? 2 : 1;
        tsize = tsize * size;
@@ -602,6 +603,7 @@ int main(int argc, char *argv[])
        int                      sockfd;
        int                      duplex = 0;
        int                      i = 0;
+       int                      no_cpu_freq_fail = 0;
 
        /* init default values to user's parameters */
        memset(&user_param, 0, sizeof(struct user_parameters));
@@ -628,10 +630,11 @@ int main(int argc, char *argv[])
                        { .name = "bidirectional",  .has_arg = 0, .val = 'b' },
                        { .name = "version",        .has_arg = 0, .val = 'V' },
                        { .name = "events",         .has_arg = 0, .val = 'e' },
+                       { .name = "CPU-freq",       .has_arg = 0, .val = 'F' },
                        { 0 }
                };
 
-               c = getopt_long(argc, argv, "p:d:i:m:o:s:n:t:abVe", long_options, NULL);
+               c = getopt_long(argc, argv, "p:d:i:m:o:s:n:t:abVeF", long_options, NULL);
                if (c == -1)
                        break;
 
@@ -697,6 +700,10 @@ int main(int argc, char *argv[])
                        duplex = 1;
                        break;
 
+               case 'F':
+                       no_cpu_freq_fail = 1;
+                       break;
+
                default:
                        usage(argv[0]);
                        return 1;
@@ -803,7 +810,7 @@ int main(int argc, char *argv[])
 
        if (!user_param.servername && !duplex) {
                rem_dest = pp_server_exch_dest(sockfd, &my_dest);
-               if (write(sockfd, "done", sizeof "done") != sizeof "done"){////
+               if (write(sockfd, "done", sizeof "done") != sizeof "done"){
                        perror("server write");
                        fprintf(stderr, "Couldn't write to socket\n");
                        return 1;
@@ -840,12 +847,12 @@ int main(int argc, char *argv[])
                        size = 1 << i;
                        if(run_iter(ctx, &user_param, rem_dest, size))
                                return 17;
-                       print_report(user_param.iters, size, duplex, tposted, tcompleted);
+                       print_report(user_param.iters, size, duplex, tposted, tcompleted, no_cpu_freq_fail);
                }
        } else {
                if(run_iter(ctx, &user_param, rem_dest, size))
                        return 18;
-               print_report(user_param.iters, size, duplex, tposted, tcompleted);
+               print_report(user_param.iters, size, duplex, tposted, tcompleted, no_cpu_freq_fail);
        }
 
        if (user_param.servername)
diff --git a/read_lat.c b/read_lat.c
index 8119f57..fb78f79 100755 (executable)

--- a/read_lat.c
+++ b/read_lat.c
@@ -567,6 +567,7 @@ static void usage(const char *argv0)
        printf("  -U, --report-unsorted        (implies -H) print out unsorted results (default sorted)\n");
        printf("  -V, --version                display version number\n");
        printf("  -e, --events                 sleep on CQ events (default poll)\n");
+       printf("  -F, --CPU-freq         do not fail test on different cpu frequencies\n");
 }
 
 /*
@@ -595,7 +596,7 @@ static int cycles_compare(const void * aptr, const void * bptr)
 }
 
 static void print_report(struct report_options * options,
-                        unsigned int iters, cycles_t *tstamp,int size)
+                        unsigned int iters, cycles_t *tstamp,int size, int no_cpu_freq_fail)
 {
        double cycles_to_units;
        cycles_t median;
@@ -616,7 +617,7 @@ static void print_report(struct report_options * options,
                cycles_to_units = 1;
                units = "cycles";
        } else {
-               cycles_to_units = get_cpu_mhz();
+               cycles_to_units = get_cpu_mhz(no_cpu_freq_fail);
                units = "usec";
        }
 
@@ -738,6 +739,7 @@ int main(int argc, char *argv[])
        struct pingpong_dest     rem_dest;
        struct ibv_device       *ib_dev;
        struct user_parameters  user_param;
+       int                      no_cpu_freq_fail = 0;
 
        /* init default values to user's parameters */
        memset(&user_param, 0, sizeof(struct user_parameters));
@@ -767,10 +769,11 @@ int main(int argc, char *argv[])
                        { .name = "report-unsorted",.has_arg = 0, .val = 'U' },
                        { .name = "version",        .has_arg = 0, .val = 'V' },
                        { .name = "events",         .has_arg = 0, .val = 'e' },
+                       { .name = "CPU-freq",       .has_arg = 0, .val = 'F' },
                        { 0 }
                };
 
-               c = getopt_long(argc, argv, "p:c:m:d:i:s:o:n:t:aeHUV", long_options, NULL);
+               c = getopt_long(argc, argv, "p:c:m:d:i:s:o:n:t:aeHUVF", long_options, NULL);
                if (c == -1)
                        break;
 
@@ -851,6 +854,10 @@ int main(int argc, char *argv[])
                        report.unsorted = 1;
                        break;
 
+               case 'F':
+                       no_cpu_freq_fail = 1;
+                       break;
+
                default:
                        usage(argv[0]);
                        return 5;
@@ -919,14 +926,14 @@ int main(int argc, char *argv[])
                        if(run_iter(ctx, &user_param, &rem_dest, size))
                                return 17;
                        if(user_param.servername) {
-                               print_report(&report, user_param.iters, tstamp, size);
+                               print_report(&report, user_param.iters, tstamp, size, no_cpu_freq_fail);
                        }
                }
        } else {
                if(run_iter(ctx, &user_param, &rem_dest, size))
                        return 18;
                if(user_param.servername) {
-                       print_report(&report, user_param.iters, tstamp, size);
+                       print_report(&report, user_param.iters, tstamp, size, no_cpu_freq_fail);
                }
        }
 
diff --git a/send_bw.c b/send_bw.c
index 1fcd09e..b148037 100755 (executable)

--- a/send_bw.c
+++ b/send_bw.c
@@ -629,11 +629,12 @@ static void usage(const char *argv0)
        printf("  -b, --bidirectional         measure bidirectional bandwidth (default unidirectional)\n");
        printf("  -V, --version               display version number\n");
        printf("  -e, --events                sleep on CQ events (default poll)\n");
-       printf("  -N, --no peak-bw          cancel peak-bw calculation (default with peak-bw)\n");
+       printf("  -N, --no peak-bw            cancel peak-bw calculation (default with peak-bw)\n");
+       printf("  -F, --CPU-freq              do not fail even if cpufreq_ondemand module is loaded\n");
 }
 
 static void print_report(unsigned int iters, unsigned size, int duplex,
-                        cycles_t *tposted, cycles_t *tcompleted, int noPeak)
+                        cycles_t *tposted, cycles_t *tcompleted, int noPeak, int no_cpu_freq_fail)
 {
        double cycles_to_units;
        unsigned long tsize;    /* Transferred size, in megabytes */
@@ -658,7 +659,7 @@ static void print_report(unsigned int iters, unsigned size, int duplex,
                        }
        }
 
-       cycles_to_units = get_cpu_mhz() * 1000000;
+       cycles_to_units = get_cpu_mhz(no_cpu_freq_fail) * 1000000;
 
        tsize = duplex ? 2 : 1;
        tsize = tsize * size;
@@ -939,6 +940,7 @@ int main(int argc, char *argv[])
        int                      noPeak = 0;/*noPeak == 0: regular peak-bw calculation done*/
        int                      inline_given_in_cmd = 0;
        struct ibv_context       *context;
+       int                      no_cpu_freq_fail = 0;
        /* init default values to user's parameters */
        memset(&user_param, 0, sizeof(struct user_parameters));
        user_param.mtu = 0;
@@ -969,10 +971,11 @@ int main(int argc, char *argv[])
                        { .name = "events",         .has_arg = 0, .val = 'e' },
                        { .name = "mcg",            .has_arg = 0, .val = 'g' },
                        { .name = "noPeak",         .has_arg = 0, .val = 'N' },
+                       { .name = "CPU-freq",       .has_arg = 0, .val = 'F' },
                        { 0 }
                };
 
-               c = getopt_long(argc, argv, "p:d:i:m:c:s:n:t:I:r:ebaVgN", long_options, NULL);
+               c = getopt_long(argc, argv, "p:d:i:m:c:s:n:t:I:r:ebaVgNF", long_options, NULL);
                if (c == -1)
                        break;
 
@@ -1062,6 +1065,10 @@ int main(int argc, char *argv[])
                        noPeak = 1;
                        break;
 
+               case 'F':
+                       no_cpu_freq_fail = 1;
+                       break;
+
                default:
                        usage(argv[0]);
                        return 1;
@@ -1251,7 +1258,7 @@ int main(int argc, char *argv[])
                                        return 17;
                        }
                        if (user_param.servername) {
-                               print_report(user_param.iters, size, user_param.duplex, tposted, tcompleted, noPeak);
+                               print_report(user_param.iters, size, user_param.duplex, tposted, tcompleted, noPeak, no_cpu_freq_fail);
                                /* sync again for the sake of UC/UC */
                                rem_dest = pp_client_exch_dest(sockfd, &my_dest);
                        } else
@@ -1268,7 +1275,7 @@ int main(int argc, char *argv[])
                }
 
                if (user_param.servername)
-                       print_report(user_param.iters, size, user_param.duplex, tposted, tcompleted, noPeak);
+                       print_report(user_param.iters, size, user_param.duplex, tposted, tcompleted, noPeak, no_cpu_freq_fail);
        }
 
        /* close sockets */
diff --git a/send_lat.c b/send_lat.c
index b2796d6..1f21652 100755 (executable)

--- a/send_lat.c
+++ b/send_lat.c
@@ -715,6 +715,7 @@ static void usage(const char *argv0)
        printf("  -V, --version                display version number\n");
        printf("  -e, --events                 sleep on CQ events (default poll)\n");
        printf("  -g, --mcg                    send messages to multicast group(only available in UD connection\n");
+       printf("  -F, --CPU-freq               do not fail even if cpufreq_ondemand module is loaded\n");
 }
 
 /*
@@ -743,7 +744,7 @@ static int cycles_compare(const void * aptr, const void * bptr)
 }
 
 static void print_report(struct report_options * options,
-                        unsigned int iters, cycles_t *tstamp,int size)
+                        unsigned int iters, cycles_t *tstamp,int size, int no_cpu_freq_fail)
 {
        double cycles_to_units;
        cycles_t median;
@@ -764,7 +765,7 @@ static void print_report(struct report_options * options,
                cycles_to_units = 1;
                units = "cycles";
        } else {
-               cycles_to_units = get_cpu_mhz();
+               cycles_to_units = get_cpu_mhz(no_cpu_freq_fail);
                units = "usec";
        }
 
@@ -991,7 +992,8 @@ int main(int argc, char *argv[])
        struct pingpong_context *ctx;
        struct pingpong_dest     rem_dest;
        struct ibv_device       *ib_dev;
-       struct user_parameters  user_param;
+       struct user_parameters   user_param;
+       int                      no_cpu_freq_fail = 0;
 
        /* init default values to user's parameters */
        memset(&user_param, 0, sizeof(struct user_parameters));
@@ -1025,9 +1027,10 @@ int main(int argc, char *argv[])
                        { .name = "version",        .has_arg = 0, .val = 'V' },
                        { .name = "events",         .has_arg = 0, .val = 'e' },
                        { .name = "mcg",            .has_arg = 0, .val = 'g' },
+                       { .name = "CPU-freq",       .has_arg = 0, .val = 'F' },
                        { 0 }
                };
-               c = getopt_long(argc, argv, "p:c:m:d:i:s:n:t:I:laeCHUVg", long_options, NULL);
+               c = getopt_long(argc, argv, "p:c:m:d:i:s:n:t:I:laeCHUVgF", long_options, NULL);
                if (c == -1)
                        break;
 
@@ -1120,6 +1123,10 @@ int main(int argc, char *argv[])
                        report.unsorted = 1;
                        break;
 
+               case 'F':
+                       no_cpu_freq_fail = 1;
+                       break;
+
                default:
                        usage(argv[0]);
                        return 5;
@@ -1197,12 +1204,12 @@ int main(int argc, char *argv[])
                        if(run_iter(ctx, &user_param, &rem_dest, size))
                                return 17;
 
-                       print_report(&report, user_param.iters, tstamp, size);
+                       print_report(&report, user_param.iters, tstamp, size, no_cpu_freq_fail);
                }
        } else {
                if(run_iter(ctx, &user_param, &rem_dest, size))
                        return 18;      
-               print_report(&report, user_param.iters, tstamp, size);
+               print_report(&report, user_param.iters, tstamp, size, no_cpu_freq_fail);
        }
        printf("------------------------------------------------------------------\n");
        free(tstamp);
diff --git a/write_bw.c b/write_bw.c
index 96b04e8..cad6dee 100755 (executable)

--- a/write_bw.c
+++ b/write_bw.c
@@ -522,11 +522,12 @@ static void usage(const char *argv0)
        printf("  -b, --bidirectional       measure bidirectional bandwidth (default unidirectional)\n");
        printf("  -V, --version             display version number\n");
        printf("  -N, --no peak-bw          cancel peak-bw calculation (default with peak-bw)\n");
+       printf("  -F, --CPU-freq            do not fail even if cpufreq_ondemand module is loaded\n");
 }
 
 static void print_report(unsigned int iters, unsigned size, int duplex,
                         cycles_t *tposted, cycles_t *tcompleted, struct user_parameters *user_param,
-                        int noPeak)
+                        int noPeak, int no_cpu_freq_fail)
 {
        double cycles_to_units;
        unsigned long tsize;    /* Transferred size, in megabytes */
@@ -551,7 +552,7 @@ static void print_report(unsigned int iters, unsigned size, int duplex,
                  }
        }
        
-       cycles_to_units = get_cpu_mhz() * 1000000;
+       cycles_to_units = get_cpu_mhz(no_cpu_freq_fail) * 1000000;
 
        tsize = duplex ? 2 : 1;
        tsize = tsize * size;
@@ -680,6 +681,7 @@ int main(int argc, char *argv[])
        int                      noPeak = 0;/*noPeak == 0: regular peak-bw calculation done*/
        int                      inline_given_in_cmd = 0;
        struct ibv_context       *context;
+       int                      no_cpu_freq_fail = 0;
 
        /* init default values to user's parameters */
        memset(&user_param, 0, sizeof(struct user_parameters));
@@ -710,10 +712,11 @@ int main(int argc, char *argv[])
                        { .name = "bidirectional",  .has_arg = 0, .val = 'b' },
                        { .name = "version",        .has_arg = 0, .val = 'V' },
                        { .name = "noPeak",         .has_arg = 0, .val = 'N' },
+                       { .name = "CPU-freq",       .has_arg = 0, .val = 'F' },
                        { 0 }
                };
 
-               c = getopt_long(argc, argv, "p:d:i:m:q:g:c:s:n:t:I:baVN", long_options, NULL);
+               c = getopt_long(argc, argv, "p:d:i:m:q:g:c:s:n:t:I:baVNF", long_options, NULL);
                if (c == -1)
                        break;
 
@@ -797,6 +800,10 @@ int main(int argc, char *argv[])
                        noPeak = 1;
                        break;
 
+               case 'F':
+                       no_cpu_freq_fail = 1;
+                       break;
+
                default:
                        usage(argv[0]);
                        return 1;
@@ -974,12 +981,12 @@ int main(int argc, char *argv[])
                        size = 1 << i;
                        if(run_iter(ctx, &user_param, rem_dest, size))
                                return 17;
-                       print_report(user_param.iters, size, duplex, tposted, tcompleted, &user_param, noPeak);
+                       print_report(user_param.iters, size, duplex, tposted, tcompleted, &user_param, noPeak, no_cpu_freq_fail);
                }
        } else {
                if(run_iter(ctx, &user_param, rem_dest, size))
                        return 18;
-               print_report(user_param.iters, size, duplex, tposted, tcompleted, &user_param, noPeak);
+               print_report(user_param.iters, size, duplex, tposted, tcompleted, &user_param, noPeak, no_cpu_freq_fail);
        }
        /* the 0th place is arbitrary to signal finish ... */
        if (user_param.servername) {
diff --git a/write_bw_postlist.c b/write_bw_postlist.c
index aa8b4c3..285e5ab 100755 (executable)

--- a/write_bw_postlist.c
+++ b/write_bw_postlist.c
@@ -521,10 +521,11 @@ static void usage(const char *argv0)
        printf("  -I, --inline_size=<size>  max size of message to be sent in inline mode (default 400)\n");
        printf("  -b, --bidirectional       measure bidirectional bandwidth (default unidirectional)\n");
        printf("  -V, --version             display version number\n");
+       printf("  -F, --CPU-freq            do not fail even if cpufreq_ondemand module is loaded\n");
 }
 
 static void print_report(unsigned int iters, unsigned size, int duplex,
-                        cycles_t *tposted, cycles_t *tcompleted, struct user_parameters *user_param)
+                        cycles_t *tposted, cycles_t *tcompleted, struct user_parameters *user_param, int no_cpu_freq_fail)
 {
        double cycles_to_units;
        unsigned long tsize;    /* Transferred size, in megabytes */
@@ -547,7 +548,7 @@ static void print_report(unsigned int iters, unsigned size, int duplex,
             }
        }
 
-       cycles_to_units = get_cpu_mhz() * 1000000;
+       cycles_to_units = get_cpu_mhz(no_cpu_freq_fail) * 1000000;
 
        tsize = duplex ? 2 : 1;
        tsize = tsize * size;
@@ -678,6 +679,7 @@ int main(int argc, char *argv[])
        int                      i = 0;
        int                      inline_given_in_cmd = 0;
        struct ibv_context       *context;
+       int                      no_cpu_freq_fail = 0;
 
        /* init default values to user's parameters */
        memset(&user_param, 0, sizeof(struct user_parameters));
@@ -707,10 +709,11 @@ int main(int argc, char *argv[])
                        { .name = "all",            .has_arg = 0, .val = 'a' },
                        { .name = "bidirectional",  .has_arg = 0, .val = 'b' },
                        { .name = "version",        .has_arg = 0, .val = 'V' },
+                       { .name = "CPU-freq",       .has_arg = 0, .val = 'F' },
                        { 0 }
                };
 
-               c = getopt_long(argc, argv, "p:d:i:m:q:g:c:s:n:t:I:baV", long_options, NULL);
+               c = getopt_long(argc, argv, "p:d:i:m:q:g:c:s:n:t:I:baVF", long_options, NULL);
                if (c == -1)
                        break;
 
@@ -791,6 +794,10 @@ int main(int argc, char *argv[])
                        duplex = 1;
                        break;
 
+               case 'F':
+                       no_cpu_freq_fail = 1;
+                       break;
+
                default:
                        usage(argv[0]);
                        return 1;
@@ -957,12 +964,12 @@ int main(int argc, char *argv[])
                        size = 1 << i;
                        if(run_iter(ctx, &user_param, rem_dest, size))
                                return 17;
-                       print_report(user_param.iters, size, duplex, tposted, tcompleted, &user_param);
+                       print_report(user_param.iters, size, duplex, tposted, tcompleted, &user_param, no_cpu_freq_fail);
                        }
        } else {
                if(run_iter(ctx, &user_param, rem_dest, size))
                        return 18;
-               print_report(user_param.iters, size, duplex, tposted, tcompleted, &user_param);
+               print_report(user_param.iters, size, duplex, tposted, tcompleted, &user_param, no_cpu_freq_fail);
        }
        /* the 0th place is arbitrary to signal finish ... */
        if (user_param.servername) {
diff --git a/write_lat.c b/write_lat.c
index e71ce31..6e1dcf9 100755 (executable)

--- a/write_lat.c
+++ b/write_lat.c
@@ -581,6 +581,7 @@ static void usage(const char *argv0)
        printf("  -H, --report-histogram       print out all results (default print summary only)\n");
        printf("  -U, --report-unsorted        (implies -H) print out unsorted results (default sorted)\n");
        printf("  -V, --version                display version number\n");
+       printf("  -F, --CPU-freq               do not fail even if cpufreq_ondemand module is loaded\n");
 }
 
 /*
@@ -609,7 +610,7 @@ static int cycles_compare(const void * aptr, const void * bptr)
 }
 
 static void print_report(struct report_options * options,
-                        unsigned int iters, cycles_t *tstamp, int size)
+                        unsigned int iters, cycles_t *tstamp, int size, int no_cpu_freq_fail)
 {
        double cycles_to_units;
        cycles_t median;
@@ -630,7 +631,7 @@ static void print_report(struct report_options * options,
                cycles_to_units = 1;
                units = "cycles";
        } else {
-               cycles_to_units = get_cpu_mhz();
+               cycles_to_units = get_cpu_mhz(no_cpu_freq_fail);
                units = "usec";
        }
 
@@ -760,7 +761,8 @@ int main(int argc, char *argv[])
        struct pingpong_dest     rem_dest;
        struct ibv_device       *ib_dev;
 
-       struct user_parameters  user_param;
+       struct user_parameters   user_param;
+       int                      no_cpu_freq_fail = 0;
 
        /* init default values to user's parameters */
        memset(&user_param, 0, sizeof(struct user_parameters));
@@ -788,10 +790,11 @@ int main(int argc, char *argv[])
                        { .name = "report-histogram",.has_arg = 0, .val = 'H' },
                        { .name = "report-unsorted",.has_arg = 0, .val = 'U' },
                        { .name = "version",        .has_arg = 0, .val = 'V' },
+                       { .name = "CPU-freq",       .has_arg = 0, .val = 'F' },
                        { 0 }
                };
 
-               c = getopt_long(argc, argv, "p:c:m:d:i:s:n:t:I:aCHUV", long_options, NULL);
+               c = getopt_long(argc, argv, "p:c:m:d:i:s:n:t:I:aCHUVF", long_options, NULL);///cpufreq
                if (c == -1)
                        break;
 
@@ -873,6 +876,10 @@ int main(int argc, char *argv[])
                        report.unsorted = 1;
                        break;
 
+               case 'F':
+                       no_cpu_freq_fail = 1;
+                       break;
+
                default:
                        usage(argv[0]);
                        return 5;
@@ -928,12 +935,12 @@ int main(int argc, char *argv[])
                        size = 1 << i;
                        if(run_iter(ctx, &user_param, &rem_dest, size))
                                return 17;
-                       print_report(&report, user_param.iters, tstamp, size);
+                       print_report(&report, user_param.iters, tstamp, size, no_cpu_freq_fail);
                }
        } else {
                if(run_iter(ctx, &user_param, &rem_dest, size))
                        return 18;
-               print_report(&report, user_param.iters, tstamp, size);
+               print_report(&report, user_param.iters, tstamp, size, no_cpu_freq_fail);
        }
 
        printf("------------------------------------------------------------------\n");



More information about the ewg mailing list