| #!/bin/bash |
| |
| |
| |
| |
| t_Log "Running $0 - a basic iostat test to verify cpu measurement" |
| |
| |
| TMP=/tmp/iostat.cpu.scratch |
| |
| |
| echo 1 > /proc/sys/vm/drop_caches |
| |
| |
| trap "[ -e $TMP ] && { /bin/rm -f $TMP; }" EXIT |
| |
| |
| DRIVE=$(fdisk -l|grep -Po -m1 '^/dev/[\D]+') |
| |
| |
| /usr/bin/iostat -c 1 5 >$TMP & |
| |
| |
| sleep 4 |
| |
| |
| /bin/dd if=$DRIVE bs=4k count=25000 2>/dev/null|sha1sum -b - &>/dev/null |
| |
| |
| sleep 6 |
| |
| |
| CPU_USER_PCENT=$(awk '$1 ~ /[0-9]/ {$1>a ? a=$1 : $1} END {print int(a)}' $TMP) |
| |
| |
| [ "$CPU_USER_PCENT" -gt 3 ] || { t_Log "iostat didn't log any CPU activity?!...that ain't good"; } |
| |
| t_CheckExitStatus $? |