#!/bin/bash # dom0busy - randomly busies all dom0 vcpus # keeps cpu busy for a fraction of a second, then sleeps for the same; repeat # run in domain0 as root, can be monitored in top TMPFILE=`mktemp /tmp/dom0busy.XXX` || exit 1 ( cat <<'EOF' #!/bin/bash while true; do RANDOM=$$$(date +%S) r1=$RANDOM r2=$RANDOM let loops="($r1*$r2)%10000" start=`date +%s.%N` while [ $loops -gt 0 ]; do let loops="$loops-1" done fin=`date +%s.%N` elapsed=`echo "scale=3; $fin - $start" | bc -iq` #echo sleeping for $elapsed sec /bin/sleep $elapsed done & EOF ) > $TMPFILE chmod +x $TMPFILE ncpus=`xm list | grep Domain-0 | sed 's/ */ /g' | cut -f4 -d" "` echo Busying $ncpus cpus let ncpus="$ncpus-1" while [ $ncpus -ge 0 ]; do echo busying cpu $ncpus taskset -c $ncpus $TMPFILE let ncpus="$ncpus-1" done /bin/rm -rf $TMPFILE