mirror of
https://github.com/smxi/inxi.git
synced 2025-01-19 08:57:57 +00:00
Added new verbosity level, 5. Allows for printout of clockspeed per cpu on new line if cpu count > 1
This commit is contained in:
parent
3912580aad
commit
a707cea2dc
36
inxi
36
inxi
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 0.2.16
|
||||
#### version: 0.2.17
|
||||
#### Date: October 31 2008
|
||||
########################################################################
|
||||
#### inxi is a fork of infobash, the original bash sys info script by locsmif
|
||||
|
@ -104,7 +104,7 @@ SHOW_IRC=2
|
|||
# Verbosity level defaults to 0, this can also be set with -v, -v2, -v3, etc as a parameter.
|
||||
VERBOSITY_LEVEL=0
|
||||
# Supported number of verbosity levels
|
||||
VERBOSITY_LEVELS=4
|
||||
VERBOSITY_LEVELS=5
|
||||
|
||||
# Clear nullglob, because it creates unpredictable situations with IFS=$'\n' ARR=($VAR) IFS="$OIFS"
|
||||
# type constructs. Stuff like [rev a1] is now seen as a glob expansion pattern, and fails, and
|
||||
|
@ -1251,9 +1251,9 @@ get_uptime()
|
|||
|
||||
print_cpu_data()
|
||||
{
|
||||
local cpu_data='' i='' a_cpu_working=''
|
||||
local cpu_data='' i='' a_cpu_working='' cpu_clock_speed='' cpu_multi_clock_data=''
|
||||
|
||||
##print_screen_output "CPU[0]=\"${CPU[0]}\""
|
||||
##print_screen_output "A_CPU_DATA[0]=\"${A_CPU_DATA[0]}\""
|
||||
IFS=","
|
||||
a_cpu_working=(${A_CPU_DATA[0]})
|
||||
IFS="$OIFS"
|
||||
|
@ -1265,7 +1265,7 @@ print_cpu_data()
|
|||
# However, that text2 is consecutively truncated is somewhat strange, so take note.
|
||||
# This has been confirmed by #bash on freenode.
|
||||
# The above mentioned only emerges when using the debugging markers below
|
||||
##print_screen_output "a_cpu_working=\"***${a_cpu_working[@]} $hostName+++++++\"----------"
|
||||
## print_screen_output "a_cpu_working=\"***${a_cpu_working[@]} $hostName+++++++\"----------"
|
||||
|
||||
if [[ -z ${a_cpu_working[2]} ]];then
|
||||
a_cpu_working[2]="unknown"
|
||||
|
@ -1281,9 +1281,35 @@ print_cpu_data()
|
|||
if [ "$VERBOSITY_LEVEL" -ge 3 ];then
|
||||
cpu_data="$cpu_data${C2} ${a_cpu_working[2]} cache${C2} ${C1}flags${C2} ($CPU_FLAGS)${CN}"
|
||||
fi
|
||||
|
||||
if [ "$VERBOSITY_LEVEL" -ge 5 -a ${#A_CPU_DATA[@]} -gt 2 ]
|
||||
then
|
||||
cpu_clock_speed='' # null < verbosity level 5
|
||||
else
|
||||
cpu_data="$cpu_data ${C1}clocked at${C2} ${a_cpu_working[1]} MHz${CN}"
|
||||
fi
|
||||
|
||||
cpu_data="$cpu_data $cpu_clock_speed"
|
||||
print_screen_output "$cpu_data"
|
||||
|
||||
if [ "$VERBOSITY_LEVEL" -ge 5 -a ${#A_CPU_DATA[@]} -gt 2 ]
|
||||
then
|
||||
for (( i=0; i < ${#A_CPU_DATA[@]}-1; i++ ))
|
||||
do
|
||||
IFS=","
|
||||
a_cpu_working=(${A_CPU_DATA[i]})
|
||||
IFS="$OIFS"
|
||||
cpu_multi_clock_data="$cpu_multi_clock_data ${C1}($(( i + 1 )))${C2} ${a_cpu_working[1]} MHz${CN}"
|
||||
if [ "$i" -gt 10 ];then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -n "$cpu_multi_clock_data" ];then
|
||||
cpu_multi_clock_data=$( create_print_line " " "${C1}Clock Speeds:${C2}$cpu_multi_clock_data" )
|
||||
print_screen_output "$cpu_multi_clock_data"
|
||||
fi
|
||||
fi
|
||||
|
||||
## leave this here in case they release cpus that can run at different speeds per core
|
||||
# for (( i=1; i < ${#A_CPU_DATA[@]}-1; i++ ))
|
||||
# do
|
||||
|
|
Loading…
Reference in a new issue