Skip to content

Commit

Permalink
Add monitoring and buffer options to benchmark (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
awegrzyn authored Aug 23, 2018
1 parent d99de52 commit 6ba8891
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion examples/5-Benchmark.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ int main(int argc, char *argv[]) {
("count", boost::program_options::value<int>(), "Number of metric bunches (x3)")
("multiple", boost::program_options::bool_switch()->default_value(false), "Sends multiple metrics per measurement")
("vector", boost::program_options::bool_switch()->default_value(false), "Sends vector of metrics")
("monitor", boost::program_options::bool_switch()->default_value(false), "Enabled process monitor")
("buffer", boost::program_options::value<int>(), "Creates buffr of given size")
;

boost::program_options::variables_map vm;
Expand All @@ -42,7 +44,9 @@ int main(int argc, char *argv[]) {
}

auto monitoring = Monitoring::Get(vm["url"].as<std::string>());
monitoring->enableProcessMonitoring(1);
if (vm["monitor"].as<bool>()) {
monitoring->enableProcessMonitoring(1);
}
int add = 0;
if (count != 0) {
count--;
Expand All @@ -68,6 +72,9 @@ int main(int argc, char *argv[]) {
std::this_thread::sleep_for(std::chrono::microseconds(sleep));
}
} else {
if (vm.count("buffer")) {
monitoring->enableBuffering(vm["buffer"].as<int>());
}
for (int i = 0; i <= count; i += add) {
monitoring->send({"string" + std::to_string(intDist(mt)), "stringMetric"});
monitoring->send({doubleDist(mt), "doubleMetric"});
Expand Down

0 comments on commit 6ba8891

Please sign in to comment.