Class: BenchmarkDriver::Runner::Memory
- Inherits:
-
Object
- Object
- BenchmarkDriver::Runner::Memory
- Defined in:
- lib/benchmark_driver/runner/memory.rb
Overview
Max resident set size
Constant Summary collapse
- METRIC =
BenchmarkDriver::Metric.new( name: 'Max resident set size', unit: 'bytes', larger_better: false, worse_word: 'larger', )
- Job =
JobParser returns this,
BenchmarkDriver::Runner.runner_forsearches “*::Job” Class.new(BenchmarkDriver::DefaultJob)
- JobParser =
Dynamically fetched and used by
BenchmarkDriver::JobParser.parse BenchmarkDriver::DefaultJobParser.for(klass: Job, metrics: [METRIC])
Instance Method Summary collapse
-
#initialize(config:, output:) ⇒ Memory
constructor
A new instance of Memory.
-
#run(jobs) ⇒ Object
This method is dynamically called by
BenchmarkDriver::JobRunner.run.
Constructor Details
#initialize(config:, output:) ⇒ Memory
Returns a new instance of Memory.
21 22 23 24 |
# File 'lib/benchmark_driver/runner/memory.rb', line 21 def initialize(config:, output:) @config = config @output = output end |
Instance Method Details
#run(jobs) ⇒ Object
This method is dynamically called by BenchmarkDriver::JobRunner.run
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/benchmark_driver/runner/memory.rb', line 28 def run(jobs) # Currently Linux's time(1) support only... if Etc.uname.fetch(:sysname) != 'Linux' raise "memory output is not supported for '#{Etc.uname[:sysname]}' for now" end if jobs.any? { |job| job.loop_count.nil? } jobs = jobs.map do |job| job.loop_count ? job : Job.new(job.to_h.merge(loop_count: 1)) end end @output.with_benchmark do jobs.each do |job| @output.with_job(name: job.name) do job.runnable_execs(@config.executables).each do |exec| value = BenchmarkDriver::Repeater.with_repeat(config: @config, larger_better: false) do run_benchmark(job, exec: exec) end @output.with_context(name: exec.name, executable: exec) do @output.report(values: { METRIC => value }, loop_count: job.loop_count) end end end end end end |