| 100 | |
| 101 | |
| 102 | Try<Nothing> Benchmark::execute(int argc, char** argv) |
| 103 | { |
| 104 | flags.setUsageMessage( |
| 105 | "Usage: " + name() + " [options]\n" |
| 106 | "\n" |
| 107 | "This command is used to do performance test on the\n" |
| 108 | "replicated log. It takes a trace file of write sizes\n" |
| 109 | "and replay that trace to measure the latency of each\n" |
| 110 | "write. The data to be written for each write can be\n" |
| 111 | "specified using the --type flag.\n" |
| 112 | "\n"); |
| 113 | |
| 114 | // Configure the tool by parsing command line arguments. |
| 115 | if (argc > 0 && argv != nullptr) { |
| 116 | Try<flags::Warnings> load = flags.load(None(), argc, argv); |
| 117 | if (load.isError()) { |
| 118 | return Error(flags.usage(load.error())); |
| 119 | } |
| 120 | |
| 121 | if (flags.help) { |
| 122 | return Error(flags.usage()); |
| 123 | } |
| 124 | |
| 125 | process::initialize(); |
| 126 | logging::initialize(argv[0], false, flags); |
| 127 | |
| 128 | // Log any flag warnings (after logging is initialized). |
| 129 | foreach (const flags::Warning& warning, load->warnings) { |
| 130 | LOG(WARNING) << warning.message; |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | if (flags.quorum.isNone()) { |
| 135 | return Error(flags.usage("Missing required option --quorum")); |
| 136 | } |
| 137 | |
| 138 | if (flags.path.isNone()) { |
| 139 | return Error(flags.usage("Missing required option --path")); |
| 140 | } |
| 141 | |
| 142 | if (flags.servers.isNone()) { |
| 143 | return Error(flags.usage("Missing required option --servers")); |
| 144 | } |
| 145 | |
| 146 | if (flags.znode.isNone()) { |
| 147 | return Error(flags.usage("Missing required option --znode")); |
| 148 | } |
| 149 | |
| 150 | if (flags.input.isNone()) { |
| 151 | return Error(flags.usage("Missing required option --input")); |
| 152 | } |
| 153 | |
| 154 | if (flags.output.isNone()) { |
| 155 | return Error(flags.usage("Missing required option --output")); |
| 156 | } |
| 157 | |
| 158 | // Initialize the log. |
| 159 | if (flags.initialize) { |
nothing calls this directly
no test coverage detected