Created
September 28, 2022 13:20
-
-
Save blzzua/dbffa9e444bdfcf284f8a7f481ba0275 to your computer and use it in GitHub Desktop.
Generates a cpu load average and maintains it in the form of a sinusoid, with a period in time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAXJOBS=20 | |
for i in `seq 1 $MAXJOBS` ; do nice -n 19 gzip -c /dev/zero > /dev/null & done | |
while true | |
do | |
LA=`</proc/loadavg` && LA=${LA// */} | |
H=$(date +%M) && H=${H/0/} | |
G=`echo "(${MAXJOBS}/2)*(s(2*3.14159*${H}/60) +1 ) <= ${LA}" | bc -l` | |
test ${G} -lt 1 && for i in `seq 1 $MAXJOBS` ; do kill -SIGCONT %$i ; done || for i in `seq 1 $MAXJOBS` ; do kill -SIGSTOP %$i; done | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment