Commit 4942c900 authored by Kirill Smelkov's avatar Kirill Smelkov

X neotest: info-local: Fix it when CPU frequence/idle information is not available

For example under KVM it was failing as

    cpu:	Intel(R) Xeon(R) CPU E5-2678 v3 @ 2.50GHz
    cat: /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq: No such file or directory
      File "<string>", line 1
        print '%.2fGHz' % ( / 1E6)
                            ^
    SyntaxError: invalid syntax

    $ lscpu
    Architecture:        x86_64
    CPU op-mode(s):      32-bit, 64-bit
    Byte Order:          Little Endian
    Address sizes:       40 bits physical, 48 bits virtual
    CPU(s):              40
    On-line CPU(s) list: 0-39
    Thread(s) per core:  1
    Core(s) per socket:  1
    Socket(s):           40
    NUMA node(s):        1
    Vendor ID:           GenuineIntel
    CPU family:          6
    Model:               63
    Model name:          Intel(R) Xeon(R) CPU E5-2678 v3 @ 2.50GHz
    Stepping:            2
    CPU MHz:             2494.238
    BogoMIPS:            4988.47
    Virtualization:      VT-x
    Hypervisor vendor:   KVM
    Virtualization type: full
    L1d cache:           32K
    L1i cache:           32K
    L2 cache:            4096K
    L3 cache:            16384K
    NUMA node0 CPU(s):   0-39
    Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm invpcid_single pti tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt arat

-> Fix it by checking whether cpufreq/cpuidle directories are available, and display "?" if they are not.
parent 5ee3c077
#!/bin/bash -e
# neotest: run tests and benchmarks against FileStorage, ZEO and various NEO/py and NEO/go clusters
# Copyright (C) 2017-2018 Nexedi SA and Contributors.
# Copyright (C) 2017-2020 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
......@@ -640,15 +640,20 @@ system_info() {
freqstable=y
while read cpu; do
f="$cpu/cpufreq"
fmin=`fkghz $f/scaling_min_freq`
fmax=`fkghz $f/scaling_max_freq`
fs="`cat $f/scaling_driver`/`cat $f/scaling_governor` [$fmin - $fmax]"
if ! test -d "$f"; then
fs="?"
freqstable=n
else
fmin=`fkghz $f/scaling_min_freq`
fmax=`fkghz $f/scaling_max_freq`
fs="`cat $f/scaling_driver`/`cat $f/scaling_governor` [$fmin - $fmax]"
test "$fmin" != "$fmax" && freqstable=n
fi
if [ "$fs" != "$freqstr" ]; then
freqdump
freqstr="$fs"
fi
freqcpuv+=(`basename $cpu`)
test "$fmin" != "$fmax" && freqstable=n
done \
< <(ls -vd $syscpu/cpu[0-9]*)
freqdump
......@@ -656,16 +661,20 @@ system_info() {
latmax=0
while read cpu; do
is="`cat $sysidle/current_driver`/`cat $sysidle/current_governor_ro`:"
while read state; do
is+=" "
lat=`cat $state/latency`
res=`cat $state/residency 2>/dev/null` || res="?" # added in linux 3.15
test "`cat $state/disable`" = "1" && is+="!" || latmax=$(($lat>$latmax?$lat:$latmax))
is+="`cat $state/name`·${lat}/${res}"
done \
< <(ls -vd $cpu/cpuidle/state[0-9]*)
is+=" # elat/tres µs"
if ! test -d "$cpu/cpuidle"; then
is+=" ?"
else
while read state; do
is+=" "
lat=`cat $state/latency`
res=`cat $state/residency 2>/dev/null` || res="?" # added in linux 3.15
test "`cat $state/disable`" = "1" && is+="!" || latmax=$(($lat>$latmax?$lat:$latmax))
is+="`cat $state/name`·${lat}/${res}"
done \
< <(ls -vd $cpu/cpuidle/state[0-9]*)
is+=" # elat/tres µs"
fi
if [ "$is" != "$idlestr" ]; then
idledump
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment