LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-28-2023, 06:31 PM   #1
lucmove
Senior Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian
Posts: 1,434

Rep: Reputation: 110Reputation: 110
Can I throttle down a process?


I am specifically concerned with converting videos with ffmpeg. My machine gets too hot and I get too worried. I don't mind if it takes longer as soon as it goes easier on my hardware. I tried nice, but it didn't seem to make any difference. Any suggestions?
 
Old 07-28-2023, 09:18 PM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,141
Blog Entries: 6

Rep: Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828
Yup. Look at cpupower

On all of my machines passed 4th gen, I throttle down the CPU to encode videos with ffmpeg. I'm not about to let my processor run at 180F (82C) for 30-40 min.

I have an i7 4790 for example, it has air cooling, a normal heat sink, with a normal cooling fan on it. It will run at burst speed, which is 4GHZ while encoding video with ffmpeg. That's too fast/hot for it. I bump it down to 3.2-3.4 GHz. while encoding. Depends on the time of year, but that will keep it at or under 135F (57C).

I need my machines to last for a while. And, that will of course drop your fps output as much as 10-15 fps.

Edit:
Just make a menu item/items for
Code:
cpupower frequency-set -u 3200MHz

Last edited by teckk; 07-28-2023 at 09:21 PM.
 
1 members found this post helpful.
Old 07-29-2023, 03:52 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,910

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
nice will lower the priority of the process, but will not slow it down.
here is another solution/way: https://unix.stackexchange.com/quest...pu-temperature
 
1 members found this post helpful.
Old 07-29-2023, 06:38 AM   #4
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,615

Rep: Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554Reputation: 2554

My BIOS has an option for setting the level at which the CPU starts throttling to keep temperature down.

I would hate to have to remember to do it for individual processes.

 
Old 07-29-2023, 07:26 AM   #5
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,141
Blog Entries: 6

Rep: Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828
You can look at them to see how they work.

https://github.com/deinstapel/cpupower
https://github.com/opsengine/cpulimit
 
1 members found this post helpful.
Old 07-29-2023, 05:53 PM   #6
lucmove
Senior Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian
Posts: 1,434

Original Poster
Rep: Reputation: 110Reputation: 110
cpulimit seems to work well. The task becomes noticeably slower, but the CPU won't heat up anymore.

It's interesting to note that there is some difference in speed but very little difference in temperature between 40% and 99%. At 100% the temperature spikes a little occasionally, but still not much, so I suppose 99% is some kind of sweet spot.

I am marking this as SOLVED. My only nag is that I have to run 'ffmpeg' on a terminal and 'cpulimit -e ffmpeg -l 99' on another. Is there some clever way of doing the two things with a one simple one liner?
 
Old 07-29-2023, 06:21 PM   #7
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,129
Blog Entries: 2

Rep: Reputation: 260Reputation: 260Reputation: 260
What CPU do you have? A desktop is easier to maintain low temps without sacrificing performance. I had a OC'd 4790K with a Noctua NH-D15. That cooler was enough to keep temps in check.

My last Intel laptop had a 4710MQ. Being an older laptop, it would thermal throttle under almost any load. After fresh thermal paste, and using a program called intel-undervolt, I was able to keep the CPU from throttling, even with consistent load like mprime (prime 95).
 
Old 07-29-2023, 08:23 PM   #8
lucmove
Senior Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian
Posts: 1,434

Original Poster
Rep: Reputation: 110Reputation: 110
It's an eight-year-old i5 desktop.
 
Old 07-29-2023, 10:45 PM   #9
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,235

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Cgroups? Probably overkill, but here's one link:

https://andywine.dev/constrain-proce...-with-cgroups/.
 
1 members found this post helpful.
Old 07-31-2023, 12:04 AM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
A simple script (untested) to combine the 2 cmds
Code:
ffmpeg .... &
ffm_pid=$!        # The $! variable is a special shell variable that stores the PID of the most recently executed background process. 
cpulimit -e ffmpeg -l $ffm_pid
Strictly speaking you could insert the '$!' directly into the last cmd instead, but I really like properly named vars ...
 
2 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to throttle a single process? Dria Linux - Software 3 03-02-2007 07:48 PM
Anyone heard of a way to throttle httpd apache? tarakian Linux - Networking 1 07-10-2003 12:45 PM
How to use QoS to throttle outgoing traffic? Electrode Linux - Networking 3 06-13-2003 07:46 AM
does the red hat network throttle bandwidth by user? BrianK Linux - General 2 10-02-2002 06:07 AM
How To throttle Pop3?? Andrea Linux - Networking 3 07-21-2001 01:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration