Motion Master 6.0.0-alpha.50
Next-generation motion control software
Loading...
Searching...
No Matches
system_info.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <nlohmann/json_fwd.hpp>
5#include <string>
6
7namespace mm::core {
8
9// A snapshot of the host OS and hardware Motion Master is running on. Collected on demand for the
10// Connection page's "System" panel — cheap, uncached. Every field is best-effort: one that cannot
11// be determined on the current platform is left empty (or zero) rather than failing the snapshot.
12struct SystemInfo {
13 std::string osName; // friendly OS name, e.g. "Ubuntu 24.04 LTS", "Windows", "macOS 14.5"
14 std::string kernel; // kernel/OS build, e.g. "6.8.0-31-generic", "10.0.22631"
15 std::string architecture; // machine architecture, e.g. "x86_64", "aarch64"
16 std::string hostname; // network host name
17 std::string cpuModel; // CPU brand string, e.g. "Intel(R) Core(TM) i7-1185G7"
18 unsigned cpuCores = 0; // logical processor count
19 uint64_t totalMemoryBytes = 0; // total physical RAM in bytes (0 if unknown)
20 uint64_t diskTotalBytes = 0; // capacity of the filesystem holding the working directory
21 uint64_t diskFreeBytes = 0; // space available to an unprivileged process on that filesystem
22 std::string container; // container runtime when running in one ("docker"/"podman"), else ""
23 std::string dockerVersion; // host Docker version from `docker --version`, else ""
24};
25
26// Collects a SystemInfo snapshot for the current host. Never throws; unknown fields stay
27// empty/zero.
29
30// Serialises a snapshot to the JSON shape served by GET /api/system-info (nlohmann ADL hook).
31void to_json(nlohmann::json& j, const SystemInfo& info);
32
33} // namespace mm::core
Definition cyclic_timer.h:6
SystemInfo collectSystemInfo()
Definition system_info.cc:285
void to_json(nlohmann::json &j, const SystemInfo &info)
Definition system_info.cc:297
Definition system_info.h:12
std::string dockerVersion
Definition system_info.h:23
std::string cpuModel
Definition system_info.h:17
uint64_t diskTotalBytes
Definition system_info.h:20
unsigned cpuCores
Definition system_info.h:18
std::string hostname
Definition system_info.h:16
std::string architecture
Definition system_info.h:15
uint64_t diskFreeBytes
Definition system_info.h:21
std::string container
Definition system_info.h:22
std::string osName
Definition system_info.h:13
uint64_t totalMemoryBytes
Definition system_info.h:19
std::string kernel
Definition system_info.h:14