X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=utilities%2Fovs-benchmark.c;h=6eeedc6180a99fd73bb5a7d3c7afcec511d43c4f;hb=2431be1b68d386bd616378d2c528242775c4d54a;hp=bc28dab69b5333b86452495b192f3ca994267469;hpb=55d5bb44cbca6993494b05a374d4f09ec03c9102;p=sliver-openvswitch.git diff --git a/utilities/ovs-benchmark.c b/utilities/ovs-benchmark.c index bc28dab69..6eeedc618 100644 --- a/utilities/ovs-benchmark.c +++ b/utilities/ovs-benchmark.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011 Nicira Networks. + * Copyright (c) 2010, 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ static double max_rate; static double timeout; -static const struct command all_commands[]; +static const struct command *get_all_commands(void); static void parse_options(int argc, char *argv[]); static void usage(void); @@ -72,7 +72,7 @@ main(int argc, char *argv[]) set_program_name(argv[0]); vlog_set_levels(NULL, VLF_ANY_FACILITY, VLL_EMER); parse_options(argc, argv); - run_command(argc - optind, argv + optind, all_commands); + run_command(argc - optind, argv + optind, get_all_commands()); return 0; } @@ -118,7 +118,7 @@ parse_target(const char *s_, struct in_addr *addr, static void parse_options(int argc, char *argv[]) { - static struct option long_options[] = { + static const struct option long_options[] = { {"local", required_argument, NULL, 'l'}, {"remote", required_argument, NULL, 'r'}, {"batches", required_argument, NULL, 'b'}, @@ -467,9 +467,9 @@ cmd_rate(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) } now = time_in_msec(); - if (now >= prev + 10) { + if (now >= prev + 1000) { long long int elapsed = now - start; - printf("%.3f s elapsed, %u OK, %u failed, avg %.1f/s \r", + printf("%.3f s elapsed, %u OK, %u failed, avg %.1f/s\n", elapsed / 1000.0, completed - failures, failures, completed / (elapsed / 1000.0)); fflush(stdout); @@ -617,3 +617,8 @@ static const struct command all_commands[] = { { "help", 0, 0, cmd_help }, { NULL, 0, 0, NULL }, }; + +static const struct command *get_all_commands(void) +{ + return all_commands; +}