2013年9月21日土曜日

Linux/メモリ負荷 わざと負荷をかける.sh

●MEMORY
[root@server01 ~]
# chmod 755 membusy.pl 
[root@server01 ~]
# ./membusy.pl & 

[root@server01 ~]# cat cpubusy.pl #!/usr/bin/perl 
# cpubusy.pl

$goal = 1000000; 

while (1) { 
$before = time(); 
for ($i = 0; $i < $goal; $i ++) { 
$x = 0.000001; 
$y = sin($x); 
$y = $y + 0.00001; 
} 
$y += 0.01; 
# print "One million sin: ", time() - $before, " seconds!\n"; 
} [root@server01 ~]# chmod 755 cpubusy.pl [root@server01 ~]# ./cpubusy.pl &