cf¶
Namespaces¶
| Name |
|---|
| cf::hash |
| cf::internal |
| cf::linux_impl |
| cf::ui |
| cf::win_impl |
Classes¶
| Name | |
|---|---|
| class | cf::bad_expected_access Exception thrown when accessing the value of an expected that contains an error. |
| class | cf::bad_expected_access< void > Specialization of bad_expected_access for void error type. |
| struct | cf::CachedMemory Linux-specific cached memory information. |
| struct | cf::CallOnceInit Thread-safe lazy initialization template. |
| class | cf::COMHelper Helper class for Windows COM operations. |
| struct | cf::CPUBonusInfoHost Internal storage for extended CPU information. |
| struct | cf::CPUBonusInfoView Extended CPU information with optional fields. |
| struct | cf::CPUInfoHost Internal storage for basic CPU information. |
| struct | cf::CPUInfoView Read-only view of basic CPU information. |
| struct | cf::CPUProfileInfo CPU performance and capacity information. |
| struct | cf::DimmInfo DIMM (Memory Module) information. |
| class | cf::expected A wrapper that contains either a value or an error. |
| class | cf::expected< void, E > Specialization of expected for void value type. |
| struct | cf::MemoryInfo Comprehensive memory information for system detection. |
| struct | cf::PhysicalMemory Physical memory information. |
| struct | cf::ProcessMemory Process memory usage information. |
| class | cf::ScopeGuard RAII scope guard for automatic cleanup operations. |
| class | cf::SimpleSingleton Simple thread-safe singleton using Meyer's singleton pattern. |
| class | cf::Singleton Thread-safe singleton with explicit initialization. |
| class | cf::span A non-owning view into a contiguous sequence of elements. |
| struct | cf::SwapMemory Virtual memory / Swap space information. |
| struct | cf::unexpect_t Tag type for constructing expected in error state. |
| class | cf::unexpected Wrapper type for constructing expected objects in error state. |
| class | cf::WeakPtr Non-owning weak reference for exclusively owned resources. |
| class | cf::WeakPtrFactory Factory for producing WeakPtr instances for an exclusive owner. |
Types¶
| Name | |
|---|---|
| enum class | CPUInfoErrorType { CPU_QUERY_NOERROR, CPU_QUERY_GENERAL_FAILED} Error types for CPU basic information queries. |
| enum class | CPUBonusInfoViewError { NoError, GeneralError} Error types for CPU bonus information queries. |
| enum class | CPUProfileInfoError { CPUProfileInfoGeneralError} Error types for CPU profile information queries. |
| enum class uint8_t | MemoryType { UNKNOWN = 0, DDR3, DDR4, DDR5, LPDDR3, LPDDR4, LPDDR4X, LPDDR5, DDR2, SDRAM} Memory type enumeration. |
Functions¶
| Name | |
|---|---|
| std::string_view | parse_cpuinfo_field(std::string_view line, std::string_view field) Parses a "key: value" line from /proc/cpuinfo or similar files. |
| std::string_view | trim_whitespace(std::string_view sv) Removes whitespace from both ends of a string view. |
| std::string_view | ltrim_whitespace(std::string_view sv) Removes leading whitespace from a string view. |
| std::string_view | rtrim_whitespace(std::string_view sv) Removes trailing whitespace from a string view. |
| std::optional< uint32_t > | parse_cache_size(std::string_view size_str) Parses a cache size string to kilobytes. |
| std::optional< uint32_t > | parse_uint32(std::string_view str) Parses a decimal string to a 32-bit unsigned integer. |
| std::optional< uint32_t > | parse_hex_uint32(std::string_view str) Parses a hexadecimal string to a 32-bit unsigned integer. |
| std::optional< uint32_t > | read_uint32_file(constchar * path) Reads a single uint32_t value from a file. |
| std::string_view | arm_implementer_to_vendor(uint32_t impl_val) Converts an ARM implementer ID to a vendor name. |
| expected< CPUInfoView, CPUInfoErrorType > | getCPUInfo(bool force_refresh =false) Retrieves basic CPU information with lazy initialization. |
| expected< CPUBonusInfoView, CPUBonusInfoViewError > | getCPUBonusInfo(bool force_refresh =false) Retrieves extended CPU information with lazy initialization. |
| expected< CPUProfileInfo, CPUProfileInfoError > | getCPUProfileInfo() Retrieves CPU performance information. |
| void | getSystemMemoryInfo(MemoryInfo & info) |
Attributes¶
| Name | |
|---|---|
| constexprunexpect_t | unexpect Global unexpect tag instance. |
Types Documentation¶
enum CPUInfoErrorType¶
| Enumerator | Value | Description |
|---|---|---|
| CPU_QUERY_NOERROR | Query completed successfully. | |
| CPU_QUERY_GENERAL_FAILED | General query failure occurred. |
Error types for CPU basic information queries.
enum CPUBonusInfoViewError¶
| Enumerator | Value | Description |
|---|---|---|
| NoError | Query completed successfully. | |
| GeneralError | General query failure occurred. |
Error types for CPU bonus information queries.
enum CPUProfileInfoError¶
| Enumerator | Value | Description |
|---|---|---|
| CPUProfileInfoGeneralError | General query failure occurred. |
Error types for CPU profile information queries.
enum MemoryType¶
| Enumerator | Value | Description |
|---|---|---|
| UNKNOWN | 0 | |
| DDR3 | ||
| DDR4 | ||
| DDR5 | ||
| LPDDR3 | ||
| LPDDR4 | ||
| LPDDR4X | ||
| LPDDR5 | ||
| DDR2 | ||
| SDRAM |
Memory type enumeration.
Functions Documentation¶
function parse_cpuinfo_field¶
Parses a "key: value" line from /proc/cpuinfo or similar files.
Parameters:
- line The line to parse. Expected format: "key: value".
- field The field name to search for.
Exceptions:
- None (returns empty string_view on error).
Return: string_view pointing to the value, or empty string_view if the field is not found.
Since: 0.1
Note: The returned string_view is only valid as long as the input line is valid. The calling code must ensure the source data outlives the returned view.
Warning: The input line must contain a colon ':' separator.
Searches for the specified field name and returns the corresponding value as a string view. The returned view is only valid as long as the input line remains valid.
function trim_whitespace¶
Removes whitespace from both ends of a string view.
Parameters:
- sv The string view to trim.
Exceptions:
- None.
Return: Trimmed string view with leading and trailing whitespace removed.
Since: 0.1
Note: Whitespace includes spaces, tabs, newlines, and carriage returns.
Warning: None.
function ltrim_whitespace¶
Removes leading whitespace from a string view.
Parameters:
- sv The string view to trim.
Exceptions:
- None.
Return: Trimmed string view with leading whitespace removed.
Since: 0.1
Note: Whitespace includes spaces, tabs, newlines, and carriage returns.
Warning: None.
function rtrim_whitespace¶
Removes trailing whitespace from a string view.
Parameters:
- sv The string view to trim.
Exceptions:
- None.
Return: Trimmed string view with trailing whitespace removed.
Since: 0.1
Note: Whitespace includes spaces, tabs, newlines, and carriage returns.
Warning: None.
function parse_cache_size¶
Parses a cache size string to kilobytes.
Parameters:
- size_str The size string to parse. Supported suffixes: 'K' (kilobytes), 'M' (megabytes), 'G' (gigabytes).
Exceptions:
- None (returns std::nullopt on error).
Return: Size in kilobytes, or std::nullopt if the format is invalid.
Since: 0.1
Warning: Case-sensitive: suffixes must be uppercase.
Converts human-readable cache size strings (e.g., "32K", "1M", "2G") to their equivalent in kilobytes.
function parse_uint32¶
Parses a decimal string to a 32-bit unsigned integer.
Parameters:
- str The string view to parse. Must contain only decimal digits (0-9).
Exceptions:
- None (returns std::nullopt on error).
Return: Parsed value, or std::nullopt if the string is invalid or represents a value exceeding UINT32_MAX.
Since: 0.1
Warning: Does not support sign characters or whitespace.
function parse_hex_uint32¶
Parses a hexadecimal string to a 32-bit unsigned integer.
Parameters:
- str The string view to parse. May include "0x" or "0X" prefix.
Exceptions:
- None (returns std::nullopt on error).
Return: Parsed value, or std::nullopt if the string is invalid or represents a value exceeding UINT32_MAX.
Since: 0.1
Warning: Case-insensitive for hex digits (a-f, A-F).
function read_uint32_file¶
Reads a single uint32_t value from a file.
Parameters:
- path Path to the file to read.
Exceptions:
- None (returns std::nullopt on error).
Return: The parsed value, or std::nullopt if the file cannot be read or contains invalid data.
Since: 0.1
Warning: This function performs file I/O and may fail for various reasons including permission errors and non-existent files.
Reads the entire file content and attempts to parse it as a decimal or hexadecimal unsigned 32-bit integer.
function arm_implementer_to_vendor¶
Converts an ARM implementer ID to a vendor name.
Parameters:
- impl_val The implementer ID (e.g., 0x41 for ARM).
Exceptions:
- None.
Return: Vendor name as a string view, or "Unknown" if the implementer ID is not recognized.
Since: 0.1
Note: Known implementers include: ARM (0x41), Broadcom (0x42), Cavium (0x43), DEC (0x44), Intel (0x69), Qualcomm (0x51), etc.
Maps ARM CPU implementer IDs (hexadecimal values) to their corresponding vendor names.
function getCPUInfo¶
Retrieves basic CPU information with lazy initialization.
Parameters:
- force_refresh If true, forces re-querying CPU information. Default is false.
Exceptions:
- None (error reporting via expected type).
Return: expected<[CPUInfoView](Classes/structcf_1_1CPUInfoView.md), CPUInfoErrorType> containing CPU information on success, or an error type on failure.
Since: 0.1
Note: The returned string views are only valid as long as the internal cache remains unchanged. Callers should not store these views beyond the current query cycle.
Warning: On Windows platforms, this function requires WMI services. Querying may fail if WMI is unavailable or misconfigured.
This function performs lazy initialization on first call and caches the result. Subsequent calls return the cached data unless force_refresh is set to true.
function getCPUBonusInfo¶
Retrieves extended CPU information with lazy initialization.
Parameters:
- force_refresh If true, forces re-querying CPU information. Default is false.
Exceptions:
- None (error reporting via expected type).
Return: expected<[CPUBonusInfoView](Classes/structcf_1_1CPUBonusInfoView.md), CPUBonusInfoViewError> containing extended CPU information on success, or an error type on failure.
Since: 0.1
Note: The returned spans are only valid as long as the internal cache remains unchanged. The temperature field may be std::nullopt if thermal information is unavailable.
Warning: Feature detection is platform-specific. Not all features may be detected on all platforms. big.LITTLE detection requires specific hardware support.
This function performs lazy initialization on first call and caches the result. Subsequent calls return the cached data unless force_refresh is set to true. Some fields may be unavailable depending on platform and hardware support.
function getCPUProfileInfo¶
Retrieves CPU performance information.
Exceptions:
- None (error reporting via expected type).
Return: expected<[CPUProfileInfo](Classes/structcf_1_1CPUProfileInfo.md), CPUProfileInfoError> containing CPU performance data on success, or an error type on failure.
Since: 0.1
Note: CPU usage percentage is calculated since the last query. The first call may return inaccurate values.
Warning: Frequency values may be reported as 0 on platforms where frequency scaling is not available or accessible.
Queries the operating system for current CPU performance metrics including core counts, frequencies, and usage percentage. This function performs a real-time query each time it is called and does not cache results.
function getSystemMemoryInfo¶
Attributes Documentation¶
variable unexpect¶
Global unexpect tag instance.
Updated on 2026-03-09 at 10:14:00 +0000