CppCommon  1.0.4.1
C++ Common Library
system_cpu.cpp

CPU management example

#include "system/cpu.h"
#include <iostream>
int main(int argc, char** argv)
{
std::cout << "CPU architecture: " << CppCommon::CPU::Architecture() << std::endl;
std::cout << "CPU affinity: " << CppCommon::CPU::Affinity() << std::endl;
std::cout << "CPU logical cores: " << CppCommon::CPU::LogicalCores() << std::endl;
std::cout << "CPU physical cores: " << CppCommon::CPU::PhysicalCores() << std::endl;
std::cout << "CPU clock speed: " << CppCommon::CPU::ClockSpeed() << " Hz" << std::endl;
std::cout << "CPU Hyper-Threading: " << (CppCommon::CPU::HyperThreading() ? "enabled" : "disabled") << std::endl;
return 0;
}
static int LogicalCores()
CPU logical cores count.
Definition: cpu.cpp:114
static bool HyperThreading()
Is CPU Hyper-Threading enabled?
Definition: cpu.cpp:240
static int Affinity()
CPU affinity count.
Definition: cpu.cpp:93
static std::string Architecture()
CPU architecture string.
Definition: cpu.cpp:50
static int PhysicalCores()
CPU physical cores count.
Definition: cpu.cpp:119
static int64_t ClockSpeed()
CPU clock speed in Hz.
Definition: cpu.cpp:197
CPU management definition.