YARP
Yet Another Robot Platform
SystemInfo.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_OS_SYSTEMINFO_H
11 #define YARP_OS_SYSTEMINFO_H
12 
13 #include <yarp/os/Property.h>
14 
15 #include <string>
16 
17 
18 namespace yarp {
19 namespace os {
20 
29 {
30 public:
31  typedef int capacity_t;
32 
36  typedef struct MemoryInfo
37  {
40  } MemoryInfo;
41 
42 
46  typedef struct StorageInfo
47  {
50  } StorageInfo;
51 
55  typedef struct ProcessorInfo
56  {
57  std::string architecture;
58  std::string model;
59  std::string vendor;
60  int family;
62  int cores;
63  int siblings;
64  double frequency;
65  } ProcessorInfo;
66 
67 
71  typedef struct LoadInfo
72  {
73  double cpuLoad1;
74  double cpuLoad5;
75  double cpuLoad15;
77  } LoadInfo;
78 
79 
83  typedef struct PlatformInfo
84  {
85  std::string name;
86  std::string distribution;
87  std::string release;
88  std::string codename;
89  std::string kernel;
91  } PlatformInfo;
92 
96  typedef struct UserInfo
97  {
98  std::string userName;
99  std::string realName;
100  std::string homeDir;
101  int userID;
102  } UserInfo;
103 
104  /*
105  typedef struct NetworkInfo {
106  std::string mac;
107  std::string ip4;
108  std::string ip6;
109  } NetworkInfo;
110  */
111 
115  typedef struct ProcessInfo
116  {
117  std::string name;
118  std::string arguments;
121  int pid;
122  } ProcessInfo;
123 
124 public:
129  static MemoryInfo getMemoryInfo();
130 
135  static StorageInfo getStorageInfo();
136 
141  static ProcessorInfo getProcessorInfo();
142 
147  static PlatformInfo getPlatformInfo();
148 
153  static LoadInfo getLoadInfo();
154 
159  static UserInfo getUserInfo();
160 
168  static ProcessInfo getProcessInfo(int pid = 0);
169 
170  // static NetworkInfo getNetworkInfo();
171 };
172 
173 
174 } // namespace os
175 } // namespace yarp
176 
177 #endif // YARP_OS_SYSTEMINFO_H
A class for storing options and configuration information.
Definition: Property.h:37
A class to get the system (platform) status such as available memory, storage, CPU load and etc.
Definition: SystemInfo.h:29
The main, catch-all namespace for YARP.
Definition: environment.h:18
The LoadInfo struct holds the current cpu load information.
Definition: SystemInfo.h:72
The MemoryInfo struct holds the system memory information.
Definition: SystemInfo.h:37
The PlatformInfo struct holds the operating system information.
Definition: SystemInfo.h:84
yarp::os::Property environmentVars
Definition: SystemInfo.h:90
The ProcessInfo struct provides the operating system process information.
Definition: SystemInfo.h:116
The ProcessorInfo struct holds the processor information.
Definition: SystemInfo.h:56
The StorageInfo struct holds the system storage information.
Definition: SystemInfo.h:47
The UserInfo struct holds the current user information.
Definition: SystemInfo.h:97
#define YARP_os_API
Definition: api.h:19