diff --git a/inxi b/inxi index 64484a8..b6e3c56 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 0.3.20 +#### version: 0.3.21 #### Date: November 4 2008 ######################################################################## #### inxi is a fork of infobash, the original bash sys info script by locsmif @@ -835,10 +835,15 @@ get_cpu_data() /^bogomips/ { cpu[nr, "bogomips"] = $NF } + /vendor_id/ { + gsub(/genuine|authentic/,"",$NF) + cpu[nr, "vendor"] = $NF + } + END { #if (!nr) { print ",,,"; exit } # <- should this be necessary or should bash handle that for (i = 0; i <= nr; i++) { - print cpu[i, "model"] "," cpu[i, "speed"] "," cpu[i, "cache"] "," cpu[i, "flags"] "," cpu[i, "bogomips"] + print cpu[i, "model"] "," cpu[i, "speed"] "," cpu[i, "cache"] "," cpu[i, "flags"] "," cpu[i, "bogomips"] "," cpu[nr, "vendor"] } if (!min) { print "not found" @@ -967,10 +972,12 @@ get_distro_data() else # Debian pure should fall through here distro_file="issue" - distro=$( gawk 'BEGIN { RS="" } { gsub(/\\[a-z]/,""); - gsub(/ [ ]+/," "); - gsub(/^ +| +$/,""); - print }' "/etc/${distro_file}" ) + distro=$( gawk ' + BEGIN { RS="" } { + gsub(/\\[a-z]/,""); + gsub(/ [ ]+/," "); + gsub(/^ +| +$/,""); + print }' "/etc/${distro_file}" ) fi if [ "${#distro}" -gt 80 -a "$B_HANDLE_CORRUPT_DATA" != 'true' ];then distro="${RED}/etc/${distro_file} corrupted, use -C to override${NORMAL}" @@ -1375,12 +1382,13 @@ print_audio_data() print_cpu_data() { local cpu_data='' i='' a_cpu_working='' cpu_clock_speed='' cpu_multi_clock_data='' - local bmip_data='' cpu_cache='' + local bmip_data='' cpu_cache='' cpu_vendor='' ##print_screen_output "A_CPU_DATA[0]=\"${A_CPU_DATA[0]}\"" IFS="," a_cpu_working=(${A_CPU_DATA[0]}) IFS="$ORIGINAL_IFS" + cpu_vendor=$( tr '[A-Z]' '[a-z]' <<< ${a_cpu_working[5]} ) # Strange (and also some expected) behavior encountered. # If print_screen_output() uses $1 as the parameter to output to the screen, # then passing " ${ARR[@]} " @@ -1401,14 +1409,25 @@ print_cpu_data() # # Array CPU always has one element: max clockfreq found. Therefore -gt and not -ge # unset cpu_core_count # fi + cpu_data=$( create_print_line "CPU:" "${C1}${cpu_core_count_string}${C2} ${a_cpu_working[0]}" ) if [ "$VERBOSITY_LEVEL" -ge 3 ];then # update for multicore, bogomips x core count. if [ "$B_EXTRA_DATA" == 'true' ];then - bmip_data=$( calculate_multicore_data "${a_cpu_working[4]}" "$cpu_core_count" ) + +# if [ "$cpu_vendor" != 'intel' ];then + bmip_data=$( calculate_multicore_data "${a_cpu_working[4]}" "$cpu_core_count" ) +# else +# bmip_data="${a_cpu_working[4]}" +# fi bmip_data=" ${C1}bmips${C2} $bmip_data" fi - cpu_cache=$( calculate_multicore_data "${a_cpu_working[2]}" "$cpu_core_count" ) + ## note: this handles how intel reports L2, total instead of per core like AMD does + if [ "$cpu_vendor" != 'intel' ];then + cpu_cache=$( calculate_multicore_data "${a_cpu_working[2]}" "$cpu_core_count" ) + else + cpu_cache="${a_cpu_working[2]}" + fi cpu_data="$cpu_data${C2} ${C1}cache${C2} $cpu_cache ${C1}flags${C2} ($CPU_FLAGS)$bmip_data${CN}" fi