[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: smart fans



David Christensen wrote:

> Feeding the raw data into LibreOffice Calc was problematic
> -- header line field names do not have a one-to-one with
> data line field values. I reworked the header line as
> follows:
>
> 	time, governor, processes, CPU_temperature, system_load,
> 	CPU_fan_speed, core1_freq, core2_freq, core3_freq,
> 	core4_freq

OK, changed.

> The system *must* be otherwise idle before and during the
> test. The data indicates it was not.

I didn't use the computer and there was no download or
anything explicit run by me in the background, so I don't know
what more to do in that regard?

> The "CPU_fan_speed" was 0 throughout. Your data collection
> code for that field value is broken.

That's what's reported by sensors(1), I don't know how else
one would retrieve that information?

> There is supposed to be a cool-down delay at the start of
> each governor sub-run. My WAG was 3 minutes. Your test did 2
> minutes (off by 1 error).

Weird, if you mean this part of the pseudocode

  loop 3 times
    sleep 60 seconds
    print statistics
  endloop

then that's this part of the zsh code

  repeat 3 {
    sleep 60
    cpu-stats
  }

so I don't know what that isn't 3 minutes ... ?

> After each loading cycle, the load processes must be killed.

OK.

> Incremental load period -- the output variables must have
> reached their steady-state values when each incremental load
> period ends (10 loops * 6 seconds). Adjust and/or
> code accordingly.

Again I don't understand why that isn't what

  repeat 10 {
    sleep 6
    cpu-stats
  }

does?

> Have you isolated and identified the primary noise
> source(s)? Have you quantified them (e.g.
> sound measurement)?

No?

> Can you get that data into your test script?

I don't know?

Anyway here is the new script with a URL to the output:

#! /bin/zsh
#
# this file:
#   https://dataswamp.org/~incal/conf/.zsh/cpu
#
# example output:
#   https://dataswamp.org/~incal/ebchw/cpu.txt

cpu-stats-print () {
    local time=$1
    local gov=$2
    local pro=$3
    local temp=$4
    local load=$5
    local fan=$6
    shift 6
    local freq=($@)
    echo -n "${time}, ${gov}, ${pro}, ${temp}, ${load}, ${fan}"
    for f in $freq; do
        echo -n ", $f"
    done
    echo
}

cpu-stats () {
    local time=$(date +%s)
    local gov=$(cpufreq-info -p | awk '{print $3}')
    local pro=$(ps -ea | wc -l) # 'jobs -l' DNC
    local temp=$(sensors -j | jq -a '.["k10temp-pci-00c3"].Tdie.temp1_input')
    local load=$(awk '{print $1}' /proc/loadavg)
    local fan=$(sensors | awk '/cpu_fan/{print $2}') # always 0
    local freq=("${(@f)$(awk '/cpu MHz/{print $4}' /proc/cpuinfo)}")
    cpu-stats-print $time $gov $pro $temp $load $fan $freq
}

test-cpu () {
    echo -n "time, governor, processes, CPU_temperature, system_load, CPU_fan_speed"
    local cores=$(getconf _NPROCESSORS_ONLN)
    for c in {1..$cores}; do
        echo -n ", core${c}_freq"
    done
    echo

    local ori=$(cpufreq-info -p | awk '{print $3}')
    local pids
    local g
    local p
    for g in $(cpufreq-info -g); do
        pids=()
        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
            }
        }
        for p in $pids; do
          kill $p
        done
    done
    sudo cpufreq-set -g $ori
}

-- 
underground experts united
https://dataswamp.org/~incal


Reply to: