[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: smart fans



On 8/23/21 3:17 PM, David Christensen wrote:
Here is a Perl one-liner that should peg one core:

$ perl -e "1 while 1"


Here is a Perl one-liner that can do between 0 and 100 percent loading of one core:

2021-08-24 02:13:06 dpchrist@dipsy ~
$ perl -MTime::HiRes=time,sleep -e '$a=$ARGV[0]/1000;$b=(100-$ARGV[0])/1000;while(1){$t=time;1 while time<$t+$a;sleep $b}' 25
^C

2021-08-24 02:13:59 dpchrist@dipsy ~
$ perl -MTime::HiRes=time,sleep -e '$a=$ARGV[0]/1000;$b=(100-$ARGV[0])/1000;while(1){$t=time;1 while time<$t+$a;sleep $b}' 50
^C

2021-08-24 02:14:18 dpchrist@dipsy ~
$ perl -MTime::HiRes=time,sleep -e '$a=$ARGV[0]/1000;$b=(100-$ARGV[0])/1000;while(1){$t=time;1 while time<$t+$a;sleep $b}' 75
^C

2021-08-24 02:14:37 dpchrist@dipsy ~
$ perl -MTime::HiRes=time,sleep -e '$a=$ARGV[0]/1000;$b=(100-$ARGV[0])/1000;while(1){$t=time;1 while time<$t+$a;sleep $b}' 100
^C


David


Reply to: