aboutsummaryrefslogtreecommitdiffstats
path: root/perftest
diff options
context:
space:
mode:
Diffstat (limited to 'perftest')
-rwxr-xr-xperftest44
1 files changed, 44 insertions, 0 deletions
diff --git a/perftest b/perftest
new file mode 100755
index 0000000..55cb0cb
--- /dev/null
+++ b/perftest
@@ -0,0 +1,44 @@
+#!/bin/sh
+# do a quick performance test of pseudo
+die() {
+ printf "%s\n" "$*" >&2
+ exit 1
+}
+
+doit() (
+ cd $dir
+ printf "%s\n" "Making test data..."
+ time ./makedata
+ printf "%s\n" "Timing tar command."
+ time sh -c 'tar cf - dir_[0-9] | tar -C new -xf -'
+ printf "%s\n" "Timing find command."
+ time find new -perm 0100 -exec true {} +
+ printf "%s\n" "Timing rm."
+ time rm -rf dir_[0-9] new
+)
+
+[ -x bin/pseudo ] || die "You need a bin/pseudo to test."
+case $# in
+0) dir="perftest.d";;
+1) [ -d "$1" ] || die "Specify an existing directory to test in."
+ dir="$1/perftest.d"
+ ;;
+*) die "Usage: perftest [directory]"
+ ;;
+esac
+
+case `id -u` in
+0) printf "%s\n" "Running test."
+ doit
+ printf "%s\n" "Done."
+ ;;
+*) [ -d $dir ] && die "$dir directory already exists, delete it if you're done."
+ mkdir $dir
+ mkdir $dir/new
+ cc -o $dir/makedata makedata.c
+ printf "%s\n" "Running performance test (total time at end)"
+ time bin/pseudo ./perftest $1
+ rm -rf $dir
+ rm -f makedata
+ ;;
+esac