process-list.hh
Go to the documentation of this file.
1 /* Copyright LAAS, CNRS
2  * Author: O. Stasse, 2019
3  * See LICENSE file in the root directory of this repository.
4  */
5 
6 #ifndef DYNAMIC_GRAPH_PROCESS_LIST_H_
7 #define DYNAMIC_GRAPH_PROCESS_LIST_H_
8 
10 
11 #include <boost/archive/text_iarchive.hpp>
12 #include <boost/archive/text_oarchive.hpp>
13 #include <boost/serialization/vector.hpp>
14 #include <dynamic-graph/fwd.hh>
15 
16 namespace dynamicgraph {
17 namespace CPU {
18 class DYNAMIC_GRAPH_DLLAPI ProcessData {};
19 
20 class DYNAMIC_GRAPH_DLLAPI ProcessList {
21  public:
22  ProcessList();
23 };
24 
27 class DYNAMIC_GRAPH_DLLAPI CPUData {
28  public:
29  CPUData();
30  int cpu_id_;
31 
32  inline unsigned long long int computePeriod(unsigned long long int &a,
33  unsigned long long int &b) {
34  return (a > b) ? a - b : 0;
35  }
36 
40  unsigned long long int total_time_;
42  unsigned long long int user_mode_time_;
44  unsigned long long int nice_time_;
46  unsigned long long int system_time_;
48  unsigned long long int system_all_time_;
50  unsigned long long int idle_time_;
52  unsigned long long int idle_all_time_;
54  unsigned long long int iowait_time_;
56  unsigned long long int irq_time_;
58  unsigned long long int softirq_time_;
61  unsigned long long int steal_time_;
64  unsigned long long int guest_time_;
68  unsigned long long int guest_nice_time_;
70 
74  unsigned long long int total_period_;
76  unsigned long long int user_mode_period_;
78  unsigned long long int nice_period_;
80  unsigned long long int system_period_;
82  unsigned long long int system_all_period_;
84  unsigned long long int idle_period_;
86  unsigned long long int idle_all_period_;
88  unsigned long long int iowait_period_;
90  unsigned long long int irq_period_;
92  unsigned long long int softirq_period_;
95  unsigned long long int steal_period_;
98  unsigned long long int guest_period_;
100 
101  double percent_;
102  void ProcessLine(std::istringstream &aCPULine);
103 
104  friend class boost::serialization::access;
105 
106  template <class Archive>
107  void serialize(Archive &ar, const unsigned int version) {
108  ar &version;
109  ar &total_time_;
110  ar &user_mode_time_;
111  ar &nice_time_;
112  ar &system_time_;
113  ar &system_all_time_;
114  ar &idle_time_;
115  ar &idle_all_time_;
116  ar &iowait_time_;
117  ar &irq_time_;
118  ar &softirq_time_;
119  ar &steal_time_;
120  ar &guest_time_;
121  ar &guest_nice_time_;
122  ar &percent_;
123  }
124 };
125 
128 class DYNAMIC_GRAPH_DLLAPI System {
129  private:
130  bool init_;
131 
132  public:
133  System();
134 
136  void init();
137 
139  void readProcStat();
140 
142  friend class boost::serialization::access;
143 
145  unsigned int cpuNb_;
146 
147  void ProcessCPULine(unsigned int cpunb, std::istringstream &aCPULine);
148 
150  std::vector<CPUData> vCPUData_;
151 
154 
155  template <class Archive>
156  void serialize(Archive &ar, const unsigned int version) {
157  ar &version;
158  ar &cpuNb_;
159  ar &gCPUData_;
160  ar &vCPUData_;
161  }
162 };
163 } // namespace CPU
164 } // namespace dynamicgraph
165 
166 #endif /* DYNAMIC_GRAPH_PROCESS_LIST_H_ */
unsigned long long int idle_period_
Time spend in doing nothing.
Definition: process-list.hh:84
void serialize(Archive &ar, const unsigned int version)
unsigned long long int total_time_
Various classes of time spend by the CPUTotal time.
Definition: process-list.hh:40
CPUData gCPUData_
Global CPU information.
unsigned long long int user_mode_time_
Time spend in user mode.
Definition: process-list.hh:42
unsigned long long int system_all_time_
Time spend in system mode.
Definition: process-list.hh:48
unsigned long long int steal_time_
Definition: process-list.hh:61
unsigned long long int guest_time_
Definition: process-list.hh:64
unsigned long long int user_mode_period_
Time spend in user mode.
Definition: process-list.hh:76
unsigned long long int softirq_period_
Time spend in servicing software interrupts.
Definition: process-list.hh:92
unsigned long long int system_time_
Time spend in system mode.
Definition: process-list.hh:46
unsigned long long int idle_all_time_
Time spend in doing nothing.
Definition: process-list.hh:52
unsigned long long int nice_time_
Time spend in user mode with low priority (nice mode)
Definition: process-list.hh:44
unsigned long long int system_all_period_
Time spend in all system mode.
Definition: process-list.hh:82
std::vector< CPUData > vCPUData_
Vector of CPU informations.
unsigned long long int guest_nice_time_
Definition: process-list.hh:68
unsigned long long int guest_period_
Definition: process-list.hh:98
unsigned long long int idle_all_period_
Time spend in doing nothing.
Definition: process-list.hh:86
unsigned long long int iowait_period_
Time spend in waiting an input/output to complete.
Definition: process-list.hh:88
unsigned int cpuNb_
Number of CPU.
unsigned long long int steal_period_
Definition: process-list.hh:95
version
Definition: setup.in.py:180
unsigned long long int softirq_time_
Time spend in servicing software interrupts.
Definition: process-list.hh:58
unsigned long long int idle_time_
Time spend in doing nothing.
Definition: process-list.hh:50
unsigned long long int nice_period_
Time spend in user mode with low priority (nice mode)
Definition: process-list.hh:78
unsigned long long int irq_time_
Time spend in servicing hardware interrupts.
Definition: process-list.hh:56
void serialize(Archive &ar, const unsigned int version)
unsigned long long int iowait_time_
Time spend in waiting an input/output to complete.
Definition: process-list.hh:54
unsigned long long int irq_period_
Time spend in servicing hardware interrupts.
Definition: process-list.hh:90
unsigned long long int total_period_
Various classes of time spend by the CPU by periodTotal time.
Definition: process-list.hh:74
unsigned long long int computePeriod(unsigned long long int &a, unsigned long long int &b)
Definition: process-list.hh:32
unsigned long long int system_period_
Time spend in system mode.
Definition: process-list.hh:80


dynamic-graph
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Sun Jun 25 2023 02:06:03