#!/usr/bin/perl
 
# This software is distributed under the GNU General Public License.
# http://www.gnu.org/copyleft/gpl.html
 
 
# ----- Test 1 -----
 
print "Starting test 1.\n";
 
$time1 = time;
$count = 0;
 
while ($count < 50000000) {
	$count++;
}
 
$time2 = time;
$t1 = $time2 - $time1;
 
 
# ----- Test 2 -----
 
print "Starting test 2.\n";
 
$time1 = time;
$count = 0;
 
while ($count < 20000000) {
	$madness = "spartaaaaaaaaaa!!!!!";
	$forTheLastTime = "My name is The Plague.";
	$count++;
}
 
$time2 = time;
$t2 = $time2 - $time1;
 
 
# ----- Test 3 -----
 
print "Starting test 3.\n";
 
$time1 = time;
$count = 0;
@zomg = ("");
while ($count < 10000000) {
	$zomg[$count] = "zomg!";
	$count++;
}
 
$time2 = time;
$t3 = $time2 - $time1;
 
 
# ----- Test 4 -----
 
print "Starting test 4.\n";
 
$time1 = time;
$count = 0;
open (MYFILE, '>>temp_data.txt');
 
while ($count < 20000000) {
print MYFILE "Bob\n";
$count++;
}
 
close (MYFILE);
unlink 'temp_data.txt';
$time2 = time;
$t4 = $time2 - $time1;
 
 
 
 
# ----- Summary -----
 
print "\n";
print "CPU: ", ($t1 + $t2) / 2, "\n";
print "CPU / RAM: ", $t3, "\n";
print "Hard disk: ", $t4, "\n";
print "\n";
$to = ($t1 + $t2 + $t3 + $t4) / 4;
print "Avarage: ", $to, "\n";