Perl CPU hog
From pressy's brainbackup
Small script I used to see if CPU performance is always the same:
root@server:~/pressy# cat cpuhog.pl #! /usr/bin/perl use strict; use warnings; use Time::HiRes qw/gettimeofday/; use POSIX qw( strftime ); while (1) { my $x = 10000000; my $now = strftime("%d.%m.%Y %H:%M:%S", localtime()); my $starttime=gettimeofday(); while ($x > 0 ) { my $res = ( 3.3333 / 3.14 ); $x = $x-1; } my $execution_time = sprintf "%.2f", (gettimeofday() - $starttime); print "$now - $execution_time\n"; sleep (5); } root@server:~/pressy#