Skip to content

Commit 5ba0c0b

Browse files
authored
Add help to benchmark example (#298)
1 parent 120be31 commit 5ba0c0b

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

examples/5-Benchmark.cxx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,27 @@ int main(int argc, char* argv[])
2626
std::uniform_int_distribution<> intDist(1, 100);
2727

2828
boost::program_options::options_description desc("Allowed options");
29-
desc.add_options()("sleep", boost::program_options::value<int>(), "Thread sleep in microseconds")("url", boost::program_options::value<std::string>()->required(), "URL to monitoring backend (or list of comma seperated URLs)")("id", boost::program_options::value<std::string>(), "Instance ID")("count", boost::program_options::value<int>(), "Number of loop cycles")("multiple", boost::program_options::bool_switch()->default_value(false), "Sends multiple metrics per measurement")("latency", boost::program_options::bool_switch()->default_value(false), "Sends timestamp as a value")("monitor", boost::program_options::bool_switch()->default_value(false), "Enabled process monitor")("buffer", boost::program_options::value<int>(), "Creates buffr of given size")("measurements", boost::program_options::value<int>(), "Number of different measurements")("flps", boost::program_options::value<int>(), "Number of FLPs (tags)");
29+
desc.add_options()
30+
("sleep", boost::program_options::value<int>(), "Thread sleep in microseconds")
31+
("url", boost::program_options::value<std::string>()->required(), "URL to monitoring backend (or comma seperated list)")
32+
("id", boost::program_options::value<std::string>(), "Instance ID")
33+
("count", boost::program_options::value<int>(), "Number of loop cycles")
34+
("multiple", boost::program_options::bool_switch()->default_value(false), "Sends multiple metrics per measurement")
35+
("latency", boost::program_options::bool_switch()->default_value(false), "Sends timestamp as a value")
36+
("monitor", boost::program_options::bool_switch()->default_value(false), "Enabled process monitor")
37+
("buffer", boost::program_options::value<int>(), "Creates buffr of given size")
38+
("measurements", boost::program_options::value<int>(), "Number of different measurements")
39+
("flps", boost::program_options::value<int>(), "Number of FLPs (tags)")
40+
("help,h", "Show usage");
3041

3142
boost::program_options::variables_map vm;
3243
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
44+
45+
if (vm.count("help")) {
46+
std::cerr << desc << "\n";
47+
return 1;
48+
}
49+
3350
boost::program_options::notify(vm);
3451

3552
if (vm.count("flps")) {

0 commit comments

Comments
 (0)