-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathcountmon.h
More file actions
52 lines (41 loc) · 1.59 KB
/
countmon.h
File metadata and controls
52 lines (41 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (C) 2018-2025 CERN
// License Apache2 - see LICENCE file
// Process and thread number monitoring class
//
#ifndef PRMON_COUNTMON_H
#define PRMON_COUNTMON_H 1
#include <map>
#include <string>
#include <unordered_map>
#include <vector>
#include "Imonitor.h"
#include "MessageBase.h"
#include "parameter.h"
#include "registry.h"
class countmon final : public Imonitor, public MessageBase {
private:
// Setup the parameters to monitor here
const prmon::parameter_list params = {{"nprocs", "1", "1"},
{"nthreads", "1", "1"},
{"nfds", "1", "1"}};
// Dynamic monitoring container for value measurements
// This will be filled at initialisation, taking the names
// from the above params
prmon::monitored_list count_stats;
public:
countmon();
void update_stats(const std::vector<pid_t>& pids,
const std::string read_path = "");
// These are the stat getter methods which retrieve current statistics
prmon::monitored_value_map const get_text_stats();
prmon::monitored_value_map const get_json_total_stats();
prmon::monitored_average_map const get_json_average_stats(
unsigned long long elapsed_clock_ticks);
prmon::parameter_list const get_parameter_list();
// This is the hardware information getter that runs once
void const get_hardware_info(nlohmann::json& hw_json);
void const get_unit_info(nlohmann::json& unit_json);
bool const is_valid() { return true; }
};
REGISTER_MONITOR(Imonitor, countmon, "Monitor number of processes and threads")
#endif // PRMON_COUNTMON_H