YARP
Yet Another Robot Platform
SystemInfo.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef YARP_OS_SYSTEMINFO_H
8 #define YARP_OS_SYSTEMINFO_H
9 
10 #include <yarp/os/Property.h>
11 
12 #include <string>
13 
14 
15 namespace yarp {
16 namespace os {
17 
26 {
27 public:
28  typedef int capacity_t;
29 
33  typedef struct MemoryInfo
34  {
37  } MemoryInfo;
38 
39 
43  typedef struct StorageInfo
44  {
47  } StorageInfo;
48 
52  typedef struct ProcessorInfo
53  {
54  std::string architecture;
55  std::string model;
56  std::string vendor;
57  int family;
59  int cores;
60  int siblings;
61  double frequency;
62  } ProcessorInfo;
63 
64 
68  typedef struct LoadInfo
69  {
70  double cpuLoad1;
71  double cpuLoad5;
72  double cpuLoad15;
74  } LoadInfo;
75 
76 
80  typedef struct PlatformInfo
81  {
82  std::string name;
83  std::string distribution;
84  std::string release;
85  std::string codename;
86  std::string kernel;
88  } PlatformInfo;
89 
93  typedef struct UserInfo
94  {
95  std::string userName;
96  std::string realName;
97  std::string homeDir;
98  int userID;
99  } UserInfo;
100 
101  /*
102  typedef struct NetworkInfo {
103  std::string mac;
104  std::string ip4;
105  std::string ip6;
106  } NetworkInfo;
107  */
108 
112  typedef struct ProcessInfo
113  {
114  std::string name;
115  std::string arguments;
118  int pid;
119  } ProcessInfo;
120 
121 public:
126  static MemoryInfo getMemoryInfo();
127 
132  static StorageInfo getStorageInfo();
133 
138  static ProcessorInfo getProcessorInfo();
139 
144  static PlatformInfo getPlatformInfo();
145 
150  static LoadInfo getLoadInfo();
151 
156  static UserInfo getUserInfo();
157 
165  static ProcessInfo getProcessInfo(int pid = 0);
166 
167  // static NetworkInfo getNetworkInfo();
168 };
169 
170 
171 } // namespace os
172 } // namespace yarp
173 
174 #endif // YARP_OS_SYSTEMINFO_H
A class for storing options and configuration information.
Definition: Property.h:34
A class to get the system (platform) status such as available memory, storage, CPU load and etc.
Definition: SystemInfo.h:26
The main, catch-all namespace for YARP.
Definition: dirs.h:16
The LoadInfo struct holds the current cpu load information.
Definition: SystemInfo.h:69
The MemoryInfo struct holds the system memory information.
Definition: SystemInfo.h:34
The PlatformInfo struct holds the operating system information.
Definition: SystemInfo.h:81
yarp::os::Property environmentVars
Definition: SystemInfo.h:87
The ProcessInfo struct provides the operating system process information.
Definition: SystemInfo.h:113
The ProcessorInfo struct holds the processor information.
Definition: SystemInfo.h:53
The StorageInfo struct holds the system storage information.
Definition: SystemInfo.h:44
The UserInfo struct holds the current user information.
Definition: SystemInfo.h:94
#define YARP_os_API
Definition: api.h:18