Module: Viiite

Extended by:
RubyFacts
Defined in:
lib/viiite.rb,
lib/viiite/tms.rb,
lib/viiite/bdb.rb,
lib/viiite/unit.rb,
lib/viiite/suite.rb,
lib/viiite/errors.rb,
lib/viiite/n_times.rb,
lib/viiite/command.rb,
lib/viiite/version.rb,
lib/viiite/reporter.rb,
lib/viiite/bdb/utils.rb,
lib/viiite/benchmark.rb,
lib/viiite/bdb/cached.rb,
lib/viiite/command/run.rb,
lib/viiite/command/plot.rb,
lib/viiite/command/help.rb,
lib/viiite/configuration.rb,
lib/viiite/benchmark/dsl.rb,
lib/viiite/bdb/immediate.rb,
lib/viiite/command/report.rb,
lib/viiite/command/compare.rb,
lib/viiite/command/commons.rb,
lib/viiite/facts/ruby_facts.rb,
lib/viiite/command/plot/to_text.rb,
lib/viiite/command/plot/to_gnuplot.rb,
lib/viiite/command/plot/to_highcharts.rb

Overview

Benchmarking and complexity analyzer utility

Defined Under Namespace

Modules: RubyFacts, Unit, Version Classes: BDB, Benchmark, Command, Configuration, Error, InvalidPattern, NTimes, NoSuchBenchmarkError, Reporter, Suite, Tms

Constant Summary

Boolean =

Much missing boolean type

Myrrha::Boolean
Coercions =

Duplicate, reuse and extend Myrrha default coercions

Myrrha::Coerce.dup.append do |r|
  r.coercion(String, Path){|value, _| Path(value)}
end
VERSION =
Version.to_s

Class Method Summary collapse

Methods included from RubyFacts

short_ruby_description, which_ruby

Class Method Details

.bench(config = nil, path = nil, &block) ⇒ Object

Builds a runner instance via the DSL definition given by the block.

Example

Viiite.bench do |b|
  b.variation_point :ruby_version, Viiite.which_ruby
  b.range_over([100, 1000, 10000, 100000], :runs) do |runs|
    b.variation_point :test, :via_reader do
      b.report{ runs.times{ foo.via_reader } }
    end
    b.variation_point :test, :via_method do
      b.report{ runs.times{ foo.via_method } }
    end
  end
end


45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/viiite.rb', line 45

def self.bench(config = nil, path = nil, &block)
  config, path = nil, config if path.nil?
  if block
    @last_bench = Benchmark.new(config, path, block)
  elsif path
    load(path)
    if @last_bench
      b = Benchmark.new(config, Path(path).expand, @last_bench.definition)
      @last_bench = nil
      b
    end
  end
end

.bm(&block) ⇒ Object

Alias of Viiite.bench for compatibility



60
61
62
63
# File 'lib/viiite.rb', line 60

def self.bm(&block)
  warn "Viiite.bm is deprecated, use Viiite.bench #{caller[0]}"
  bench(&block)
end

.measureObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/viiite.rb', line 18

def self.measure
  t0, r0 = Process.times, Time.now
  yield
  t1, r1 = Process.times, Time.now
  Tms.new(t1.utime  - t0.utime,
          t1.stime  - t0.stime,
          t1.cutime - t0.cutime,
          t1.cstime - t0.cstime,
          r1 - r0)
end

.Tms(*args) ⇒ Object

class Tms



79
80
81
# File 'lib/viiite/tms.rb', line 79

def self.Tms(*args)
  Viiite::Tms.new(*args)
end