Module: AdLint::Benchmark
- Defined in:
- lib/adlint/benchmark/driver.rb,
lib/adlint/benchmark/target.rb,
lib/adlint/benchmark/version.rb,
lib/adlint/benchmark/target/screen_4_0_3_process_c.rb,
lib/adlint/benchmark/target/screen_4_0_3_process_c_small.rb
Overview
:nodoc:
Defined Under Namespace
Modules: Target Classes: AnalysisTarget
Constant Summary collapse
- MAJOR_VERSION =
:nodoc:
1
- MINOR_VERSION =
1
- PATCH_VERSION =
0
- RELEASE_DATE =
"2012-11-29"
- SHORT_VERSION =
"#{MAJOR_VERSION}.#{MINOR_VERSION}.#{PATCH_VERSION}"
- VERSION =
"#{SHORT_VERSION} (#{RELEASE_DATE})"
- COPYRIGHT =
<<EOS ___ ____ __ ___ _________ / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer / /| | / / / / / / / |/ / / / AdLint - Advanced Lint / __ |/ /_/ / /___/ / /| / / / /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd. adlint-benchmark is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. adlint-benchmark is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with adlint-benchmark. If not, see <http://www.gnu.org/licenses/>. EOS
- AUTHOR =
<<EOS Written by Yutaka Yanoh of OGIS-RI Co.,Ltd. EOS
Class Method Summary collapse
- ._nullify_console_output(&block) ⇒ Object
- ._run(target_name) ⇒ Object
- .run(target_name, count, print_time = false) ⇒ Object
Class Method Details
._nullify_console_output(&block) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/adlint/benchmark/driver.rb', line 60 def _nullify_console_output(&block) orig_stdout = $stdout.dup orig_stderr = $stderr.dup dev_null = File.open(File::NULL, "w") $stdout.reopen(dev_null) $stderr.reopen(dev_null) yield ensure $stdout.reopen(orig_stdout) $stderr.reopen(orig_stderr) end |
._run(target_name) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/adlint/benchmark/driver.rb', line 51 def _run(target_name) if target = AnalysisTarget.load(target_name) _nullify_console_output { target.analyze } else raise "no such target `#{target_name}'" end end |
.run(target_name, count, print_time = false) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/adlint/benchmark/driver.rb', line 36 def run(target_name, count, print_time = false) if print_time require "benchmark" ::Benchmark.bm(target_name.length + 5, "total") do |x| total = count.times.reduce(::Benchmark::Tms.new) { |t, i| t += x.report("#{target_name} ##{i + 1}") { _run(target_name) } } [total] end else count.times { _run(target_name) } end end |