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 #!/bin/bash -e
# neotest: run tests and benchmarks against FileStorage, ZEO and various NEO/py and NEO/go clusters # 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> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -640,15 +640,20 @@ system_info() { ...@@ -640,15 +640,20 @@ system_info() {
freqstable=y freqstable=y
while read cpu; do while read cpu; do
f="$cpu/cpufreq" f="$cpu/cpufreq"
if ! test -d "$f"; then
fs="?"
freqstable=n
else
fmin=`fkghz $f/scaling_min_freq` fmin=`fkghz $f/scaling_min_freq`
fmax=`fkghz $f/scaling_max_freq` fmax=`fkghz $f/scaling_max_freq`
fs="`cat $f/scaling_driver`/`cat $f/scaling_governor` [$fmin - $fmax]" fs="`cat $f/scaling_driver`/`cat $f/scaling_governor` [$fmin - $fmax]"
test "$fmin" != "$fmax" && freqstable=n
fi
if [ "$fs" != "$freqstr" ]; then if [ "$fs" != "$freqstr" ]; then
freqdump freqdump
freqstr="$fs" freqstr="$fs"
fi fi
freqcpuv+=(`basename $cpu`) freqcpuv+=(`basename $cpu`)
test "$fmin" != "$fmax" && freqstable=n
done \ done \
< <(ls -vd $syscpu/cpu[0-9]*) < <(ls -vd $syscpu/cpu[0-9]*)
freqdump freqdump
...@@ -656,6 +661,9 @@ system_info() { ...@@ -656,6 +661,9 @@ system_info() {
latmax=0 latmax=0
while read cpu; do while read cpu; do
is="`cat $sysidle/current_driver`/`cat $sysidle/current_governor_ro`:" is="`cat $sysidle/current_driver`/`cat $sysidle/current_governor_ro`:"
if ! test -d "$cpu/cpuidle"; then
is+=" ?"
else
while read state; do while read state; do
is+=" " is+=" "
lat=`cat $state/latency` lat=`cat $state/latency`
...@@ -666,6 +674,7 @@ system_info() { ...@@ -666,6 +674,7 @@ system_info() {
< <(ls -vd $cpu/cpuidle/state[0-9]*) < <(ls -vd $cpu/cpuidle/state[0-9]*)
is+=" # elat/tres µs" is+=" # elat/tres µs"
fi
if [ "$is" != "$idlestr" ]; then if [ "$is" != "$idlestr" ]; then
idledump 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