1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-10-29 22:24:51 +00:00

instruments: add proc_stat

Add an instrument that monitors CPU load using data from /proc/stat
This commit is contained in:
Sergei Trofimov
2020-02-07 11:22:14 +00:00
committed by Marc Bonnici
parent 0a4164349b
commit 51ffd60c06
2 changed files with 117 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
#!/bin/sh
BUSYBOX=$1
OUTFILE=$2
PERIOD=$3
STOP_SIGNAL_FILE=$4
if [ "$#" != "4" ]; then
echo "USAGE: gather-load.sh BUSYBOX OUTFILE PERIOD STOP_SIGNAL_FILE"
exit 1
fi
echo "timestamp,user,nice,system,idle,iowait,irq,softirq,steal,guest,guest_nice" > $OUTFILE
while true; do
echo -n $(${BUSYBOX} date -Iseconds) >> $OUTFILE
${BUSYBOX} cat /proc/stat | ${BUSYBOX} head -n 1 | \
${BUSYBOX} cut -d ' ' -f 2- | ${BUSYBOX} sed 's/ /,/g' >> $OUTFILE
if [ -f $STOP_SIGNAL_FILE ]; then
rm $STOP_SIGNAL_FILE
break
else
sleep $PERIOD
fi
done