Class providing basic system information. More...
#include <eagine/system_info.hpp>
Public Types | |
using | host_id_type = std::uint32_t |
Alias for host id type. | |
![]() | |
using | entry_type = std::conditional_t< is_log_level_enabled_v< severity >, log_entry, no_log_entry > |
The entry type for the specified log_event_severity. More... | |
![]() | |
using | entry_type = std::conditional_t< is_log_level_enabled_v< severity >, log_entry, no_log_entry > |
The entry type for the specified log_event_severity. More... | |
Public Member Functions | |
auto | preinitialize () noexcept -> system_info & |
Do potentially expensive pre-initialization and caching. | |
auto | host_id () noexcept -> valid_if_positive< host_id_type > |
Returns a unique numeric id of this host computer. | |
auto | hostname () noexcept -> valid_if_not_empty< std::string > |
Returns the hostname. | |
auto | uptime () noexcept -> std::chrono::duration< float > |
Returns the system uptime. | |
auto | cpu_concurrent_threads () noexcept -> valid_if_positive< span_size_t > |
Returns the number of threads that can run concurrently. | |
auto | current_processes () noexcept -> valid_if_positive< span_size_t > |
Returns the number of running processes. | |
auto | short_average_load () noexcept -> valid_if_nonnegative< float > |
Returns the short-term average system load in range (0.0, 1.0). | |
auto | long_average_load () noexcept -> valid_if_nonnegative< float > |
Returns the long-term average system load in range (0.0, 1.0). | |
auto | memory_page_size () noexcept -> valid_if_positive< span_size_t > |
Returns the memory page size on this system. | |
auto | free_ram_size () noexcept -> valid_if_positive< span_size_t > |
Returns free RAM size. | |
auto | total_ram_size () noexcept -> valid_if_positive< span_size_t > |
Returns total RAM size. | |
auto | free_swap_size () noexcept -> valid_if_nonnegative< span_size_t > |
Returns free swap size. | |
auto | total_swap_size () noexcept -> valid_if_nonnegative< span_size_t > |
Returns total swap size. | |
auto | thermal_sensor_count () noexcept -> span_size_t |
Returns the number of system thermal sensors. | |
auto | sensor_temperature (span_size_t) noexcept -> valid_if_positive< kelvins_t< float >> |
Returns the temperature on the i-th thermal sensor. | |
auto | cpu_temperature () noexcept -> valid_if_positive< kelvins_t< float >> |
Returns the temperature on the CPU thermal sensor if present. | |
auto | gpu_temperature () noexcept -> valid_if_positive< kelvins_t< float >> |
Returns the temperature on the GPU thermal sensor if present. | |
auto | cooling_device_count () noexcept -> span_size_t |
Returns the number of cooling devices. | |
auto | cooling_device_state (span_size_t) noexcept -> valid_if_between_0_1< float > |
Returns the state of the i-th cooling device. | |
auto | battery_count () noexcept -> span_size_t |
Returns the count of batteries in the system. | |
auto | battery_capacity (span_size_t) noexcept -> valid_if_between_0_1< float > |
Returns the capacity of the i-th battery. | |
![]() | |
main_ctx_object (identifier obj_id, main_ctx_parent parent) noexcept | |
Initialization from object id and parent. | |
auto | process_instance_id () const noexcept -> process_instance_id_t |
Returns the process id. | |
auto | main_context () const noexcept -> main_ctx & |
Returns a reference to the main context singleton. | |
auto | app_config () const noexcept -> application_config & |
Returns a reference to the application config object. | |
auto | as_parent () noexcept -> main_ctx_object_parent_info |
Returns this as main_ctx_object_parent_info. | |
template<typename T > | |
auto | cfg_init (string_view key, T initial, string_view tag={}) -> T |
Reads and returns the configuration value identified by key . | |
template<typename Extractable , typename T > | |
auto | cfg_extr (string_view key, T initial, string_view tag={}, type_identity< Extractable >={}) -> T |
Reads and returns the configuration value identified by key . | |
![]() | |
named_logging_object (identifier id, main_ctx_log_backend_getter backend_getter) noexcept | |
Constructor from identifier and backend_getter object. More... | |
named_logging_object (identifier id, const named_logging_object &parent) noexcept | |
Constructor from logger id and parent logging object. | |
named_logging_object () noexcept=default | |
Construct logging object without backend. | |
named_logging_object (named_logging_object &&temp) noexcept | |
Move constructor. | |
named_logging_object (const named_logging_object &that) noexcept | |
Copy constructor. | |
auto | operator= (named_logging_object &&) noexcept -> named_logging_object &=default |
Move assignment operator. | |
auto | operator= (const named_logging_object &) -> named_logging_object &=default |
Copy assignment operator. | |
constexpr auto | object_id () const noexcept |
Returns the identifier of this logging object. | |
void | object_description (string_view display_name, string_view description) noexcept |
Sets the human-readable name and description of this object. | |
auto | log_fatal (string_view format) noexcept |
Create a log message entry for fatal error, with specified format. More... | |
auto | log_error (string_view format) noexcept |
Create a log message entry for error, with specified format. More... | |
auto | log_warning (string_view format) noexcept |
Create a log message entry for warning, with specified format. More... | |
auto | log_info (string_view format) noexcept |
Create a log message entry for information, with specified format. More... | |
auto | log_stat (string_view format) noexcept |
Create a log message entry for statistic, with specified format. More... | |
auto | log_debug (string_view format) noexcept |
Create a log message entry for debugging, with specified format. More... | |
auto | log_trace (string_view format) noexcept |
Create a log message entry for tracing, with specified format. More... | |
auto | log_backtrace (string_view format) noexcept |
Create a log message entry for backtracing, with specified format. More... | |
auto | log_debug_stream () noexcept |
Returns a log entry stream for debug messages. More... | |
auto | log_error_stream () noexcept |
Returns a log entry stream for error messages. More... | |
auto | log_chart_sample (identifier series, float value) noexcept -> named_logging_object & |
Stores a new value in the specified chart data series . | |
auto | log_chart_sample (identifier series, const tagged_quantity< T, U > &qty) noexcept -> std::enable_if_t< std::is_convertible_v< T, float >, named_logging_object & > |
Stores a new value in the specified chart data series . | |
auto | log_chart_sample (identifier series, const valid_if< T, P > &opt_value) noexcept -> named_logging_object & |
Stores a new value in the specified chart data series . | |
![]() | |
auto | backend () noexcept |
Returns a pointer to the backend of this logger object. | |
auto | instance_id () const noexcept -> logger_instance_id |
Returns the unique id of this logger instance. | |
Class providing basic system information.