Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
kcenon::thread::platform Namespace Reference

Classes

struct  system_info
 System information structure. More...
 

Enumerations

enum class  cpu_architecture { x86 , x86_64 , arm64 , unknown }
 CPU architecture enumeration. More...
 
enum class  os_type { windows , macos , linux_os , unknown }
 Operating system enumeration. More...
 

Functions

cpu_architecture get_architecture () noexcept
 Get current CPU architecture.
 
os_type get_os () noexcept
 Get current operating system.
 
bool is_arm64 () noexcept
 Check if running on ARM64 architecture.
 
uint32_t get_physical_core_count () noexcept
 Get physical core count.
 
uint32_t get_logical_core_count () noexcept
 Get logical core count.
 
bool is_container_environment () noexcept
 Check if running in container environment.
 
bool has_efficiency_cores () noexcept
 Check if system has efficiency cores (Apple Silicon)
 
system_info get_system_info () noexcept
 Get comprehensive system information.
 
const char * get_platform_name () noexcept
 Get platform name string.
 
const char * get_arch_name () noexcept
 Get architecture name string.
 

Enumeration Type Documentation

◆ cpu_architecture

CPU architecture enumeration.

Enumerator
x86 
x86_64 
arm64 
unknown 

Definition at line 61 of file platform_detection.h.

◆ os_type

Operating system enumeration.

Enumerator
windows 
macos 
linux_os 
unknown 

Definition at line 71 of file platform_detection.h.

Function Documentation

◆ get_arch_name()

const char * kcenon::thread::platform::get_arch_name ( )
inlinenoexcept

Get architecture name string.

Definition at line 199 of file platform_detection.h.

199 {
201}
#define THREAD_SYSTEM_ARCH_NAME

References THREAD_SYSTEM_ARCH_NAME.

◆ get_architecture()

cpu_architecture kcenon::thread::platform::get_architecture ( )
inlinenoexcept

Get current CPU architecture.

Definition at line 95 of file platform_detection.h.

95 {
96#if defined(THREAD_SYSTEM_ARCH_X64)
97 return cpu_architecture::x86_64;
98#elif defined(THREAD_SYSTEM_ARCH_ARM64)
99 return cpu_architecture::arm64;
100#elif defined(THREAD_SYSTEM_ARCH_X86)
101 return cpu_architecture::x86;
102#else
103 return cpu_architecture::unknown;
104#endif
105}

References arm64, unknown, x86, and x86_64.

Referenced by get_system_info().

Here is the caller graph for this function:

◆ get_logical_core_count()

uint32_t kcenon::thread::platform::get_logical_core_count ( )
inlinenoexcept

Get logical core count.

Definition at line 145 of file platform_detection.h.

145 {
146 return static_cast<uint32_t>(std::thread::hardware_concurrency());
147}

Referenced by get_system_info().

Here is the caller graph for this function:

◆ get_os()

os_type kcenon::thread::platform::get_os ( )
inlinenoexcept

Get current operating system.

Definition at line 110 of file platform_detection.h.

110 {
111#if defined(THREAD_SYSTEM_WINDOWS)
112 return os_type::windows;
113#elif defined(THREAD_SYSTEM_MACOS)
114 return os_type::macos;
115#elif defined(THREAD_SYSTEM_LINUX)
116 return os_type::linux_os;
117#else
118 return os_type::unknown;
119#endif
120}

References linux_os, macos, unknown, and windows.

Referenced by get_system_info().

Here is the caller graph for this function:

◆ get_physical_core_count()

uint32_t kcenon::thread::platform::get_physical_core_count ( )
inlinenoexcept

Get physical core count.

Definition at line 136 of file platform_detection.h.

136 {
137 // std::thread::hardware_concurrency returns logical cores
138 // For physical cores, platform-specific implementation needed
139 return static_cast<uint32_t>(std::thread::hardware_concurrency());
140}

Referenced by get_system_info().

Here is the caller graph for this function:

◆ get_platform_name()

const char * kcenon::thread::platform::get_platform_name ( )
inlinenoexcept

Get platform name string.

Definition at line 192 of file platform_detection.h.

192 {
194}
#define THREAD_SYSTEM_PLATFORM_NAME

References THREAD_SYSTEM_PLATFORM_NAME.

◆ get_system_info()

system_info kcenon::thread::platform::get_system_info ( )
inlinenoexcept

Get comprehensive system information.

Definition at line 176 of file platform_detection.h.

176 {
178 info.os = get_os();
179 info.arch = get_architecture();
180 info.physical_cores = get_physical_core_count();
181 info.logical_cores = get_logical_core_count();
182 info.efficiency_cores = 0; // Platform-specific
183 info.is_container = is_container_environment();
184 info.is_arm64 = is_arm64();
185 info.has_efficiency_cores = has_efficiency_cores();
186 return info;
187}
@ info
Informational messages highlighting progress.
System information structure.

References get_architecture(), get_logical_core_count(), get_os(), get_physical_core_count(), has_efficiency_cores(), kcenon::thread::info, is_arm64(), is_container_environment(), and kcenon::thread::platform::system_info::os.

Here is the call graph for this function:

◆ has_efficiency_cores()

bool kcenon::thread::platform::has_efficiency_cores ( )
inlinenoexcept

Check if system has efficiency cores (Apple Silicon)

Definition at line 165 of file platform_detection.h.

165 {
166#if defined(THREAD_SYSTEM_HAS_EFFICIENCY_CORES)
167 return true;
168#else
169 return false;
170#endif
171}

Referenced by get_system_info().

Here is the caller graph for this function:

◆ is_arm64()

bool kcenon::thread::platform::is_arm64 ( )
inlinenoexcept

Check if running on ARM64 architecture.

Definition at line 125 of file platform_detection.h.

125 {
126#if defined(THREAD_SYSTEM_ARCH_ARM64)
127 return true;
128#else
129 return false;
130#endif
131}

Referenced by get_system_info().

Here is the caller graph for this function:

◆ is_container_environment()

bool kcenon::thread::platform::is_container_environment ( )
inlinenoexcept

Check if running in container environment.

Definition at line 152 of file platform_detection.h.

152 {
153#if defined(THREAD_SYSTEM_LINUX)
154 // Check for common container indicators
155 // This is a simplified check; production code should be more thorough
156 return false; // Would check /proc/1/cgroup in real implementation
157#else
158 return false;
159#endif
160}

Referenced by get_system_info().

Here is the caller graph for this function: