CPU information.
More...
#include <jsondef.h>
Convert class contents to JSON object.
Returns a json11 JSON object of the class
- Returns
- A json11 JSON object containing every member variable within the class
2081 {
"uptime" ,
static_cast<int>(
uptime) },
2086 {
"boot_count",
static_cast<int>(
boot_count) },
std::map< std::string, Json > object
Definition: json11.hpp:88
uint32_t boot_count
Number of reboots.
Definition: jsondef.h:2073
float maxload
Maximum load.
Definition: jsondef.h:2064
uint32_t uptime
Seconds CPU has been up.
Definition: jsondef.h:2060
float maxgib
Maximum memory capacity in GiB.
Definition: jsondef.h:2068
float load
Current load.
Definition: jsondef.h:2062
float gib
Current memory usage in GiB.
Definition: jsondef.h:2070
void cpustruc::from_json |
( |
const string & |
s | ) |
|
|
inline |
Set class contents from JSON string.
Parses the provided JSON-formatted string and sets the class data. String should be formatted like the string returned from to_json()
- Parameters
-
s | JSON-formatted string to set class contents to |
- Returns
- n/a
2100 if(!parsed[
"uptime"].is_null()) {
uptime = parsed[
"uptime"].
int_value(); }
2107 cerr<<
"ERROR: <"<<error<<
">"<<endl;
Definition: json11.hpp:79
uint32_t boot_count
Number of reboots.
Definition: jsondef.h:2073
float maxload
Maximum load.
Definition: jsondef.h:2064
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
uint32_t uptime
Seconds CPU has been up.
Definition: jsondef.h:2060
float maxgib
Maximum memory capacity in GiB.
Definition: jsondef.h:2068
float load
Current load.
Definition: jsondef.h:2062
int int_value() const
Definition: json11.cpp:281
float gib
Current memory usage in GiB.
Definition: jsondef.h:2070
double number_value() const
Definition: json11.cpp:280
uint32_t cpustruc::uptime = 0 |
float cpustruc::load = 0.f |
float cpustruc::maxload = 0.f |
float cpustruc::maxgib = 0.f |
Maximum memory capacity in GiB.
float cpustruc::gib = 0.f |
Current memory usage in GiB.
uint32_t cpustruc::boot_count = 0 |
The documentation for this struct was generated from the following file: