Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #239280

Re: smart fans

From David Christensen <dpchrist@holgerdanske.com>
Newsgroups linux.debian.user
Subject Re: smart fans
Date 2021-08-24 09:50 +0200
Message-ID <CPzm1-1tF-3@gated-at.bofh.it> (permalink)
References (8 earlier) <CPnkT-26c-21@gated-at.bofh.it> <CPqsq-49v-5@gated-at.bofh.it> <CPsaR-5e0-3@gated-at.bofh.it> <CPtTj-6b9-1@gated-at.bofh.it> <CPxay-8tD-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 8/23/21 10:25 PM, Emanuel Berg wrote:
> David Christensen wrote:
> 
>> For a CPU with N cores (N=4 for an AMD Ryzen 3 3200G?) and
>> an otherwise unloaded system, your test procedure should be
>> something like:
>>
>>     loop over governor choices
>>       set governor
>>        loop 3 times
>>          sleep 60 seconds
>>          print statistics
>>        endloop
>>       loop from 1 to N
>>         start background process
>>         loop 10 times
>>           sleep 6 seconds
>>           print statistics
>>         endloop
>>       endloop
>>       kill all background processes
>>     endloop
>>
>> "print statistics" should include time, governor setting,
>> number of background processes running, and CPU temperature.
>> If would be nice to also include system loading percent, CPU
>> frequency, and CPU fan speed.
> 
> Okay, what about
> 
> #! /bin/zsh
> #
> # this file:
> #   https://dataswamp.org/~incal/conf/.zsh/cpu
> 
> cpu-stats () {
>      local time=$(date +%s)
>      local gov=$(cpufreq-info -p | awk '{print $3}')
>      local back=$(jobs -l | wc -l)
>      local temp=$(sensors -j | jq -a '.["k10temp-pci-00c3"].Tdie.temp1_input')
> 
>      local cores=$(getconf _NPROCESSORS_ONLN)
>      local avg=$(awk '{print $1}' /proc/loadavg)
>      local load=$(( $avg * 100/$cores ))
> 
>      local freq=("${(@f)$(awk '/cpu MHz/{print $4}' /proc/cpuinfo)}")
>      local fan=$(sensors | awk '/cpu_fan/{print $2 " RPM"}')
> 
>      echo    "time                 ${time}"
>      echo    "governor             ${gov}"
>      echo    "background processes ${back}"
>      echo    "CPU temperature      ${temp}C"
>      printf  "system load          %.1f%%\n" $load
>      echo    "CPU fan speed        ${fan}"
>      echo -n "CPU frequencies      "
> 
>      for f in $freq; do
>          echo -n "$f "
>      done
>      echo "MHz"
> }
> 
> test-cpu () {
>      local cores=$(getconf _NPROCESSORS_ONLN)
>      local pids=()
>      local g
>      for g in $(cpufreq-info -g); do
>          sudo cpufreq-set -g $g
>          repeat 3 {
>                  sleep 60
>                  cpu-stats
>              }
>          repeat $cores {
>                  perl -e '1 while 1' &
>                  pids+=($!)
>                  repeat 10 {
>                          sleep 6
>                          cpu-stats
>                      }
>              }
>      done
>      for p in $pids; do
>          kill $p
>      done
> }


I would output a header line and then output each set of statistics on a 
single line.  Fixed-width pretty-printing may involve a lot of 
programmer effort, both to generate and to parse later.  ASCII comma- or 
tab-separated value (CSV/TSV) format is open source, mostly human 
readable, easier on the programmer, readily ported between platforms, 
and can be fed into other programs (such as LibreOffice Calc, scripts, 
databases, etc.).


I would avoid doing any math on the data.  Save raw values and deal with 
math in post-processing:

     local cores=$(getconf _NPROCESSORS_ONLN)
     local load=$(( $avg * 100/$cores ))


I would put units into the headers.  Save raw values and deal with units 
in post processing:

     echo    "CPU temperature      ${temp}C"


