CPU-limiter is a simple C++ utility for Windows that launches a process and applies a CPU usage cap using Windows Job Objects. You specify the executable to run and set a CPU usage limit (1–100%). The program then starts the process and restricts its CPU consumption accordingly.
- Launches any executable by full path.
- Caps CPU usage for the process using Windows Job Objects.
- Simple command-line interface.
- Windows 7 or later
- MinGW-w64 or MSVC (for compilation)
- C++17 or later
Open a terminal in the project directory and run:
g++ cpuHandler.cpp -o cpuHandler.exe -static -municodeOr, using MSVC:
cl cpuHandler.cpp-
Run the executable:
cpuHandler.exe
-
Enter the full path to the executable you want to launch (e.g.,
C:\Windows\System32\notepad.exe). -
Enter a CPU usage limit (1–100).
-
The process will start with the specified CPU cap.
-
Press any key to exit and remove the CPU limit.
Enter full path to executable: C:\Windows\System32\notepad.exe
Process created successfully, PID: 12345
Enter process limit (1-100): 20
CPU usage capped at 20%
Press any key to exit CPU limiting...
- The CPU cap is enforced using Windows Job Objects. Some processes may not respect the limit perfectly.
- Administrator privileges may be required for certain executables.
MIT