summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2013-11-18 12:50:10 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2013-11-18 12:50:10 -0800
commit665936aec015e11a47fb0ff2ad7849d4418f2692 (patch)
treedefb235178a42afc0f477b2cf7d38d80b1e6f7ec /bin
parentdefe402b07d35f47ad33adefee69a06cbf2bc306 (diff)
downloadffi-yajl-665936aec015e11a47fb0ff2ad7849d4418f2692.tar.gz
add profiling option to benchmarks
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ffi-yajl-bench19
1 files changed, 18 insertions, 1 deletions
diff --git a/bin/ffi-yajl-bench b/bin/ffi-yajl-bench
index 0ab2f1e..13725a0 100755
--- a/bin/ffi-yajl-bench
+++ b/bin/ffi-yajl-bench
@@ -1,8 +1,25 @@
#!/usr/bin/env ruby
+
$: << File.expand_path(File.join(File.dirname( File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__ ), "../lib"))
+require 'optparse'
require 'ffi_yajl/benchmark'
-FFI_Yajl::Benchmark::Encode.new().run()
+opts = {}
+optparse = OptionParser.new do |o|
+ o.banner = "Usage: ffi-yajl-bench"
+
+ opts[:profile] = false
+ o.on( '-p', '--profile', 'Run perftools.rb profiling' ) do
+ opts[:profile] = true
+ end
+end
+
+optparse.parse!
+if opts[:profile]
+ FFI_Yajl::Benchmark::EncodeProfile.new().run()
+else
+ FFI_Yajl::Benchmark::Encode.new().run()
+end