David

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 02:00 +0200
  Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 02:50 +0200
    Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 03:10 +0200
      Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 05:00 +0200
        Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 05:10 +0200
      Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 05:10 +0200
        Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 05:30 +0200
          Re: FOSS "BIOS" (UEFI) (was: Re: smart fans) Reco <recoverym4n@enotuniq.net> - 2021-08-22 07:30 +0200
            Re: FOSS "BIOS" (UEFI) (was: Re: smart fans) Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 08:30 +0200
              Re: FOSS "BIOS" (UEFI) (was: Re: smart fans) Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 10:30 +0200
              Re: FOSS "BIOS" (UEFI) The Wanderer <wanderer@fastmail.fm> - 2021-08-22 12:10 +0200
                Re: FOSS "BIOS" (UEFI) Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 13:30 +0200
              Re: FOSS "BIOS" (UEFI) (was: Re: smart fans) Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 15:20 +0200
                Re: FOSS "BIOS" (UEFI) (was: Re: smart fans) Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 16:30 +0200
                Re: FOSS "BIOS" (UEFI) (was: Re: smart fans) Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 18:50 +0200
          FOSS "BIOS" (UEFI) (was: Re: smart fans) Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 07:30 +0200
  Re: smart fans <tomas@tuxteam.de> - 2021-08-22 09:10 +0200
    Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 09:50 +0200
      Re: smart fans <tomas@tuxteam.de> - 2021-08-22 10:00 +0200
        Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 10:10 +0200
          Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 10:10 +0200
            Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 10:20 +0200
          Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 10:30 +0200
            Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 10:50 +0200
              Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 15:10 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 16:10 +0200
                Re: smart fans The Wanderer <wanderer@fastmail.fm> - 2021-08-22 16:10 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 16:20 +0200
                Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 18:50 +0200
      Re: smart fans Hans <hans.ullrich@loop.de> - 2021-08-22 17:30 +0200
        Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 17:50 +0200
  Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-22 09:50 +0200
    Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 10:00 +0200
      Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 10:20 +0200
      Re: smart fans <tomas@tuxteam.de> - 2021-08-22 10:30 +0200
        Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 10:40 +0200
        Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 10:40 +0200
          Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 10:40 +0200
            Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 10:50 +0200
              Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 11:30 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 11:50 +0200
                Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 15:10 +0200
                Re: smart fans didier gaumet <didier.gaumet@gmail.com> - 2021-08-22 11:50 +0200
                Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 15:10 +0200
              Re: smart fans didier gaumet <didier.gaumet@gmail.com> - 2021-08-22 11:30 +0200
          Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 11:00 +0200
            Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 15:10 +0200
              Re: smart fans <tomas@tuxteam.de> - 2021-08-22 15:50 +0200
                Re: smart fans rhkramer@gmail.com - 2021-08-22 16:10 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 16:50 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 16:10 +0200
                Re: smart fans <tomas@tuxteam.de> - 2021-08-22 16:30 +0200
                Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 18:50 +0200
                Re: smart fans Gene Heskett <gheskett@shentel.net> - 2021-08-22 23:10 +0200
                Re: smart fans Gene Heskett <gheskett@shentel.net> - 2021-08-23 00:20 +0200
                Re: smart fans "Thomas Schmitt" <scdbackup@gmx.net> - 2021-08-22 16:30 +0200
                Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 18:50 +0200
                Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-22 19:00 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-22 23:10 +0200
                Re: smart fans <tomas@tuxteam.de> - 2021-08-23 10:10 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-23 21:10 +0200
                Re: smart fans <tomas@tuxteam.de> - 2021-08-23 21:10 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-23 21:30 +0200
                Re: smart fans <tomas@tuxteam.de> - 2021-08-23 21:40 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-23 22:30 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-24 00:30 +0200
            Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-22 22:30 +0200
              Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 23:20 +0200
      Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-22 21:30 +0200
        Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 22:00 +0200
          Re: smart fans didier gaumet <didier.gaumet@gmail.com> - 2021-08-22 23:20 +0200
            Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 23:40 +0200
              Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-22 23:50 +0200
                Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-23 00:40 +0200
              Re: smart fans didier gaumet <didier.gaumet@gmail.com> - 2021-08-23 09:30 +0200
        Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 22:20 +0200
          Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-22 23:10 +0200
            Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 23:30 +0200
        Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-22 23:50 +0200
          Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-23 00:10 +0200
            Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-23 02:00 +0200
              Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-23 02:10 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-23 02:40 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-23 03:00 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-23 03:30 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-23 21:00 +0200
                Re: smart fans "Andrew M.A. Cater" <amacater@einval.com> - 2021-08-24 18:20 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-24 23:00 +0200
                Re: smart fans Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-23 03:30 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-23 21:00 +0200
              Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-23 03:20 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-23 21:00 +0200
                Re: smart fans "Thomas Schmitt" <scdbackup@gmx.net> - 2021-08-23 22:50 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-23 23:00 +0200
                Re: smart fans "Thomas Schmitt" <scdbackup@gmx.net> - 2021-08-23 23:30 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-24 00:50 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-24 01:30 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-24 02:30 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-24 03:00 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-24 04:30 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-24 05:20 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-24 09:00 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-24 23:20 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-24 23:40 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-24 00:40 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-24 00:20 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-24 02:10 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-24 04:00 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-24 07:30 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-24 09:50 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-25 00:20 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-25 01:30 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-08-29 01:00 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-29 12:00 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-09-04 00:10 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-09-04 03:50 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-09-04 04:50 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-09-04 23:00 +0200
                Re: smart fans Emanuel Berg <moasenwood@zoho.eu> - 2021-09-07 03:10 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-09-07 23:20 +0200
                Re: smart fans David Christensen <dpchrist@holgerdanske.com> - 2021-08-24 11:20 +0200

csiph-web