Links
From csi702
1 Links
- Details on gcc optimization:
http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
2 Other Stuff
2.1 Timing Script
"A Timing Script", a quick perl script for running a program x number of times and getting the average running time and standard deviation on the running time. On a linux machine, copy the code below into a file named "ats.pl". Then run "chmod +x ats.pl". Examples of usage:
./ats.pl 5 command arg1 arg2 arg3
or
./ats.pl 3 echo "hiho" Loop Time 0 0.0 1 0.0 2 0.0 AVG 0.000 DEV 0.000
Feel free to alter this code as you please or drop me an email if you have any comments/questsions.
#!/usr/bin/perl
#A Timing Script
#Send support questions here-> adamcadien 'at' gmail 'dot' com
#Usage: ./ats.pl <#runs> <executable name> <arguements>
use strict;
if(@ARGV<3){
print "ats.pl wasn't used properly\n";
print "usage: ./ats.pl <#runs> <executable name> <arguements>\n";
exit;
}
my $looplen=shift;
my $script=shift;
my $args;
while ($_=shift){
$args.=$_." ";
}
print "Command: ./$script $args\n";
my $avg=0;
my @stats;
print "Loop\tTime\n";
foreach my $i (0..$looplen-1) {
my $res=`/usr/bin/time ./$script $args 2>&1`;
if($res =~ /(\d\.\d\d)user/){
push @stats,$1;
$avg+=$1;
print "$i\t$1\n";
}
}
$avg/=$looplen;
printf("AVG\t%3.3f\n",$avg);
my $sdv;
foreach my $i (@stats){
$sdv+=($i-$avg)**2;
}
$sdv/=$looplen;
$sdv=sqrt $sdv;
printf("DEV\t%3.3f\n",$sdv);
