1 #!/usr/bin/env tclsh8.5
2 # Copyright (C) 2011 Salvatore Sanfilippo
3 # Released under the BSD license like Redis itself
5 proc run-tests branches
{
10 puts "Benchmarking $b"
11 exec -ignorestderr git checkout
$b 2> /dev
/null
12 exec -ignorestderr make clean
2> /dev
/null
14 exec -ignorestderr make
2> /dev
/null
16 if {$branch_id == 0} {
17 puts " copy redis-benchmark from unstable to /tmp..."
18 exec -ignorestderr cp .
/redis-benchmark
/tmp
23 # Start the Redis server
24 puts " starting the server... [exec ./redis-server -v]"
25 set pids
[exec echo
"port 12123\nloglevel warning\n" | .
/redis-server
- > /dev
/null
2> /dev
/null
&]
27 puts " running the benchmark"
28 set output
[exec /tmp
/redis-benchmark
-n 100000 --csv -p 12123]
29 lappend runs
$b $output
30 puts " killing server..."
32 exec kill
-9 [lindex $pids 0]
33 exec kill
-9 [lindex $pids 1]
40 proc get-result-with-name
{output name
} {
41 foreach line
[split $output "\n"] {
42 lassign
[split $line ","] key value
43 set key
[string tolower
[string range
$key 1 end-1
]]
44 set value
[string range
$value 1 end-1
]
45 if {$key eq
[string tolower
$name]} {
52 proc get-test-names output
{
54 foreach line
[split $output "\n"] {
55 lassign
[split $line ","] key value
56 set key
[string tolower
[string range
$key 1 end-1
]]
62 proc combine-results
{results
} {
63 set tests
[get-test-names
[lindex $results 1]]
66 foreach {branch output
} $results {
67 puts [format "%-20s %s" \
68 $branch [get-result-with-name
$output $test]]
75 # Note: the first branch is only used in order to get the redis-benchmark
76 # executable. Tests are performed starting from the second branch.
78 slowset
2.2.0 2.4.0 unstable slowset
80 set results
[run-tests
$branches]
81 puts [combine-results
$results]
84 # Force the user to run the script from the 'utils' directory.
85 if {![file exists speed-regression.tcl
]} {
86 puts "Please make sure to run speed-regression.tcl while inside /utils."
87 puts "Example: cd utils; ./speed-regression.tcl"