nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gamnit: make `SpriteSet` public so clients can use its services
[nit.git]
/
benchmarks
/
bench_common.sh
diff --git
a/benchmarks/bench_common.sh
b/benchmarks/bench_common.sh
index
1efac25
..
dfdbc6b
100644
(file)
--- a/
benchmarks/bench_common.sh
+++ b/
benchmarks/bench_common.sh
@@
-13,6
+13,14
@@
# See the License for the specific language governing permissions and
# limitations under the License.
# See the License for the specific language governing permissions and
# limitations under the License.
+# Global variables
+
+# Number of times a command must be run with bench_command
+count=1
+
+# User time limit (in second) before a command is aborted
+usertimelimit=120
+
# Common functions for all the bench scripts
# Run a single command multiple time and store the execution times
# Common functions for all the bench scripts
# Run a single command multiple time and store the execution times
@@
-41,9
+49,13
@@
function bench_command()
# Execute the commands $count times
for i in `seq 1 "$count"`; do
# Execute the commands $count times
for i in `seq 1 "$count"`; do
- /usr/bin/time -f "%U" -o "$timeout" -a "$@" > $outputopts 2>&1 || { failed=true; die "$1: failed"; }
+ (
+ ulimit -t "$usertimelimit" 2> /dev/null
+ /usr/bin/time -f "%U" -o "$timeout" -a "$@" > $outputopts 2>&1
+ ) || { err=$?; failed=true; die "$1: failed with $err"; }
echo -n "$i. "
tail -n 1 "$timeout"
echo -n "$i. "
tail -n 1 "$timeout"
+ test -n "$failed" && break
done
line=`compute_stats "$timeout"`
done
line=`compute_stats "$timeout"`