A comprehensive C++ system stress testing tool that performs simultaneous CPU and memory stress testing with real-time monitoring and colorized console output.
- Multi-threaded CPU stress testing with hash-intensive operations
- Memory stress testing with configurable allocation targets
- Real-time progress monitoring with visual progress bars
- Cross-platform support (Windows and Unix-like systems)
- Colorized console output for better visibility
- Automatic CPU core detection and utilization
- Thread-safe operations with proper synchronization
The tool displays real-time progress with:
- Time progress bar showing test duration
- Memory allocation progress with current usage
- Hash operations counter
- Colorized status messages
- C++17 compatible compiler
- CMake 3.10 or higher
- Threading support (pthread on Unix, native threads on Windows)
- Windows: Visual Studio 2017+ or MinGW-w64
- Linux/macOS: GCC 7+ or Clang 5+
If you have Nix installed, simply run:
nix-shellThis will automatically:
- Set up the build environment
- Create the build directory
- Run CMake and compile the project
- Generate the executable in the
builddirectory
-
Clone the repository:
git clone <repository-url> cd SystemStressTest
-
Create build directory:
mkdir build cd build -
Configure with CMake:
cmake ..
-
Build the project:
make
Run the executable from the build directory:
./SystemStressTestThe program will:
- Display a warning about system stress testing
- Prompt for confirmation to continue
- Detect available CPU cores
- Run stress tests for 30 seconds (configurable)
- Display real-time progress and metrics
- Show final test results
Key parameters can be modified in include/MemoryStressTest.hpp for memory :
static constexpr int MULTIPLIER = 2; // Memory multiplier for stress test (resulting in a 2 GB Max Allocation)
static constexpr int TEST_DURATION = 30; // seconds
static constexpr size_t TARGET_MEMORY = 1024 * 1024 * 1024; // 1 GB
// Memory bandwidth measurement constants
static constexpr size_t BANDWIDTH_TEST_SIZE = 64 * 1024 * 1024; // 64MB test buffer
static constexpr int BANDWIDTH_ITERATIONS = 5; // Number of iterations for averaging
the icons are present because I use eza project set it up if you want them too
$ eza --color=always --group-directories-first --long --git --icons=always --links -a --tree --ignore-glob="*.log|*.tmp|.git|profiling|build"
.
├── .vscode
│ └── settings.json
├── flamegraphs
│ ├── calls_flamegraph.svg
│ ├── cpu_flamegraph.svg
│ └── memory_flamegraph.svg
├── include
│ ├── ConsoleColors.hpp
│ ├── ConsoleInitializer.hpp
│ ├── CPUStressTest.hpp
│ ├── LinkedList.hpp
│ ├── MemoryStressTest.hpp
│ └── TimeManager.hpp
├── Scripts
│ ├── build_profiling.sh
│ ├── build_release.sh
│ ├── kernel_security_bypass.sh
│ └── profile.sh
├── src
│ ├── ConsoleInitializer.cpp
│ ├── CPUStressTest.cpp
│ ├── main.cpp
│ ├── MemoryStressTest.cpp
│ └── TimeManager.cpp
├── tests
│ ├── test_cpustresstest.cpp
│ ├── test_linkedlist.cpp
│ ├── test_memorystresstest.cpp
│ └── test_timemanager.cpp
├── .gitattributes
├── .gitignore
├── CMakeLists.txt
├── LICENSE
├── README.md
└── shell.nix- Uses compute-intensive hash-like operations
- Spawns one thread per CPU core
- Performs batched operations for efficiency
- Uses atomic counters for thread-safe operation tracking
- Allocates memory in 1MB blocks
- Uses custom linked list for memory management
- Employs RAII principles with smart pointers
- Handles allocation failures gracefully
| Library | Purpose |
|---|---|
<iostream> |
Console I/O operations |
<mutex> |
Thread synchronization |
<vector> |
Dynamic memory containers |
<thread> |
Multi-threading support |
<chrono> |
Time measurement |
<atomic> |
Thread-safe variables |
- Windows: Uses Windows API for console initialization and UTF-8 support
- Unix-like systems: Uses ANSI escape sequences for colors and formatting
- Thread management: Uses C++11 standard threading library
- Memory allocation limits to prevent system crashes
- Graceful error handling for allocation failures
- Thread-safe console output with mutex protection
- Controlled test duration to prevent indefinite stress
The tool tracks and displays:
- Hash operations per second: Measures CPU performance
- Memory allocation rate: Tracks memory subsystem performance
- Real-time progress: Visual feedback during testing
- Resource utilization: Shows CPU cores and memory usage
-
Build fails on Windows:
- Ensure you have Visual Studio Build Tools installed
- Use Developer Command Prompt for VS
-
Colors not displaying:
- On Windows, ensure you're using Windows 10 version 1607 or later
- Try running from Windows Terminal instead of cmd.exe
-
Memory allocation errors:
- Reduce the
MULTIPLIERvalue in the header file - Ensure sufficient system memory is available
- Reduce the
- High memory usage: This is intentional for stress testing
- CPU temperature: Monitor system temperature during extended use
- System responsiveness: Close other applications for accurate testing
- Fork the repository
- Create a feature branch
- Make your changes
- Ensure code follows the existing style
- Add appropriate comments and documentation
- Test on multiple platforms if possible
- Submit a pull request
This project is open source. Please refer to the license file for details.
- Built with modern C++17 features
- Uses standard library threading and atomic operations
- Inspired by system benchmarking and stress testing tools
Warning: This tool is designed to stress your system. Use responsibly and monitor system temperature and stability during testing.