qb  2.0.0.0
C++17 Actor Framework
qb Issue Watch Star Fork Follow @isndev
Loading...
Searching...
No Matches
qb::CPU Class Reference

Provides platform-independent access to CPU information. More...

#include <cpu.h>

Public Member Functions

 CPU (const CPU &)=delete
 CPU (CPU &&) noexcept=delete
CPUoperator= (const CPU &)=delete
CPUoperator= (CPU &&) noexcept=delete

Static Public Member Functions

static std::string Architecture ()
 Gets the CPU architecture name/description.
static int Affinity ()
 Gets the number of logical processors available to the process.
static int LogicalCores ()
 Gets the number of logical CPU cores.
static int PhysicalCores ()
 Gets the number of physical CPU cores.
static std::pair< int, int > TotalCores ()
 Gets both logical and physical core counts.
static int64_t ClockSpeed ()
 Gets the CPU clock speed in Hz.
static bool HyperThreading ()
 Checks if hyperthreading is enabled.

Detailed Description

Provides platform-independent access to CPU information.

This class contains static methods to query CPU information such as architecture, logical/physical core counts, clock speed, and more.

Member Function Documentation

◆ Architecture()

std::string qb::CPU::Architecture ( )
inlinestatic

Gets the CPU architecture name/description.

Returns
CPU architecture or model name as a string

◆ Affinity()

int qb::CPU::Affinity ( )
inlinestatic

Gets the number of logical processors available to the process.

Returns
Number of logical processors

◆ LogicalCores()

int qb::CPU::LogicalCores ( )
inlinestatic

Gets the number of logical CPU cores.

Returns
Number of logical cores

◆ PhysicalCores()

int qb::CPU::PhysicalCores ( )
inlinestatic

Gets the number of physical CPU cores.

Returns
Number of physical cores

◆ TotalCores()

std::pair< int, int > qb::CPU::TotalCores ( )
inlinestatic

Gets both logical and physical core counts.

Returns
Pair of (logical cores, physical cores)

◆ ClockSpeed()

int64_t qb::CPU::ClockSpeed ( )
inlinestatic

Gets the CPU clock speed in Hz.

Returns
CPU frequency in Hz, or -1 if unavailable

◆ HyperThreading()

bool qb::CPU::HyperThreading ( )
inlinestatic

Checks if hyperthreading is enabled.

Returns
true if hyperthreading is enabled, false otherwise