K’s weblog…

Script para sacarle carga a un CPU en Perl

by K on Jul.29, 2005, under Linux, Principal, Tutoriales, Vmware

haciendo un poquito de research, me puse a buscar un script para generar carga en los CPU de las virtual machines, con un poco de research modifique algo que encontre hecho en perl, asi que corre en todos los OS…

la adveretencia de siempre cuidado con las comillas al copiar y pegar.


#!/usr/bin/perl

#cpu stress script

$end = 1000000;
while (1) {
$before = time();
for ($i = 0; $i < $end; $i ++) {
$x = 0.000001;
$y = sin($x);
$y = $y + 0.00001;
}
$y += 0.01;
print "Calculated 1000000 sines in ", time() -$before, "seconds!\n";
}

Comments are closed.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...