benchmark.pl: Improve help text, add Makefile target

Performing a benchmark on /var/tmp now is as easy as
"make benchmark".
This commit is contained in:
Jakob Unterwurzacher 2014-12-27 14:52:32 +01:00
parent f8a563bdcd
commit 553f65a014
2 changed files with 16 additions and 4 deletions

View File

@ -22,3 +22,7 @@ test:
.PHONY: test-verbose .PHONY: test-verbose
test-verbose: test-verbose:
perl -MTest::Harness -e '$$Test::Harness::verbose=1; runtests @ARGV;' tests/*.t.pl perl -MTest::Harness -e '$$Test::Harness::verbose=1; runtests @ARGV;' tests/*.t.pl
.PHONY: benchmark
benchmark:
sudo tests/benchmark.pl /var/tmp

View File

@ -11,8 +11,8 @@ require("tests/common.pl");
# Download linux-3.0.tar.gz unless it already exists ("-c" flag) # Download linux-3.0.tar.gz unless it already exists ("-c" flag)
sub dl { sub dl {
our $linuxgz = "/tmp/linux-3.0.tar.gz"; our $linuxgz = "/var/tmp/linux-3.0.tar.gz";
print "# downloading linux-3.0.tar.gz... "; print "# downloading linux-3.0.tar.gz (92MiB)... ";
system("wget -nv -c https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.0.tar.gz -O $linuxgz"); system("wget -nv -c https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.0.tar.gz -O $linuxgz");
print "done\n"; print "done\n";
} }
@ -138,7 +138,7 @@ sub benchmark {
system("echo 3 > /proc/sys/vm/drop_caches"); system("echo 3 > /proc/sys/vm/drop_caches");
stopwatch_start("rsync"); stopwatch_start("rsync");
system("rsync -an $dir /tmp"); system("rsync -an $dir $dir/empty-rsync-target");
stopwatch_stop(\@results); stopwatch_stop(\@results);
system("echo 3 > /proc/sys/vm/drop_caches"); system("echo 3 > /proc/sys/vm/drop_caches");
@ -188,7 +188,15 @@ sub tabulate {
sub main { sub main {
if ( $#ARGV < 0 ) { if ( $#ARGV < 0 ) {
print "Usage: test/benchmark.pl MOUNTPOINT [MOUNTPOINT] [...]\n"; print "Usage: test/benchmark.pl DIR1 [DIR2] [...]\n";
print "\n";
print "Arguments:\n";
print " DIRn ... Working directory. This is where the encrypted files\n";
print " are stored. Specifying multiple directories will run\n";
print " the benchmark in each.\n";
print "\n";
print "For details about the testcases see PERFORMANCE.md.\n";
exit(1); exit(1);
} }