From 665936aec015e11a47fb0ff2ad7849d4418f2692 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Mon, 18 Nov 2013 12:50:10 -0800 Subject: add profiling option to benchmarks --- bin/ffi-yajl-bench | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'bin/ffi-yajl-bench') 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 -- cgit v1.2.1