diff --git a/lib/mruby/build.rb b/lib/mruby/build.rb index 66005a6df..771aa7f3e 100644 --- a/lib/mruby/build.rb +++ b/lib/mruby/build.rb @@ -123,6 +123,7 @@ module MRuby @enable_test = false @enable_lock = true @enable_presym = true + @enable_benchmark = true @mrbcfile_external = false @internal = internal @toolchains = [] @@ -232,6 +233,14 @@ module MRuby @cxx_abi_enabled = true end + def benchmark_enabled? + @enable_benchmark + end + + def disable_benchmark + @enable_benchmark = false + end + def compile_as_cxx(src, cxx_src = nil, obj = nil, includes = []) # # If `cxx_src` is specified, this method behaves the same as before as diff --git a/tasks/benchmark.rake b/tasks/benchmark.rake index 12e0d4602..b32d165bf 100644 --- a/tasks/benchmark.rake +++ b/tasks/benchmark.rake @@ -9,11 +9,8 @@ def bm_files end def build_config_name - if !ENV['MRUBY_CONFIG'].to_s.empty? - File.basename(ENV['MRUBY_CONFIG'], '.rb').gsub('build_config_', '') - else - "bm" - end + path = MRuby::Build.mruby_config_path + File.basename(path, '.rb').gsub('build_config_', '') end def plot_file @@ -21,6 +18,8 @@ def plot_file end def plot + raise "no build target to benchmark against" if $dat_files.empty? + opts_file = "#{MRUBY_ROOT}/benchmark/plot.gpl" opts = File.read(opts_file).each_line.to_a.map(&:strip).join(';') @@ -46,11 +45,13 @@ def plot p.puts "e" end end + + puts "Benchmark results output to #{plot_file}" end MRuby.each_target do |target| - next if target.name == 'host' || target.internal? + next if !target.benchmark_enabled? || target.internal? mruby_bin = "#{target.build_dir}/bin/mruby" bm_files.each do |bm_file|