hwinfo provides an easy-to-use and modern C++ API for retrieving hardware information of your systems components such as CPU, RAM, GPU, Disks, Mainboard, ...
Component | Info | Linux | Apple | Windows |
---|---|---|---|---|
CPU | Vendor | ✔️ | ✔️ | ✔️ |
Model | ✔️ | ✔️ | ✔️ | |
Frequency | ✔️ | ✔️ | ✔️ | |
Physical Cores | ✔️ | ✔️ | ✔️ | |
Logical Cores | ✔️ | ✔️ | ✔️ | |
Cache Size | ✔️ | ✔️ | ✔️ | |
GPU | Vendor | ✔️ | ✔️ | ✔️ |
Model | ✔️ | ✔️ | ✔️ | |
Memory Size | ❌ | ❌ | ✔️ | |
Memory (RAM) | Vendor | ❌ | ❌ | ✔️ |
Model | ❌ | ❌ | ✔️ | |
Name | ❌ | ❌ | ✔️ | |
Serial Number | ❌ | ❌ | ✔️ | |
Total Memory Size | ✔️ | ✔️ | ✔️ | |
Free Memory Size | ❌ | ❌ | ❌ | |
Mainboard | Vendor | ✔️ | ❌ | ✔️ |
Model | ✔️ | ❌ | ✔️ | |
Version | ✔️ | ❌ | ✔️ | |
Serial-Number | ❌ | ❌ | ✔️ | |
Bios | ❌ | ❌ | ❌ | |
Disk | Vendor | ✔️ | ❌ | ✔ |
Model | ✔️ | ❌ | ✔ | |
Serial-Number | ❌ | ❌ | ✔ | |
Size | ❌ | ❌ | ❌ | |
Operating System | Name | ✔️ | ✔️ | ✔️ |
Short Name | ✔️ | ✔️ | ✔️ | |
Version | ✔️ | ✔️ | ❌ | |
Kernel | ✔️ | ❌ | ❌ | |
Architecture (Bit) | ✔️ | ✔️ | ✔️ | |
Endianess | ✔️ | ✔️ | ✔️ |
Requirements: git, cmake, c++ compiler (gcc, clang, MSVC)
- Download repository:
git clone https://github.com/lfreist/hwinfo
- Build using cmake:
mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release .. && make -j $(nproc)
See example.cpp
- Download
hwinfo
into your project (e.g. in<project-root>/third_party/hwinfo
)mkdir third_party cd third_party git clone https://github.com/lfreist/hwinfo
- Simply add the following to your
<project-root>/CMakeLists.txt
file:# file: <project-root>/CMakeLists.txt add_subdirectory(third_party/hwinfo) include_directories(third_party/hwinfo/include)
- Include
hwinfo
into your.cpp/.h
files:// file: your_benchmarks.cpp #include "hwinfo/hwinfo.h"
- Link it in cmake
add_executable(your_executable your_executable.cpp) target_link_libraries(your_executable PUBLIC hwinfo::HWinfo)