File: benchmark.sh

package info (click to toggle)
araneida 0.90.1-dfsg-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 700 kB
  • ctags: 643
  • sloc: lisp: 4,878; perl: 166; sh: 109; makefile: 34
file content (64 lines) | stat: -rw-r--r-- 2,123 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
SBCL=sbcl
CMUCL=cmucl

# The test program has a unique string that it is supposed to produce and look for
# to make sure that we are not dealing with a stale server.
# Not that that's ever happened to me...twice....
randomtext=${RANDOM}${RANDOM}${RANDOM}${RANDOM} # I make it long-ish so as to make it improbable to find naturally

# In order to add a new lisp to the test suite, you need to alter 3 areas in test-server.lisp
#    - Add any backtrace information you want to *invoke-debugger-hook*
#    - Alter GET-RANDOM-TEXT to properly get the random text from the command line
#    - Below :testend add a quit function, or whatever will make your lisp properly terminate
#
# Then add the proper call to the case statement below.
#
# I believe the test suite will work fine for both threaded and non-threaded servers,
# but YMMV.

if [[ -z "$2" ]]; then
	BENCHTIME="30s"
else
	BENCHTIME="$2"
fi
if [[ -z "$3" ]]; then
	BENCHCONCUR="25"
else
	BENCHCONCUR="$3"
fi
BENCHMARK="siege -c$BENCHCONCUR -i -t$BENCHTIME -f urls.txt"

case "$1" in
	prepare)
	echo "Dumping urls.txt"
	cat test-server-walker.pl | grep '^urlin' | grep -v quit | grep -v 'auth' | awk -F '",?' '{print "http://localhost:15840" $2}' > urls.txt
	;;
    sbcl)
	echo "Running benchmark suite for SBCL."
	$SBCL --noprint --load "test-server.lisp" --end-toplevel-options "$randomtext" > /dev/null &
	sleep 10
	$BENCHMARK
	GET 'http://localhost:15840/quit' &> /dev/null;
	;;
    sbcl-serve-event)
	echo "Running benchmark suite for SBCL (force serve-event)."
	$SBCL --noprint --load "test-server.lisp" --end-toplevel-options "$randomtext" "serve-event" > /dev/null &
	sleep 10
	$BENCHMARK
	GET 'http://localhost:15840/quit' &> /dev/null;
	;;
    cmucl)
	echo "Running benchmark suite for CMUCL."
	$CMUCL -quiet -load "test-server.lisp" "$randomtext" > /dev/null &
	sleep 10
	$BENCHMARK
	GET 'http://localhost:15840/quit' &> /dev/null;
	;;
    *)
	echo "Usage: sh benchmark.sh <lisp name> [how long to run] [# of concurrent sessions]"
	echo "       sh benchmark.sh prepare"
	echo "I currently know about: sbcl sbcl-serve-event cmucl"
	exit 1
esac