rb: Add benchmarking code for Thrift::NonblockingServer
You can override the server to test with the THRIFT_SERVER env var
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@669007 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/rb/Rakefile b/lib/rb/Rakefile
index 41ca65f..04aaff7 100644
--- a/lib/rb/Rakefile
+++ b/lib/rb/Rakefile
@@ -20,8 +20,22 @@
sh 'make', '-C', File.dirname(__FILE__) + "/../../test/rb"
end
-task :'gen-rb' do
- thrift = '../../compiler/cpp/thrift'
+desc 'Compile the .thrift files for the specs'
+task :'gen-rb' => [:'gen-rb-spec', :'gen-rb-benchmark']
+
+THRIFT = '../../compiler/cpp/thrift'
+
+task :'gen-rb-spec' do
dir = File.dirname(__FILE__) + '/spec'
- sh thrift, '--gen', 'rb', '-o', dir, "#{dir}/ThriftSpec.thrift"
+ sh THRIFT, '--gen', 'rb', '-o', dir, "#{dir}/ThriftSpec.thrift"
+end
+
+task :'gen-rb-benchmark' do
+ dir = File.dirname(__FILE__) + '/benchmark'
+ sh THRIFT, '--gen', 'rb', '-o', dir, "#{dir}/Benchmark.thrift"
+end
+
+desc 'Run benchmarking of NonblockingServer'
+task :benchmark do
+ ruby 'benchmark/fairness.rb'
end