Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let the user set the chunk-size for CPU limit enforcement #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Screwtapello
Copy link

I wanted to run an old video-game that used a busy-wait for proper timing, but I didn't want to spend gigahertz on a process designed for megahertz. I found your cpulimit tool, and it was almost what I wanted: it slowed things down nicely, but the default chunk-size of 100ms was too much. I could visibly see the game run a little bit, then pause, then run a little bit and pause again.

With this patch, I'm running my game with a chunk-size of 16ms, or about one frame at my monitor's 60Hz refresh rate, and it works beautifully.

With a large chunk-size, the cpulimit command adds very little overhead,
but the CPU usage of the limited process may vary wildly from moment to moment.

With a small chunk-size, the cpulimit command can add significant overhead,
but the CPU usage of the limited process stays very close to the requested
value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant