cpubusy.vbs

Ever needed to max out the CPU on a Windows OS for testing, here is a quick VBScript to produce 100% CPU Usage..  (Source is from VMware VCP410 Course)


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
WScript.Echo "I did three million sines in " & Int(Timer - before + 0.5) &  " seconds!"
Loop

</pre>
chmod 744 cpubusy.pl
./cpubusy.pl

Terminate it pressing CTRL-C.

<em>#!/usr/bin/perl</em>

<em>$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;
}</em>
<pre>
Advertisements