[llvm-commits] CVS: llvm-test/RunSafely.sh

Chris Lattner lattner at cs.uiuc.edu
Sat Nov 6 11:37:17 PST 2004



Changes in directory llvm-test:

RunSafely.sh updated: 1.14 -> 1.15
---
Log message:

Use Awk to add a "program" line to the output, which contains the user+system
time.  Thanks to Reid for actually doing all of the work :)


---
Diffs of the changes:  (+7 -1)

Index: llvm-test/RunSafely.sh
diff -u llvm-test/RunSafely.sh:1.14 llvm-test/RunSafely.sh:1.15
--- llvm-test/RunSafely.sh:1.14	Sat Nov  6 12:07:06 2004
+++ llvm-test/RunSafely.sh	Sat Nov  6 13:37:04 2004
@@ -36,7 +36,13 @@
 # we tell time to launch a shell which in turn executes $PROGRAM with the
 # necessary I/O redirection.
 #
-(time -p sh -c "$PROGRAM $* > $OUTFILE 2>&1 < $INFILE") > $OUTFILE.time 2>&1
+(time -p sh -c "$PROGRAM $* > $OUTFILE 2>&1 < $INFILE") 2>&1 | awk -- '\
+BEGIN     { cpu = 0.0; }
+/^real/   { /* IGNORE */; print }
+/^user/   { cpu += $2; print }
+/^sys/    { cpu += $2; print }
+!/^real/ && !/^user/ && !/^sys/  { print }
+END       { printf("program %f\n", cpu); }' > $OUTFILE.time
 
 if test $? -eq 0
 then






More information about the llvm-commits mailing list