obmon  0.0.0
 All Classes Functions Variables Enumerations Groups Pages
ObSensorSystem.h
1 
7 
9 #pragma once
10 
11 #include <ObSensor.h>
12 
13 #include <iostream>
14 #include <string>
15 #include <vector>
16 
17 #include <glibtop/cpu.h>
18 #include <glibtop/mem.h>
19 #include <glibtop/netlist.h>
20 #include <glibtop/netload.h>
21 
28 
29 class ObSensorSystem : public ObSensor {
30 public:
31  ObSensorSystem(std::string name = {"sys"});
32  virtual ~ObSensorSystem();
33 
34  void init() override;
35  void process() override;
36  void speed(ObSensor *s1, ObSensor *s2, int timeout = 1000) override;
37  std::string json(const std::string name = {"static"}) const override;
38 
40  glibtop_cpu cpu() const { return _cpu; }
41 
43  glibtop_mem mem() const { return _mem; }
44 
46  glibtop_netlist netlist() const { return _netlist; }
47 
49  std::vector<glibtop_netload *> netloads() const { return _netloads; }
50 
51 private:
52  glibtop_cpu _cpu{};
53  glibtop_mem _mem{};
54  glibtop_netlist _netlist{};
55  std::vector<glibtop_netload *> _netloads{};
56  std::vector<std::string> _netnames{};
57 };
58 
void process() override
Process function.
void speed(ObSensor *s1, ObSensor *s2, int timeout=1000) override
Calculate time change (speed)
System Obmon sensor class.
ObSensorSystem(std::string name={"sys"})
glibtop_mem mem() const
returns glibtop_mem
std::vector< std::string > _netnames
list of network names
void init() override
glibtop_netlist netlist() const
returns glibtop_netlist
std::string name() const
Returns name of sensor.
Definition: ObSensor.h:39
std::vector< glibtop_netload * > netloads() const
returns netloads
glibtop_mem _mem
Mem info from glitop.
std::string json(const std::string name={"static"}) const override
glibtop_cpu _cpu
Cpu info from glitop.
glibtop_cpu cpu() const
returns glibtop_cpu
Base Obmon sensor class.
Definition: ObSensor.h:19
virtual ~ObSensorSystem()
glibtop_netlist _netlist
NetList from glitop.
std::vector< glibtop_netload * > _netloads
List of netload.