Skip to content

Commit 6ba8891

Browse files
authored
Add monitoring and buffer options to benchmark (#66)
1 parent d99de52 commit 6ba8891

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

examples/5-Benchmark.cxx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ int main(int argc, char *argv[]) {
2727
("count", boost::program_options::value<int>(), "Number of metric bunches (x3)")
2828
("multiple", boost::program_options::bool_switch()->default_value(false), "Sends multiple metrics per measurement")
2929
("vector", boost::program_options::bool_switch()->default_value(false), "Sends vector of metrics")
30+
("monitor", boost::program_options::bool_switch()->default_value(false), "Enabled process monitor")
31+
("buffer", boost::program_options::value<int>(), "Creates buffr of given size")
3032
;
3133

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

4446
auto monitoring = Monitoring::Get(vm["url"].as<std::string>());
45-
monitoring->enableProcessMonitoring(1);
47+
if (vm["monitor"].as<bool>()) {
48+
monitoring->enableProcessMonitoring(1);
49+
}
4650
int add = 0;
4751
if (count != 0) {
4852
count--;
@@ -68,6 +72,9 @@ int main(int argc, char *argv[]) {
6872
std::this_thread::sleep_for(std::chrono::microseconds(sleep));
6973
}
7074
} else {
75+
if (vm.count("buffer")) {
76+
monitoring->enableBuffering(vm["buffer"].as<int>());
77+
}
7178
for (int i = 0; i <= count; i += add) {
7279
monitoring->send({"string" + std::to_string(intDist(mt)), "stringMetric"});
7380
monitoring->send({doubleDist(mt), "doubleMetric"});

0 commit comments

Comments
 (0)