From dc4ed951b1527d567d1d9754a237ec0ec44174d9 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Mon, 15 Feb 2010 05:05:47 +0000 Subject: [PATCH] (change version) a small issue fix, where cpu spike caused by inxi itself gives a bad cpu speed. Solution, put a 0.3 sleep time right before we get the cpu data. Less than 0.3 wasn't s reliable, not sure how much time the kernel needs to slow down cpus again. user can set config override of this time easily. Maybe one day inxi will be released with config files in /etc, then this stuff can be documented better in the file. I found the sleep largely unnoticeable in my tests. --- inxi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/inxi b/inxi index 395ea24..8571f4f 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.4.3 +#### version: 1.4.4 #### Date: February 14 2010 ######################################################################## #### SPECIAL THANKS @@ -168,6 +168,8 @@ LANG=C CMDL_MAX='' COLOR_SCHEME='' COLOR_SCHEME_SET='' +# override in user config if desired, seems like less than .3 doesn't work as reliably +CPU_SLEEP='0.3' IRC_CLIENT='' IRC_CLIENT_VERSION='' PS_COUNT=5 @@ -1914,6 +1916,8 @@ get_cpu_data() local i='' j='' cpu_array_nu='' a_cpu_working='' multi_cpu='' bits='' if [[ $B_CPUINFO_FILE == 'true' ]];then + # stop script for a bit to let cpu slow down before parsing cpu /proc file + sleep $CPU_SLEEP IFS=$'\n' A_CPU_DATA=( $( gawk -F': ' ' BEGIN {