Permalink
Browse files

use vips7 interface, locate time program

don't use the vips8 cli interface, it's broken on older vipses

find the real "time" program rather than assuming it's in /usr/bin
  • Loading branch information...
1 parent 4162f4e commit 060eeeff69b632e00dbcf00180231e74a951b66d @jcupitt committed Jun 26, 2012
Showing with 15 additions and 6 deletions.
  1. +2 −0 .gitignore
  2. +13 −6 runner
View
@@ -18,6 +18,8 @@ pkg
output/
+*.swp
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
#
# * Create a file at ~/.gitignore
View
19 runner
@@ -29,17 +29,24 @@ echo -n "test image is" `header -f width $tmp/t.v`
echo " by" `header -f height $tmp/t.v` "pixels"
echo making tiff and jpeg derivatives ...
-vips copy $tmp/t.v $tmp/t.tif
-vips copy $tmp/t.v $tmp/t_tiled.tif[tile]
-vips copy $tmp/t.v $tmp/t.jpg
+vips im_copy $tmp/t.v $tmp/t.tif
+vips im_copy $tmp/t.v $tmp/t_tiled.tif:,tile
+vips im_copy $tmp/t.v $tmp/t.jpg
+
+# we want to use the time program, not the one built into the shell
+time=$(which time)
+if [ $? != 0 ]; then
+ echo "unable to locate 'time' program"
+ exit 1
+fi
# run three times, take the fastest real time
function bestof3() {
prg=$*
- t1=$(/usr/bin/time -f %e $prg 2>&1)
- t2=$(/usr/bin/time -f %e $prg 2>&1)
- t3=$(/usr/bin/time -f %e $prg 2>&1)
+ t1=$($time -f %e $prg 2>&1)
+ t2=$($time -f %e $prg 2>&1)
+ t3=$($time -f %e $prg 2>&1)
if [[ $t2 < $t1 ]]; then
t1=$t2

0 comments on commit 060eeef

Please sign in to comment.