Code cleanup
authorTomas Mudrunka <tomas@mudrunka.cz>
Fri, 3 Aug 2012 07:38:11 +0000 (09:38 +0200)
committerTomas Mudrunka <tomas@mudrunka.cz>
Fri, 3 Aug 2012 07:38:11 +0000 (09:38 +0200)
c/goertzel/sleepmon.sh

index 729d9bb878d7fab880d9aa78f924c6f74f2a0b25..cfa02973e5144863ac161dc9f38d5f857c6225c6 100755 (executable)
@@ -23,10 +23,6 @@ bash ./sleepstats.sh "$out" &>/dev/null &
 
 tresh=10
 lastdate="$(date +%s)"
-laststate=0
-history='';
-historymax=120;
-historylen='10 30 60 90 120'
 screen=false
 graph=false
 
@@ -52,18 +48,8 @@ arecord | ./goertzel -n i -q -l c -t $tresh -d 4 | while read line; do
 
        printf  "%.2f\t %s %s %d" "$time" "$date" "$(date '+%F %T')" "$statenum"
 
-       #History
-       after=$(( $date - $lastdate))
-       test $historymax -gt 0 && {
-               history=$(echo -n "$(yes | tr '\ny' $laststate | head -c $after)$history" | head -c $historymax)
-               for len in $historylen; do
-                       on="$(echo -n ${history::$len} | tr -d 0 | wc -c)"
-                       on="$(echo "scale=2; $on/$len" | bc)"
-                       printf " %.2f" "$on"
-               done
-       }
-
        #Debug
+       after=$(( $date - $lastdate))
        printf " (%s %3d After %4d secs)\n" "$statename" "$level" "$after";
 
        #Fun with values
@@ -76,7 +62,6 @@ arecord | ./goertzel -n i -q -l c -t $tresh -d 4 | while read line; do
 
        #Prepare invariants for next round
        lastdate="$date";
-       laststate="$statenum";
 done | tee "$out"
 kill $(jobs -p); sleep 0.2
 echo
This page took 0.124857 seconds and 4 git commands to generate.