#!/usr/bin/perl #Check thoroughly if the system()-calls below do what you want! my $tmp = "/tmp/perftest.times"; my $HOST = "talos"; my $RHOSTIP = "137.226.194.27"; my $LHOSTIP = "137.226.194.109"; select STDOUT; $| = 1; # unbuffered output runTest("LocalLoop",20,1000); #runTest("LocalLoop",50,10000); #runTest("LocalExternalLoop",50,100); #runTest("LocalExternalLoop",50,1000); #runTest("LocalExternalNoLoop",50,1000); #runCSTest("Reader", "Writer",20,100); #runCSTest("ReaderNoLoop", "WriterNoLoop",20,100); #runCSTest("Reader", "Writer",50,1000); sub runTest { local($program,$runs,$count) = @_; print "Running $program $runs times, $count messages each: "; my $file = "$tmp/$program.$count"; unlink $file; my $i = 0; while ($i < $runs) { print "."; # system("CNT=$count bash -c 'time -a -o $file ./$program >/dev/null'"); system("TIMEFORMAT='real\t%3lR\tuser\t%3lU\tsys\t%3lS' CNT=$count bash -c 'time ./$program' 2>>$file"); $i++; } print "\n"; } sub runCSTest { local($server,$client,$runs,$count) = @_; print "Running $server/$client $runs times, $count messages each: "; my $file = "$tmp/local.$client$server.$count"; unlink $file; my $i = 0; while ($i < $runs) { print "."; # system("ssh -f $HOST /home/stolz/Linux/dhs/perftest/$server -i $RHOSTIP"); system("./$server &"); sleep 1; # system("CNT=$count bash -c 'time -a -o $file ./$client"); # >/dev/null'"); system("TIMEFORMAT='real\t%3lR\tuser\t%3lU\tsys\t%3lS' CNT=$count bash -c 'time ./$client' 2>>$file"); $i++; sleep 2; } print "\n"; }