module Rbenchmarker
Constants
- LOG_DIRECTORY
- LOG_FILE_NAME
- VERSION
Public Class Methods
add_class(value)
click to toggle source
# File lib/rbenchmarker.rb, line 41 def self.add_class(value) @rbench_classes << value end
add_module(value)
click to toggle source
# File lib/rbenchmarker.rb, line 53 def self.add_module(value) @rbench_modules << value end
add_module_with_has_methods_list(key, value)
click to toggle source
# File lib/rbenchmarker.rb, line 77 def self.add_module_with_has_methods_list(key, value) @module_with_has_methods_lists[key] = value end
add_object_with_modules(value)
click to toggle source
# File lib/rbenchmarker.rb, line 65 def self.add_object_with_modules(value) @object_with_has_modules << value end
add_report(key, value)
click to toggle source
# File lib/rbenchmarker.rb, line 89 def self.add_report(key, value) @bm_reports[key] = value callbacks_self_add_report(key, value) end
change_output_log_file_path(path_text)
click to toggle source
# File lib/rbenchmarker.rb, line 102 def self.change_output_log_file_path(path_text) @rbenchmarker_log_file_path = path_text end
included(klass)
click to toggle source
# File lib/rbenchmarker/class_methods.rb, line 7 def self.included(klass) klass.extend ClassMethods end
init_log_file_path()
click to toggle source
# File lib/rbenchmarker.rb, line 106 def self.init_log_file_path @rbenchmarker_log_file_path = if Dir.exist? "#{Dir.pwd}/#{LOG_DIRECTORY}" "#{Dir.pwd}/#{LOG_DIRECTORY}/#{LOG_FILE_NAME}" else "#{Dir.pwd}/#{LOG_FILE_NAME}" end end
init_module_with_has_methods_lists()
click to toggle source
# File lib/rbenchmarker.rb, line 81 def self.init_module_with_has_methods_lists @module_with_has_methods_lists = {} end
init_object_with_has_modules()
click to toggle source
# File lib/rbenchmarker.rb, line 69 def self.init_object_with_has_modules @object_with_has_modules = [] end
init_tracking_classes()
click to toggle source
# File lib/rbenchmarker.rb, line 45 def self.init_tracking_classes @rbench_classes = [] end
init_tracking_modules()
click to toggle source
# File lib/rbenchmarker.rb, line 57 def self.init_tracking_modules @rbench_modules = [] end
init_tracking_reports()
click to toggle source
# File lib/rbenchmarker.rb, line 94 def self.init_tracking_reports @bm_reports = {} end
module_with_has_methods_lists()
click to toggle source
# File lib/rbenchmarker.rb, line 73 def self.module_with_has_methods_lists @module_with_has_methods_lists end
object_with_has_modules()
click to toggle source
# File lib/rbenchmarker.rb, line 61 def self.object_with_has_modules @object_with_has_modules end
output_log_file_path()
click to toggle source
# File lib/rbenchmarker.rb, line 98 def self.output_log_file_path @rbenchmarker_log_file_path end
setup(switch: 'on', output_log_path: nil, except_classes: [], except_modules: [])
click to toggle source
This method must read (execute) after reading all files except this configuration file.
# File lib/rbenchmarker.rb, line 115 def self.setup(switch: 'on', output_log_path: nil, except_classes: [], except_modules: []) return if %w[off OFF].include?(switch) return puts 'setup has already been executed.' if setup_executed? setup_validation_check(except_classes, except_modules, output_log_path) change_output_log_file_path "#{output_log_path}/#{LOG_FILE_NAME}" if output_log_path tracking_classes.each do |benchmark_target_class, options| next if except_classes.include?(benchmark_target_class) benchmark_target_class.call_register_rbenchmarker_methods(options) end tracking_modules.each do |benchmark_target_module, options| next if except_modules.include?(benchmark_target_module) benchmark_target_module.call_register_rbenchmarker_methods(options) end Rbenchmarker::PrependModules.register_rbenchmarker_methods_to_module( object_with_has_modules, module_with_has_methods_lists, except_modules ) Rbenchmarker::RbenchmarkerLog.init_log setup_executed! end
setup_executed!()
click to toggle source
# File lib/rbenchmarker.rb, line 29 def self.setup_executed! @setup_executed = true end
setup_executed?()
click to toggle source
# File lib/rbenchmarker.rb, line 25 def self.setup_executed? @setup_executed end
setup_no_executed!()
click to toggle source
# File lib/rbenchmarker.rb, line 33 def self.setup_no_executed! @setup_executed = false end
tracking_classes()
click to toggle source
# File lib/rbenchmarker.rb, line 37 def self.tracking_classes @rbench_classes end
tracking_modules()
click to toggle source
# File lib/rbenchmarker.rb, line 49 def self.tracking_modules @rbench_modules end
tracking_reports()
click to toggle source
# File lib/rbenchmarker.rb, line 85 def self.tracking_reports @bm_reports end
Private Class Methods
callbacks_self_add_report(key, value)
click to toggle source
# File lib/rbenchmarker.rb, line 153 def self.callbacks_self_add_report(key, value) Rbenchmarker::RbenchmarkerLog.puts_log(key, value) end
setup_validation_check(except_classes, except_modules, output_log_path)
click to toggle source
private
# File lib/rbenchmarker.rb, line 145 def self.setup_validation_check(except_classes, except_modules, output_log_path) raise ExceptClassDesignationError unless except_classes.is_a?(Array) raise ExceptClassDesignationError unless except_classes.all? { |obj| obj.class.to_s == 'Class' } raise ExceptModuleDesignationError unless except_modules.is_a?(Array) raise ExceptModuleDesignationError unless except_modules.all? { |obj| obj.class.to_s == 'Module' } raise TargetDirPathError if output_log_path && !Dir.exist?(output_log_path) end