# Cpu busy scripts

From Wiki

# Windows

Dim goal Dim before Dim x Dim y Dim i goal = 2181818 Do While True before = Timer For i = 0 to goal x = 0.000001 y = sin(x) y = y + 0.00001 Next y = y + 0.01 Loop

# Linux

#!/usr/bin/perl $goal = 2181818; while (TRUE) { for ($i=0; $i<=$goal; $i++) { $x = 0.000001; $y = sin($x); $y = $y + 0.00001; } next; $y = $y + 0.01; }

#!/usr/bin/perl # cpubusy.pl if ($^O =~ /Win/) { $goal = 2700000; } else { $goal = 3000000; } while (1) { $before = time(); for ($i = 0; $i < $goal; $i ++) { $x = 0.000001; $y = sin($x); $y = $y + 0.00001; } $y += 0.01; print "I did three million sines in ", time() - $before, " seconds!\n"; }