Task to busy one CPU 100% for a period of time?

Ian Smith smithi at nimnet.asn.au
Wed Jan 13 14:23:19 UTC 2016


On Thu, 14 Jan 2016 00:57:58 +1100, Ian Smith wrote:

 > echo "`date` $me running $tasks load1 tasks for ${secs}s"
 > bgpids=''
 > done=0; trap "done=1; sleep=0" int quit term

Oops, s/sleep/secs/ .. only added for extremely unlikely case one might 
hit ^C during starting up the load1 task/s, so untested.

 > while [ $done -eq 0 ]; do
 > 	while [ $tasks -gt 0 ]; do
 > 		~/bin/load1 &
 > 		bgpids="$bgpids $!"
 > 	tasks=$((tasks-1))
 > 	done
 > 	sleep $secs
 > 	done=1
 > done

And a missed tab .. too darn hot tonight :)

cheers, Ian


More information about the freebsd-questions mailing list