Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #256876 > unrolled thread
| Started by | songbird <songbird@anthive.com> |
|---|---|
| First post | 2023-04-08 16:20 +0200 |
| Last post | 2023-04-10 04:20 +0200 |
| Articles | 12 on this page of 32 — 17 participants |
Back to article view | Back to linux.debian.user
how to limit a CPU temperature? songbird <songbird@anthive.com> - 2023-04-08 16:20 +0200
Re: how to limit a CPU temperature? songbird <songbird@anthive.com> - 2023-04-08 16:30 +0200
Re: how to limit a CPU temperature? "tv.debian" <tv.debian@googlemail.com> - 2023-04-08 16:50 +0200
Re: how to limit a CPU temperature? songbird <songbird@anthive.com> - 2023-04-08 18:00 +0200
Re: how to limit a CPU temperature? "Andrew M.A. Cater" <amacater@einval.com> - 2023-04-08 18:20 +0200
Re: how to limit a CPU temperature? songbird <songbird@anthive.com> - 2023-04-08 20:40 +0200
Re: how to limit a CPU temperature? "Jeremy Nicoll" <jn.ml.dbi.73@letterboxes.org> - 2023-04-08 17:00 +0200
Re: how to limit a CPU temperature? davidson <davidson@freevolt.org> - 2023-04-08 17:20 +0200
Re: how to limit a CPU temperature? songbird <songbird@anthive.com> - 2023-04-08 17:50 +0200
Re: how to limit a CPU temperature? songbird <songbird@anthive.com> - 2023-04-08 18:10 +0200
Re: how to limit a CPU temperature? Vincent Lefevre <vincent@vinc17.net> - 2023-04-13 16:30 +0200
Re: how to limit a CPU temperature? songbird <songbird@anthive.com> - 2023-04-11 02:20 +0200
Re: how to limit a CPU temperature? Max Nikulin <manikulin@gmail.com> - 2023-04-11 03:30 +0200
Re: how to limit a CPU temperature? tom@myposts.ovh - 2023-04-08 16:30 +0200
Re: how to limit a CPU temperature? songbird <songbird@anthive.com> - 2023-04-08 18:10 +0200
Re: how to limit a CPU temperature? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 17:20 +0200
Re: how to limit a CPU temperature? songbird <songbird@anthive.com> - 2023-04-08 18:00 +0200
Re: how to limit a CPU temperature? "Jeremy Nicoll" <jn.ml.dbi.73@letterboxes.org> - 2023-04-08 18:10 +0200
[OFFTOPIC] Re: how to limit a CPU temperature? Stefan Monnier <monnier@iro.umontreal.ca> - 2023-04-08 19:00 +0200
Re: [OFFTOPIC] Re: how to limit a CPU temperature? Emanuel Berg <incal@dataswamp.org> - 2023-04-08 19:20 +0200
the front (was: " Re: [OFFTOPIC] Re: how to limit a CPU temperature?") Emanuel Berg <incal@dataswamp.org> - 2023-04-08 19:30 +0200
Re: the front (was: " Re: [OFFTOPIC] Re: how to limit a CPU temperature?") Jeffrey Walton <noloader@gmail.com> - 2023-04-08 20:00 +0200
Re: the front (was: " Re: [OFFTOPIC] Re: how to limit a CPU temperature?") Emanuel Berg <incal@dataswamp.org> - 2023-04-08 20:10 +0200
Re: [OFFTOPIC] Re: how to limit a CPU temperature? Jeremy Ardley <jeremy@ardley.org> - 2023-04-09 01:00 +0200
Re: how to limit a CPU temperature? Tixy <tixy@yxit.co.uk> - 2023-04-08 22:10 +0200
Re: how to limit a CPU temperature? Ash Joubert <ash@transient.nz> - 2023-04-09 02:30 +0200
Re: how to limit a CPU temperature? David Christensen <dpchrist@holgerdanske.com> - 2023-04-09 03:10 +0200
Re: how to limit a CPU temperature? Mark Allums <maa@allums.com> - 2023-04-09 05:20 +0200
Re: how to limit a CPU temperature? David Christensen <dpchrist@holgerdanske.com> - 2023-04-10 01:50 +0200
Re: how to limit a CPU temperature? Darac Marjal <mailinglist@darac.org.uk> - 2023-04-09 14:30 +0200
Re: how to limit a CPU temperature? Emanuel Berg <incal@dataswamp.org> - 2023-04-09 14:40 +0200
Re: how to limit a CPU temperature? David Christensen <dpchrist@holgerdanske.com> - 2023-04-10 04:20 +0200
Page 2 of 2 — ← Prev page 1 [2]
| From | Emanuel Berg <incal@dataswamp.org> |
|---|---|
| Date | 2023-04-08 19:30 +0200 |
| Subject | the front (was: " Re: [OFFTOPIC] Re: how to limit a CPU temperature?") |
| Message-ID | <GikxX-FRK-1@gated-at.bofh.it> |
| In reply to | #256912 |
>> I recommend to go fanless whenever possible. >> Computers should be silent. > > Yeah, optimally ... What would happen, if we started a political movement based on nationalism and Unix? What would be the first thing we would do when we get installed as government? Maybe close the border or something and I mean that virtually as well. -- underground experts united https://dataswamp.org/~incal
[toc] | [prev] | [next] | [standalone]
| From | Jeffrey Walton <noloader@gmail.com> |
|---|---|
| Date | 2023-04-08 20:00 +0200 |
| Subject | Re: the front (was: " Re: [OFFTOPIC] Re: how to limit a CPU temperature?") |
| Message-ID | <Gil0Z-G1T-1@gated-at.bofh.it> |
| In reply to | #256913 |
On Sat, Apr 8, 2023 at 1:29 PM Emanuel Berg <incal@dataswamp.org> wrote: > > >> I recommend to go fanless whenever possible. > >> Computers should be silent. > > > > Yeah, optimally ... > > What would happen, if we started a political movement based on > nationalism and Unix? > > What would be the first thing we would do when we get > installed as government? Annex the Netherlands, and take control of ASML. Annex Taiwan, and take control of TSMC. > Maybe close the border or something and I mean that virtually > as well. Jeff
[toc] | [prev] | [next] | [standalone]
| From | Emanuel Berg <incal@dataswamp.org> |
|---|---|
| Date | 2023-04-08 20:10 +0200 |
| Subject | Re: the front (was: " Re: [OFFTOPIC] Re: how to limit a CPU temperature?") |
| Message-ID | <GilaF-Gms-3@gated-at.bofh.it> |
| In reply to | #256915 |
Jeffrey Walton wrote: >> What would happen, if we started a political movement based >> on nationalism and Unix? >> >> What would be the first thing we would do when we get >> installed as government? > > Annex the Netherlands, and take control of ASML. > Annex Taiwan, and take control of TSMC. I agree! And after that? Korea and Japan maybe? -- underground experts united https://dataswamp.org/~incal
[toc] | [prev] | [next] | [standalone]
| From | Jeremy Ardley <jeremy@ardley.org> |
|---|---|
| Date | 2023-04-09 01:00 +0200 |
| Subject | Re: [OFFTOPIC] Re: how to limit a CPU temperature? |
| Message-ID | <GipHj-IVW-3@gated-at.bofh.it> |
| In reply to | #256911 |
On 9/4/23 00:56, Stefan Monnier wrote: > > I recommend to go fanless whenever possible. > Computers should be silent. > > I have a fanless ARM router that even in high summer has no thermal problems (I am in Australia and I have no aircon). It does have a massive case bonded to the CPU I also have a mini ARM server that does have a fan but the O/S (Armbian) omitted to give it any fan controller so I wrote my own fan control service. Based on CPU temperature I am able to switch the fan off or on and set various operating speeds. The great disappointment is that all through this recent summer it only got warm enough once to switch the fan on and then for a few seconds. The fan turn on temperature was 65C on the CPU. That needed room temperature of 35C. On a slightly different topic my desktop is a Ryzen 5. It has fanless graphics and large case PSU and CPU fans. I can hear when it starts doing work (usually Chrome is the culprit). It's the PSU electronics that make very high frequency noise that increases with load. The fans only kick in later. -- Jeremy (Lists)
[toc] | [prev] | [next] | [standalone]
| From | Tixy <tixy@yxit.co.uk> |
|---|---|
| Date | 2023-04-08 22:10 +0200 |
| Message-ID | <Gin2N-Hva-9@gated-at.bofh.it> |
| In reply to | #256876 |
On Sat, 2023-04-08 at 10:17 -0400, songbird wrote: > > i have an intel processor and it has the MAX which does > prevent it from going higher (100C), but i'd like to keep it > at 70C or lower. > > i've been trying to find anything that will let me set this > but no luck yet in my searches. I installed 'thermald' to stop my CPUs hitting the max junction temperature and hard resetting after a few minutes. I was quite surprised that the standard kernel doesn't actually have thermal protection which throttles CPU clocks and requires an external userspace program to do this. -- Tixy
[toc] | [prev] | [next] | [standalone]
| From | Ash Joubert <ash@transient.nz> |
|---|---|
| Date | 2023-04-09 02:30 +0200 |
| Message-ID | <Gir6p-JTf-1@gated-at.bofh.it> |
| In reply to | #256876 |
On 09/04/2023 02:17, songbird wrote:
> i have an intel processor and it has the MAX which does
> prevent it from going higher (100C), but i'd like to keep it
> at 70C or lower.
I recommend thermald, which I use to limit my fanless 65 W i7-7700 CPU
to 80°C, passively cooled with heat pipes connected to a heat sink on
the side of a Streacom FC8 Alpha case. I use the xfce4-sensors-plugin to
monitor CPU package temperatures and thermald seems to do the job. My
config:
$ cat /etc/thermald/thermal-conf.xml
<?xml version="1.0"?>
<ThermalConfiguration>
<Platform>
<Name>Passive control of CPU temperature</Name>
<ProductName>*</ProductName>
<Preference>QUIET</Preference>
<ThermalZones>
<ThermalZone>
<Type>cpu</Type>
<TripPoints>
<TripPoint>
<Temperature>80000</Temperature>
<type>passive</type>
</TripPoint>
</TripPoints>
</ThermalZone>
</ThermalZones>
</Platform>
</ThermalConfiguration>
I also mask thermald.service and use a custom thermald-custom.service to
decrease thermald polling interval to one second because a lot can
happen in the default polling interval of three seconds (IIRC). I use a
custom service so it survives upgrades (last time I checked, polling
interval was not a configuration option as it should be). This service
file is based on thermald.service from several years ago and it might
need to be refreshed from current thermald.service. You can add the
"--loglevel=debug" option to ExecStart to watch it in action with
"journalctl -f" but it will flood your logs if debug logging is left
enabled:
$ cat /lib/systemd/system/thermald-custom.service
[Unit]
Description=Thermal Daemon Service
[Service]
Type=dbus
SuccessExitStatus=1
BusName=org.freedesktop.thermald
ExecStart=/usr/sbin/thermald --no-daemon --dbus-enable --poll-interval=1
# --loglevel=debug
[Install]
WantedBy=multi-user.target
Alias=dbus-org.freedesktop.thermald.service
Kind regards,
--
Ash Joubert (they/them) <ash@transient.nz>
Director / Game Developer
Transient Software Limited <https://transient.nz/>
New Zealand
[toc] | [prev] | [next] | [standalone]
| From | David Christensen <dpchrist@holgerdanske.com> |
|---|---|
| Date | 2023-04-09 03:10 +0200 |
| Message-ID | <GirJ7-Klc-1@gated-at.bofh.it> |
| In reply to | #256876 |
On 4/8/23 07:17, songbird wrote:
> i have a program that has changed it's behavior to suddenly
> become a CPU hog (while doing something simple like uploading
> files for my website). probably a bug, but it got me to
> wondering how i could limit the CPU temperature to a range
> well below the maximum that kicks in by the CPU itself.
>
> i have an intel processor and it has the MAX which does
> prevent it from going higher (100C), but i'd like to keep it
> at 70C or lower.
>
> i've been trying to find anything that will let me set this
> but no luck yet in my searches.
>
> thanks! :)
>
>
> songbird
Assuming the computer had a proper thermal solution when assembled, the
100 C processor temperature indicates that the thermal paste between the
processor and its heat sink has gone bad. I suggest replacing it with
silver-based thermal paste.
As for adjusting the processor with Debian and Linux, in the past I used:
cpufrequtils
cpufreq-info(1) prints information (Dell Precision 3630 with an Intel
Xeon E-2174G processor):
2023-04-08 15:52:47 root@taz ~
# cat /etc/debian_version ; uname -a
11.6
Linux taz 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64
GNU/Linux
2023-04-08 15:53:01 root@taz ~
# cpufreq-info --hwlimits
800000 4700000
2023-04-08 15:53:08 root@taz ~
# cpufreq-info --governors
performance powersave
2023-04-08 15:53:20 root@taz ~
# cpufreq-info --policy
800000 4700000 powersave
cpufreq-set(1) appears to make changes:
2023-04-08 16:15:20 root@taz ~
# cpufreq-set -r --max 2000000
2023-04-08 16:15:54 root@taz ~
# cpufreq-info --policy
800000 2000000 powersave
But, benchmarking before and after shows no effect (?).
STFW:
https://wiki.debian.org/CpuFrequencyScaling
cpufreq is being replaced by cpupower.
Install the cpupower package and try it:
2023-04-08 17:04:29 root@taz ~
# apt-get install linux-cpupower
<snip>
2023-04-08 17:09:31 root@taz ~
# cpupower frequency-info
analyzing CPU 0:
driver: intel_pstate
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: Cannot determine or is not supported.
hardware limits: 800 MHz - 4.70 GHz
available cpufreq governors: performance powersave
current policy: frequency should be within 800 MHz and 2.00 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency: Unable to call hardware
current CPU frequency: 828 MHz (asserted by call to kernel)
boost state support:
Supported: yes
Active: yes
2023-04-08 17:10:46 root@taz ~
# cpupower frequency-set --max 2000000
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
Setting cpu: 4
Setting cpu: 5
Setting cpu: 6
Setting cpu: 7
Benchmark -- now it runs slower and cooler.
David
[toc] | [prev] | [next] | [standalone]
| From | Mark Allums <maa@allums.com> |
|---|---|
| Date | 2023-04-09 05:20 +0200 |
| Message-ID | <GitKV-LCM-3@gated-at.bofh.it> |
| In reply to | #256927 |
On 4/8/2023 8:01 PM, David Christensen wrote: > On 4/8/23 07:17, songbird wrote: >> i have a program that has changed it's behavior to suddenly >> become a CPU hog (while doing something simple like uploading >> files for my website). probably a bug, but it got me to >> wondering how i could limit the CPU temperature to a range >> well below the maximum that kicks in by the CPU itself. >> >> i have an intel processor and it has the MAX which does >> prevent it from going higher (100C), but i'd like to keep it >> at 70C or lower. >> >> i've been trying to find anything that will let me set this >> but no luck yet in my searches. >> >> thanks! :) >> >> >> songbird > > > Assuming the computer had a proper thermal solution when assembled, > the 100 C processor temperature indicates that the thermal paste > between the processor and its heat sink has gone bad. I suggest > replacing it with silver-based thermal paste. > New paste yes, silver no. That's out-of-date. Silver is conductive. Silver paste is not superior to Thermal Grizzly Kryonaut or Arctic (maker of the most popular silver paste) MX-6. You want non-conductive, non-capacitive paste. Mark Allums
[toc] | [prev] | [next] | [standalone]
| From | David Christensen <dpchrist@holgerdanske.com> |
|---|---|
| Date | 2023-04-10 01:50 +0200 |
| Message-ID | <GiMXf-XxC-13@gated-at.bofh.it> |
| In reply to | #256931 |
On 4/8/23 20:11, Mark Allums wrote:
> On 4/8/2023 8:01 PM, David Christensen wrote:
>> On 4/8/23 07:17, songbird wrote:
>>> i have a program that has changed it's behavior to suddenly
>>> become a CPU hog (while doing something simple like uploading
>>> files for my website). probably a bug, but it got me to
>>> wondering how i could limit the CPU temperature to a range
>>> well below the maximum that kicks in by the CPU itself.
>>>
>>> i have an intel processor and it has the MAX which does
>>> prevent it from going higher (100C), but i'd like to keep it
>>> at 70C or lower.
>>>
>>> i've been trying to find anything that will let me set this
>>> but no luck yet in my searches.
>>>
>>> thanks! :)
>>>
>>>
>>> songbird
>>
>>
>> Assuming the computer had a proper thermal solution when assembled,
>> the 100 C processor temperature indicates that the thermal paste
>> between the processor and its heat sink has gone bad. I suggest
>> replacing it with silver-based thermal paste.
>>
> New paste yes, silver no. That's out-of-date. Silver is conductive.
> Silver paste is not superior to Thermal Grizzly Kryonaut or Arctic
> (maker of the most popular silver paste) MX-6. You want non-conductive,
> non-capacitive paste.
>
>
> Mark Allums
Thank you for pointing out advances in thermal paste since the last time
I used such. STFW the two brands you mention do seem to be the current
"top of the charts":
https://en.wikipedia.org/wiki/Thermal_paste
https://www.tomshardware.com/best-picks/best-thermal-paste
https://www.tomshardware.com/news/artic-mx6-thermal-paste
https://www.thermal-grizzly.com/en/products/16-kryonaut-en
https://www.arctic.de/us/MX-6/ACTCP00079A
I agree that getting paste where it does not belong during installation
is a problem; thermally, electrically, and chemically. "non-conductive,
non-capacitive paste" should mitigate damage should this risk occur.
Thankfully, I have not created such a mess; and the ones I have cleaned
did no apparent damage.
The last time I installed (silver-based) thermal paste, I seem to recall
that the manufacturer's directions were to apply a bead the size of a
grain of long-grain rice to the center of the processor case and then
seat the heat sink straight down. I believe I took one such joint apart
shortly after installation, and the paste had spread into a circular
area with a diameter of ~80% of the processor top. I will be curious to
see the pattern after a long period of use, if and when I take one of
those joints apart again.
I do not want paste oozing out of the sides of the joint, so I have
resisted the urge to use more paste or enlarge the application pattern.
I do not want air bubbles, so I have resisted the urge to spread the
paste. However, Thermal Grizzly recommends this technique in their
application guide:
https://www.thermal-grizzly.com/images/downloads/TG-ApplicationShortGuide.pdf
I have installed a few Intel "boxed" processor kits that included heat
sinks and fans. The heat sinks had a fine pattern of thermal paste in
rows with empty furrows in between. The pattern covered the entire
mating surface. The paste was nearly solid and was silver in color.
Looking beyond spillage, putting a insulator (non-conductive thermal
paste) between two conductors (metal heat sink and metal processor case)
is how you form a capacitor:
https://en.wikipedia.org/wiki/Capacitor#Parallel-plate_capacitor
The simplest model of a capacitor consists of two thin parallel
conductive plates each with an area of A separated by a uniform gap
of thickness d filled with a dielectric with permittivity ε . It is
assumed the gap d is much smaller than the dimensions of the plates.
...
... the highest capacitance is achieved with a high permittivity
dielectric material, large plate area, and small separation between
the plates.
...
The maximum energy is a function of dielectric volume, permittivity,
and dielectric strength.
Following the link "permitttivity":
https://en.wikipedia.org/wiki/Permittivity
In electromagnetism, the absolute permittivity, often simply called
permittivity and denoted by the Greek letter ε (epsilon), is a
measure of the electric polarizability of a dielectric. A material
with high permittivity polarizes more in response to an applied
electric field than a material with low permittivity, thereby
storing more energy in the material. In electrostatics, the
permittivity plays an important role in determining the capacitance
of a capacitor.
So, it would seem that "non-capacitive" thermal paste is thermal paste
with low electromagnetic absolute permittivity.
Does anyone have any ideas or explanations regarding forming a capacitor
out of the processor heat sink and the processor case by using a
non-conductive paste versus forming an electrical connection by using an
electrically conductive thermal paste? Or, a "real world" joint using a
thermal compound with electromagnetic impedance that varies with
frequency and/or intensity of the imposed electromagnetic field?
Notably, at frequencies of 66 MHz (processor external bus) and ~1 to ~5
GHz (processor internal)?
David
[toc] | [prev] | [next] | [standalone]
| From | Darac Marjal <mailinglist@darac.org.uk> |
|---|---|
| Date | 2023-04-09 14:30 +0200 |
| Message-ID | <GiClc-R4w-1@gated-at.bofh.it> |
| In reply to | #256876 |
[Multipart message — attachments visible in raw view] — view raw
On 08/04/2023 15:17, songbird wrote:
> i have a program that has changed it's behavior to suddenly
> become a CPU hog (while doing something simple like uploading
> files for my website). probably a bug, but it got me to
> wondering how i could limit the CPU temperature to a range
> well below the maximum that kicks in by the CPU itself.
>
> i have an intel processor and it has the MAX which does
> prevent it from going higher (100C), but i'd like to keep it
> at 70C or lower.
>
> i've been trying to find anything that will let me set this
> but no luck yet in my searches.
You might try combining your queries with terms for various
CPU-intensive activities such as BOINC, Folding@Home or Bitcoin mining.
I'm not suggesting your task is related to any of these, but the people
who do use these programs face similar issues.
For example, there is the TThrottle program for windows which will pause
BOINC calculations when the CPU temperature goes too high. I don't
believe that's available for linux, though.
As an alternative, you could try writing a small shell script that works
like the following (pseudocode):
STOP_TEMP=70
START_TEMP=65
JOB_RUNNING=1
while true:
cpu_temp=$(cat /sys/something/temperature)
if JOB_RUNNING and cpu_temp > STOP_TEMP:
systemctl stop something.service
JOB_RUNNING=0
elif not JOB_RUNNING and cpu_temp < START_TEMP:
systemctl start something.service
JOB_RUNNING=1
endif
sleep 1
wend
>
> thanks! :)
>
>
> songbird
>
[toc] | [prev] | [next] | [standalone]
| From | Emanuel Berg <incal@dataswamp.org> |
|---|---|
| Date | 2023-04-09 14:40 +0200 |
| Message-ID | <GiCuR-R7Q-1@gated-at.bofh.it> |
| In reply to | #256958 |
Darac Marjal wrote: > As an alternative, you could try writing a small shell > script that works like the following (pseudocode): > > STOP_TEMP=70 > START_TEMP=65 > JOB_RUNNING=1 > > while true: > cpu_temp=$(cat /sys/something/temperature) > > if JOB_RUNNING and cpu_temp > STOP_TEMP: > systemctl stop something.service > JOB_RUNNING=0 > elif not JOB_RUNNING and cpu_temp < START_TEMP: > systemctl start something.service > JOB_RUNNING=1 > endif > > sleep 1 > wend Maybe the software scheduler should already schedule optimally, be it preemptive SJF or whatever, anyway so only possibility to reduce CPU temperature that way is to schedule less anyway - also backwards, since computing is like the "king" here it means if heat is a problem, it's not on our side of it really. -- underground experts united https://dataswamp.org/~incal
[toc] | [prev] | [next] | [standalone]
| From | David Christensen <dpchrist@holgerdanske.com> |
|---|---|
| Date | 2023-04-10 04:20 +0200 |
| Message-ID | <GiPip-Z9V-1@gated-at.bofh.it> |
| In reply to | #256876 |
On 4/8/23 07:17, songbird wrote:
> i have a program that has changed it's behavior to suddenly
> become a CPU hog (while doing something simple like uploading
> files for my website). probably a bug, but it got me to
> wondering how i could limit the CPU temperature to a range
> well below the maximum that kicks in by the CPU itself.
>
> i have an intel processor and it has the MAX which does
> prevent it from going higher (100C), but i'd like to keep it
> at 70C or lower.
>
> i've been trying to find anything that will let me set this
> but no luck yet in my searches.
>
> thanks! :)
>
>
> songbird
I previous posted some Perl one-liners to load one processor core for
thermal testing:
https://lists.debian.org/debian-user/2021/08/msg01346.html
Here is an updated Perl script that will exercise all cores to a given
percentage for a given duration:
2023-04-09 19:06:43 dpchrist@taz ~
$ cat /usr/local/bin/exercise-cpu
#!/usr/bin/env perl
# $Id: exercise-cpu,v 1.1 2023/04/10 02:05:22 dpchrist Exp $
# by David Paul Christensen dpchrist@holgerdanske.com
# Public Domain
#
# Exercise central processing unit
use threads;
use strict;
use warnings;
use File::Basename;
use Time::HiRes qw( sleep time );
die sprintf "Usage: %s PERCENT DURATION\n", basename($0)
unless @ARGV == 2;
my $a = 0.01 * shift; # periodic exercise duration
my $b = 1 - $a; # periodic sleep duration
$_ = qx/lscpu/; # Debian GNU/Linux
my ($c) = /CPU.s.:\s+(\d+)/; # number of virtual cores
my $e = time + shift; # time to end
my @thr; # threads
push @thr, async {
while (time < $e) {
my $d = time + $a / 10;
1 while time < $d;
sleep $b/10;
}
} for 1..$c;
$_->join for @thr;
2023-04-09 19:06:49 dpchrist@taz ~
$ exercise-cpu 50 10
David
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | linux.debian.user
csiph-web