cpulimit - useful!
Karl Auer
kauer at biplane.com.au
Fri Sep 26 06:36:29 UTC 2014
This is probably very old news for many, but I just found a nifty little
program for the first time: cpulimit.
I convert a lot of video files. A favourite source supplies only .FLV,
but some family members are Apple-bound and require .MOV, so I convert
the videos and store the results on our fileserver. It has annoyed me
for some time that while avconv is running on my system, I am
effectively prevented from doing anything else. The window manager
becomes jerky, freezes for several seconds long, video playback is
unusably jerky and stops for many seconds at a time, or the image loses
sync with the sound. Even the mouse sometimes stops being responsive.
Looking at usage with top, I see that avconv is using 150% of the CPU,
sometimes more.
Finally it all got too much and I went looking for a solution - and
found cpulimit.
This delightfully simple little program lets you specify a process name
or ID, and what percentage of processor power it is allowed to use.
I ran it on avconv, and avconv is now running (albeit slowly) in the
background, while everything else (including me) keeps working. The
really cool thing is that it applies to anything called avconv, for as
long as it (cpulimit) is running - so even though my batch conversion
script kicks off many copies of avconv (sequentially), all of them are
tamed by one instance of cpulimit:
sudo cpulimit -e aconv 45
It doesn't seem clever enough to handle multiple simultaneous instances.
When I started a second instance of avconv, it quickly ran up to 110% -
while the first instance remained around 45%. Possibly in such cases the
specific PIDs need to be controlled. But it's still very useful.
Highly recommended!
Regards, K.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
http://twitter.com/kauer389
GPG fingerprint: EC67 61E2 C2F6 EB55 884B E129 072B 0AF0 72AA 9882
Old fingerprint: B862 FB15 FE96 4961 BC62 1A40 6239 1208 9865 5F9A
More information about the ubuntu-users
mailing list