Assume Process::CLOCK_MONOTONIC exists (possibly emulated) and
there is no need to bloat our code by defining a compatibility
constant.
* lib/benchmark.rb: just use Process::CLOCK_MONOTONIC
[ruby-core:69390]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
In addition to being unaffected by _offset_ correction,
CLOCK_MONOTONIC_RAW is also unaffected by _frequency_ correction,
making it unsuitable for measuring real time on systems where the
clock is always running too fast or slow.
CLOCK_MONOTONIC (without _RAW) is the correct clock, as it is unaffected
by _offset_ correction (due to human error or battery replacement), but
still takes _frequency_ correction into account for clocks which
consistently run too fast or slow.
Thanks to Vít Ondruch for reporting the issue on ARM [Bug #10202]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/benchmark.rb (BENCHMARK_CLOCK): Process::CLOCK_MONOTONIC_RAW
is not supported on old linux.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/benchmark.rb (BENCHMARK_CLOCK): prefer Process::CLOCK_MONOTONIC_RAW
if available to more accurate measure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
https://github.com/eregon/ruby/tree/benchmark
patched by Benoit Daloze. [ruby-core:37593] [Bug #4940]
* lib/benchmark (Benchmark#bmbm): bmbm should be consistent with bm
for the return value.
* test/benchmark: remove preemptive test instead of skipping
I removed the preemptive test I wrote for Feature #4197.
I'll add it back when the implementation will be able to satisfy it.
* lib/benchmark (Benchmark#bmbm): remove useless explicit call,
#format is an alias of #to_s test/benchmark: add a test for
format of long time.
* lib/benchmark: fix label width: always add 1 to ensure there is a
space delimiter even with times over 100s
When I asked for Feature #4197, I wanted to make delimiting spaces
consistent for #bm and #bmbm.
But with times over 100s, the output contains no space between the
label and the first time (user).
Now both ensure there is always a space, even if that means 3 spaces
with times under 10s (because it is formatted as %10.6f)
* test/benchmark: let labels be a constant
lib/benchmark (Benchmark#realtime): avoid creating an unused Proc
lib/benchmark (Benchmark#benchmark): use ensure clause to restore
STDOUT.sync, as in #bmbm
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
patched by Benoit Daloze [ruby-core:33846] [ruby-dev:43143]
merged from https://github.com/eregon/ruby/commits/benchmark
* lib/benchmark (Report#width): update documentation
* lib/benchmark: document the return value of #benchmark and the
:list attribute in Report
* lib/benchmark (Tms#format): rename variables, use String#%
instead of Kernel.format
* lib/benchmark: remove undocumented Benchmark::times (an alias
of Process::times used twice)
* lib/benchmark (#benchmark): use label_width for the caption
* lib/benchmark (Tms#initialize): rename variables
* lib/benchmark: allow title to not be a String and call #to_s
* lib/benchmark (Benchmark#bm): return an Array of the times with
the labels
* lib/benchmark: correct output for Benchmark#bmbm
(remove the extra space)
* lib/benchmark: add a few tests for Benchmark::Tms output
* lib/benchmark: improve style (enumerators, ljust, unused vars)
* lib/benchmark: add spec about output and return value
* lib/benchmark: improve basic style and consistency
no parenthesis for print and use interpolation instead of printf
* lib/benchmark: remove unnecessary conversions and variables
* lib/benchmark: correct indentation
* lib/benchmark: rename the FMTSTR constant and variable to FORMAT
* lib/benchmark: remove useless exception
* test/benchmark: remove unused variable warnings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[ruby-dev:40906]
* test/benchmark/test_benchmark.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
a bit faster. a patch from Alexander Dymo <dymo@ukrpost.ua> in
[ruby-core:15337].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c (env_delete_m): execute block only if deleting key does
not exist.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* re.c (rb_reg_match2): ditto.
* configure: merge Jonathan Baker's large file support patch
[ruby-talk:35316], with read_all patch in [ruby-talk:35470].
* eval.c (rb_f_abort): optional message argument that be printed
on termination. [new]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e