Line data Source code
1 : #include <iostream>
2 : #include "artdaq-utilities/Plugins/MetricManager.hh"
3 : #include "artdaq/Application/LoadParameterSet.hh"
4 : #include "fhiclcpp/types/TableFragment.h"
5 :
6 : /**
7 : * \brief Configuration for simple_metric_sender
8 : */
9 : struct Config
10 : {
11 : fhicl::TableFragment<artdaq::MetricManager::Config> metricmanager_config; ///< Configuration for MetricManager
12 : };
13 :
14 0 : int main(int argc, char* argv[])
15 : try
16 : {
17 0 : auto config_ps = LoadParameterSet<Config>(argc, argv, "simple_metric_sender", "A simple application that can be used to send artdaq Metrics from the command line.");
18 0 : artdaq::MetricManager mm;
19 0 : mm.initialize(config_ps, config_ps.get<std::string>("application_name", "SimpleMetric"));
20 0 : mm.do_start();
21 :
22 0 : int level = config_ps.get<int>("metric_level", 1);
23 :
24 0 : std::cout << "Enter metrics in <name> <value> <units> format. Ctrl-D to end" << std::endl;
25 0 : std::string name, unit;
26 : double value;
27 0 : while (std::cin >> name >> value >> unit)
28 : {
29 0 : mm.sendMetric(name, value, unit, level, artdaq::MetricMode::LastPoint);
30 : }
31 :
32 0 : mm.do_stop();
33 :
34 0 : return 0;
35 0 : }
36 0 : catch (...)
37 : {
38 0 : return -1;
39 0 : }
|