A windows GUI application for managing CPU affinity of processes. This tool allows you to control which CPU cores your applications run on, helping to optimize performance, manage resource allocation, and improve system responsiveness.
LINUX PLATFORM - WIP!
- CPU Core Group Management: Create and manage groups of CPU cores for different applications
- Process Affinity Control: Launch applications with specific CPU core affinities
- Process Monitoring: Track running processes launched through the tool
- Settings Enforcement: Automatically restore CPU affinity and priority settings if processes change them
- Autorun Support: Configure applications to automatically start with specific CPU affinities
- Priority Control: Set process priority when launching applications
- Theme Support: Choose between light, dark, and default themes
- Drag & Drop: Easily add applications by dragging files into the interface
- Cross-Platform: Supports both Windows and Linux (Windows implementation is more complete)
- Performance Optimization: Isolate CPU-intensive applications to specific cores
- Gaming Performance: Dedicate cores to games for more consistent frame rates
- Background Tasks: Assign background processes to specific cores to prevent them from interfering with foreground applications
- Testing & Development: Test application performance with different core configurations
- System Responsiveness: Keep UI and critical applications responsive by isolating them from heavy workloads
- Rust toolchain (rustc, cargo)
- For Windows: Windows 10/11 with Visual Studio build tools
- For Linux: X11 development libraries
You can download the latest prebuilt binaries from the Releases page.
-
Clone the repository:
git clone https://github.com/yourusername/cpu-affinity-tool.git cd cpu-affinity-tool -
Build the application:
cargo build --release -
The compiled binary will be available in
target/release/:- Windows:
cpu-affinity-tool.exe - Linux:
cpu-affinity-tool-linux
- Windows:
- Launch the application
- Create a CPU core group by clicking the "+" button
- Name your group and select the CPU cores to include
- Add applications to the group by clicking "Add App" or dragging files into the window
- Launch applications with the specified CPU affinity by clicking the "Run" button
- Click the "+" button to create a new group
- Enter a name for the group
- Select the CPU cores to include in the group
- Optionally enable the "Run All" button for the group
- Click "Create" to save the group
- Select a group from the list
- Click "Add App" or drag a file into the window
- Configure the application settings:
- Binary path: Path to the executable
- Arguments: Command-line arguments for the application
- Priority: Process priority
- Autorun: Whether to automatically start the application when the tool launches
- Click "Save" to add the application to the group
- Click the "Run" button next to an application to launch it with the specified CPU affinity
- If an application is already running, the tool will focus its window
- Use the "Run All" button (if enabled) to launch all applications in a group
The tool includes a feature to monitor running processes and ensure they maintain their assigned CPU affinity and priority settings:
- Toggle the monitoring feature using the button in the footer
- When enabled, the tool will:
- Monitor all running processes launched through the tool, including child processes
- Check if processes have changed their CPU affinity or priority settings
- Automatically restore the original settings if they've been changed
- The monitoring status is displayed in the footer
- This feature is useful for applications that might change their own CPU affinity or priority during execution
The application stores its configuration in state.json in the application directory. This file contains:
- Core groups
- Application settings
- UI preferences
- Process monitoring state
- State version information
The application implements a robust state migration mechanism that ensures backward compatibility when the application is updated:
- Version Tracking: Each state file includes a version number that identifies its schema
- Automatic Migration: When loading a state file with an older version, the application automatically migrates it to the current format
- Data Preservation: User data (groups, applications, settings) is preserved during migration
- Legacy Support: The application can load state files from versions that don't include version information
This approach ensures that users never lose their configuration or settings when updating to a new version of the application, even if the internal data structure changes significantly.
- eframe/egui: GUI framework
- tokio: Asynchronous runtime
- num_cpus: CPU core detection
- serde: Serialization/deserialization
- windows: Windows API bindings
This project is licensed under a Non-Commercial Use License. You may use this software for non-commercial purposes only. For any commercial use, you must contact the author for explicit permission and licensing terms. See the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
This project uses GitHub Actions for continuous integration and deployment:
-
Continuous Integration (CI): All pull requests and commits to the main branch are automatically checked for:
- Code formatting (rustfmt)
- Code quality (clippy)
- Passing tests
-
Continuous Deployment (CD): When a new version tag (e.g.,
v1.0.0) is pushed, GitHub Actions automatically:- Runs all checks and tests
- Builds Windows binaries (Linux support coming later)
- Creates a GitHub Release with the binaries attached
- Generates release notes
To create a new release:
- Update the version in
Cargo.toml - Commit the changes:
git commit -am "Bump version to X.Y.Z" - Create and push a new tag:
git tag vX.Y.Z git push origin vX.Y.Z - GitHub Actions will automatically build and publish the release
Future plans for the application include:
- Resource monitoring for running processes
- Better administrator mode support
- Enhanced process priority management
