Module: Perfer
- Defined in:
- lib/perfer.rb,
lib/perfer/cli.rb,
lib/perfer/git.rb,
lib/perfer/job.rb,
lib/perfer/store.rb,
lib/perfer/errors.rb,
lib/perfer/result.rb,
lib/perfer/session.rb,
lib/perfer/platform.rb,
lib/perfer/formatter.rb,
lib/perfer/statistics.rb,
lib/perfer/configuration.rb,
lib/perfer/grapher/r_grapher.rb,
lib/perfer/job/iteration_job.rb,
lib/perfer/job/input_size_job.rb,
lib/perfer/formatter/results_formatter.rb,
lib/perfer/formatter/session_formatter.rb,
lib/perfer/formatter/measurements_formatter.rb
Defined Under Namespace
Modules: Errors, Formatter, Git, Platform Classes: CLI, Configuration, Error, InputSizeJob, IterationJob, Job, MeasurementsFormatter, RGrapher, Result, ResultsFormatter, Session, SessionFormatter, Statistics, Store
Constant Summary collapse
- DIR =
Path('~/.perfer')
- TIMES_FIELDS =
[:real, :utime, :stime, :cutime, :cstime].freeze
Class Attribute Summary collapse
-
.configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
.sessions ⇒ Object
readonly
Returns the value of attribute sessions.
Class Method Summary collapse
-
.iterate(title = nil, *args, &block) ⇒ Object
Shortcut for Perfer.session { |s| s.iterate … }.
- .measure(&block) ⇒ Object
- .reset ⇒ Object
- .session(name = nil, &block) ⇒ Object
Class Attribute Details
.configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
23 24 25 |
# File 'lib/perfer.rb', line 23 def configuration @configuration end |
.sessions ⇒ Object (readonly)
Returns the value of attribute sessions.
23 24 25 |
# File 'lib/perfer.rb', line 23 def sessions @sessions end |
Class Method Details
.iterate(title = nil, *args, &block) ⇒ Object
Shortcut for Perfer.session { |s| s.iterate … }
35 36 37 38 39 40 |
# File 'lib/perfer.rb', line 35 def iterate(title = nil, *args, &block) Session.new(Path.file(caller)) { |session| title ||= session.object.name session.iterate(title, *args, &block) } end |
.measure(&block) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/perfer.rb', line 42 def measure(&block) times_before = Process.times real = Hitimes::Interval.measure(&block) times = Process.times data = { :real => real } times.members.each { |field| # precision of times(3) or getrusage(2) is no more than 1e-6 value = (times[field] - times_before[field]).round(6) if value != 0.0 # do not keep these if they measured nothing data[field.to_sym] = value end } data end |
.reset ⇒ Object
25 26 27 28 |
# File 'lib/perfer.rb', line 25 def reset @configuration = Configuration.new @sessions = [] end |