@@ -11,25 +11,20 @@ using Monitoring = AliceO2::Monitoring::MonitoringFactory;
1111
1212int main (int argc, char *argv[]) {
1313 int sleep = 1000000 ;
14- std::string stringMetric = " stringMetric" ;
15- std::string doubleMetric = " doubleMetric" ;
16- std::string intMetric = " intMetric" ;
14+ int count = 0 ;
1715
1816 std::random_device rd;
1917 std::mt19937 mt (rd ());
2018
2119 std::uniform_real_distribution<double > doubleDist (1.0 , 100.0 );
2220 std::uniform_int_distribution<> intDist (1 , 100 );
2321
24- double doubleValue = doubleDist (mt);
25- std::string stringValue = " sampleString" + std::to_string (intDist (mt));
26- int intValue = intDist (mt);
27-
2822 boost::program_options::options_description desc (" Allowed options" );
2923 desc.add_options ()
3024 (" sleep" , boost::program_options::value<int >(), " Thread sleep in microseconds" )
3125 (" config" , boost::program_options::value<std::string>()->required (), " Config file path" )
3226 (" id" , boost::program_options::value<std::string>(), " Instance ID" )
27+ (" count" , boost::program_options::value<int >(), " Number of metric bunches (x3)" )
3328 ;
3429
3530 boost::program_options::variables_map vm;
@@ -40,17 +35,27 @@ int main(int argc, char *argv[]) {
4035 sleep = vm[" sleep" ].as <int >();
4136 }
4237
38+ if (vm.count (" count" )) {
39+ count = vm[" count" ].as <int >();
40+ }
41+
4342 try {
4443 Monitoring::Configure (" file://" + vm[" config" ].as <std::string>());
4544 } catch (std::string &e) {
4645 std::cout << " Configuration file not found.\n " << e << std::endl;
4746 std::exit (EXIT_FAILURE);
48- }
47+ }
48+
49+ int add = 0 ;
50+ if (count != 0 ) {
51+ count--;
52+ add = 1 ;
53+ }
4954
50- for (;; ) {
51- Monitoring::Get ().send (stringValue, stringMetric);
52- Monitoring::Get ().send (doubleValue, doubleMetric);
53- Monitoring::Get ().send (intValue, intMetric);
55+ for (int i = 0 ; i <= count; i += add ) {
56+ Monitoring::Get ().send ({ " string " + std::to_string ( intDist (mt)), " stringMetric" } );
57+ Monitoring::Get ().send ({ doubleDist (mt), " doubleMetric" } );
58+ Monitoring::Get ().send ({ intDist (mt), " intMetric" } );
5459 std::this_thread::sleep_for (std::chrono::microseconds (sleep));
5560 }
56- }
61+ }
0 commit comments