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
yarp::os::SystemInfo::LoadInfo::cpuLoadInstant
int cpuLoadInstant
Definition: SystemInfo.h:76
yarp::os::SystemInfo::ProcessorInfo::model
std::string model
Definition: SystemInfo.h:58
yarp::os::SystemInfo::PlatformInfo::kernel
std::string kernel
Definition: SystemInfo.h:89
yarp::os::SystemInfo::capacity_t
int capacity_t
Definition: SystemInfo.h:31
yarp::os::SystemInfo::ProcessInfo::pid
int pid
Definition: SystemInfo.h:121
yarp::os::SystemInfo::LoadInfo::cpuLoad5
double cpuLoad5
Definition: SystemInfo.h:74
yarp::os::SystemInfo::MemoryInfo
The MemoryInfo struct holds the system memory information.
Definition: SystemInfo.h:37
yarp::os::SystemInfo::PlatformInfo
The PlatformInfo struct holds the operating system information.
Definition: SystemInfo.h:84
YARP_os_API
#define YARP_os_API
Definition: api.h:19
yarp::os::SystemInfo::ProcessorInfo::frequency
double frequency
Definition: SystemInfo.h:64
yarp::os::SystemInfo
A class to get the system (platform) status such as available memory, storage, CPU load and etc.
Definition: SystemInfo.h:29
yarp::os::SystemInfo::UserInfo::userID
int userID
Definition: SystemInfo.h:101
yarp::os::SystemInfo::UserInfo::userName
std::string userName
Definition: SystemInfo.h:98
yarp::os::SystemInfo::ProcessorInfo::modelNumber
int modelNumber
Definition: SystemInfo.h:61
yarp::os::SystemInfo::UserInfo
The UserInfo struct holds the current user information.
Definition: SystemInfo.h:97
yarp::os::SystemInfo::StorageInfo::freeSpace
capacity_t freeSpace
Definition: SystemInfo.h:49
Property.h
yarp::os::SystemInfo::ProcessorInfo::cores
int cores
Definition: SystemInfo.h:62
yarp::os::SystemInfo::ProcessInfo::name
std::string name
Definition: SystemInfo.h:117
yarp::os::SystemInfo::PlatformInfo::release
std::string release
Definition: SystemInfo.h:87
yarp::os::SystemInfo::ProcessorInfo::siblings
int siblings
Definition: SystemInfo.h:63
yarp::os::SystemInfo::LoadInfo::cpuLoad15
double cpuLoad15
Definition: SystemInfo.h:75
yarp::os::SystemInfo::PlatformInfo::distribution
std::string distribution
Definition: SystemInfo.h:86
yarp::os::SystemInfo::ProcessorInfo::vendor
std::string vendor
Definition: SystemInfo.h:59
yarp::os::SystemInfo::UserInfo::realName
std::string realName
Definition: SystemInfo.h:99
yarp::os::SystemInfo::PlatformInfo::environmentVars
yarp::os::Property environmentVars
Definition: SystemInfo.h:90
yarp::os::SystemInfo::ProcessorInfo
The ProcessorInfo struct holds the processor information.
Definition: SystemInfo.h:56
yarp::os::SystemInfo::ProcessInfo::schedPriority
int schedPriority
Definition: SystemInfo.h:120
yarp::os::SystemInfo::LoadInfo::cpuLoad1
double cpuLoad1
Definition: SystemInfo.h:73
yarp::os::SystemInfo::ProcessInfo
The ProcessInfo struct provides the operating system process information.
Definition: SystemInfo.h:116
yarp::os::SystemInfo::PlatformInfo::codename
std::string codename
Definition: SystemInfo.h:88
yarp::os::SystemInfo::StorageInfo::totalSpace
capacity_t totalSpace
Definition: SystemInfo.h:48
yarp::os::SystemInfo::ProcessInfo::schedPolicy
int schedPolicy
Definition: SystemInfo.h:119
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::os::SystemInfo::MemoryInfo::totalSpace
capacity_t totalSpace
Definition: SystemInfo.h:38
yarp::os::SystemInfo::ProcessorInfo::family
int family
Definition: SystemInfo.h:60
yarp::os::SystemInfo::ProcessorInfo::architecture
std::string architecture
Definition: SystemInfo.h:57
yarp::os::SystemInfo::UserInfo::homeDir
std::string homeDir
Definition: SystemInfo.h:100
yarp::os::SystemInfo::PlatformInfo::name
std::string name
Definition: SystemInfo.h:85
yarp::os::SystemInfo::ProcessInfo::arguments
std::string arguments
Definition: SystemInfo.h:118
yarp::os::Property
A class for storing options and configuration information.
Definition: Property.h:37
yarp::os::SystemInfo::MemoryInfo::freeSpace
capacity_t freeSpace
Definition: SystemInfo.h:39
yarp::os::SystemInfo::StorageInfo
The StorageInfo struct holds the system storage information.
Definition: SystemInfo.h:47
yarp::os::SystemInfo::LoadInfo
The LoadInfo struct holds the current cpu load information.
Definition: SystemInfo.h:72