Skip to content

FunToHard/CPU-Limiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CPU-Limiter

Overview

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.

Features

  • Launches any executable by full path.
  • Caps CPU usage for the process using Windows Job Objects.
  • Simple command-line interface.

Requirements

  • Windows 7 or later
  • MinGW-w64 or MSVC (for compilation)
  • C++17 or later

Building

Open a terminal in the project directory and run:

g++ cpuHandler.cpp -o cpuHandler.exe -static -municode

Or, using MSVC:

cl cpuHandler.cpp

Usage

  1. Run the executable:

    cpuHandler.exe
  2. Enter the full path to the executable you want to launch (e.g., C:\Windows\System32\notepad.exe).

  3. Enter a CPU usage limit (1–100).

  4. The process will start with the specified CPU cap.

  5. Press any key to exit and remove the CPU limit.

Example

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...

Notes

  • 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.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages