benchmark 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/push_gem.yml +5 -5
- data/.github/workflows/test.yml +1 -1
- data/README.md +1 -1
- data/lib/benchmark.rb +20 -6
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 71da3f4deaf010cbee21c6d4b962c8ae7741a9e1efe64de0f183bf34b4d27d8d
|
|
4
|
+
data.tar.gz: c4bb5fc6eca86edcad141451fab6e6f6f1cadd1d3fa5dfdfe73b174ff1b48e67
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: da08f1963ba18421b6dda1f03f1c1ab196913b680de4289387f75b26845f8789c5320cd34dc5765d4ff488730eba5c1fb52673de6e657150dc3f0f73821335f5
|
|
7
|
+
data.tar.gz: 41eb1f1fa53b7da51feacda122f513e2a36a661a82c12f3e239ad384d1f96e090ae9cf412fdb1486b5b391add4c99d540261d980e792381f2954ec8b3f703cab
|
|
@@ -23,24 +23,24 @@ jobs:
|
|
|
23
23
|
|
|
24
24
|
steps:
|
|
25
25
|
- name: Harden Runner
|
|
26
|
-
uses: step-security/harden-runner@
|
|
26
|
+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
|
|
27
27
|
with:
|
|
28
28
|
egress-policy: audit
|
|
29
29
|
|
|
30
|
-
- uses: actions/checkout@
|
|
30
|
+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
31
31
|
|
|
32
32
|
- name: Set up Ruby
|
|
33
|
-
uses: ruby/setup-ruby@
|
|
33
|
+
uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.0
|
|
34
34
|
with:
|
|
35
35
|
bundler-cache: true
|
|
36
36
|
ruby-version: ruby
|
|
37
37
|
|
|
38
38
|
- name: Publish to RubyGems
|
|
39
|
-
uses: rubygems/release-gem@
|
|
39
|
+
uses: rubygems/release-gem@a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1.1.1
|
|
40
40
|
|
|
41
41
|
- name: Create GitHub release
|
|
42
42
|
run: |
|
|
43
43
|
tag_name="$(git describe --tags --abbrev=0)"
|
|
44
44
|
gh release create "${tag_name}" --verify-tag --generate-notes
|
|
45
45
|
env:
|
|
46
|
-
GITHUB_TOKEN: ${{ secrets.
|
|
46
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
data/.github/workflows/test.yml
CHANGED
data/README.md
CHANGED
|
@@ -35,7 +35,7 @@ On my machine (OSX 10.8.3 on i5 1.7 GHz) this generates:
|
|
|
35
35
|
0.350000 0.400000 0.750000 ( 0.835234)
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
This report shows the user CPU time, system CPU time, the sum of
|
|
38
|
+
This report shows the user CPU time, system CPU time, the total time (sum of user CPU time, system CPU time, children's user CPU time, and children's system CPU time), and the elapsed real time. The unit of time is seconds.
|
|
39
39
|
|
|
40
40
|
Do some experiments sequentially using the #bm method:
|
|
41
41
|
|
data/lib/benchmark.rb
CHANGED
|
@@ -30,8 +30,9 @@
|
|
|
30
30
|
#
|
|
31
31
|
# 0.350000 0.400000 0.750000 ( 0.835234)
|
|
32
32
|
#
|
|
33
|
-
# This report shows the user CPU time, system CPU time, the
|
|
34
|
-
#
|
|
33
|
+
# This report shows the user CPU time, system CPU time, the total time
|
|
34
|
+
# (sum of user CPU time, system CPU time, children's user CPU time,
|
|
35
|
+
# and children's system CPU time), and the elapsed real time. The unit
|
|
35
36
|
# of time is seconds.
|
|
36
37
|
#
|
|
37
38
|
# * Do some experiments sequentially using the #bm method:
|
|
@@ -121,7 +122,7 @@
|
|
|
121
122
|
|
|
122
123
|
module Benchmark
|
|
123
124
|
|
|
124
|
-
VERSION = "0.
|
|
125
|
+
VERSION = "0.5.0"
|
|
125
126
|
|
|
126
127
|
BENCHMARK_VERSION = "2002-04-25" # :nodoc:
|
|
127
128
|
|
|
@@ -324,7 +325,20 @@ module Benchmark
|
|
|
324
325
|
Process.clock_gettime(Process::CLOCK_MONOTONIC) - r0
|
|
325
326
|
end
|
|
326
327
|
|
|
327
|
-
|
|
328
|
+
#
|
|
329
|
+
# Returns the elapsed real time used to execute the given block.
|
|
330
|
+
# The unit of time is milliseconds.
|
|
331
|
+
#
|
|
332
|
+
# Benchmark.ms { "a" * 1_000_000_000 }
|
|
333
|
+
# #=> 509.8029999935534
|
|
334
|
+
#
|
|
335
|
+
def ms # :yield:
|
|
336
|
+
r0 = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)
|
|
337
|
+
yield
|
|
338
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond) - r0
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
module_function :benchmark, :measure, :realtime, :ms, :bm, :bmbm
|
|
328
342
|
|
|
329
343
|
#
|
|
330
344
|
# A Job is a sequence of labelled blocks to be processed by the
|
|
@@ -503,7 +517,7 @@ module Benchmark
|
|
|
503
517
|
# accepts the following extensions:
|
|
504
518
|
#
|
|
505
519
|
# <tt>%u</tt>:: Replaced by the user CPU time, as reported by Tms#utime.
|
|
506
|
-
# <tt>%y</tt>:: Replaced by the system CPU time, as reported by #stime (Mnemonic: y of "s*y*stem")
|
|
520
|
+
# <tt>%y</tt>:: Replaced by the system CPU time, as reported by Tms#stime (Mnemonic: y of "s*y*stem")
|
|
507
521
|
# <tt>%U</tt>:: Replaced by the children's user CPU time, as reported by Tms#cutime
|
|
508
522
|
# <tt>%Y</tt>:: Replaced by the children's system CPU time, as reported by Tms#cstime
|
|
509
523
|
# <tt>%t</tt>:: Replaced by the total CPU time, as reported by Tms#total
|
|
@@ -511,7 +525,7 @@ module Benchmark
|
|
|
511
525
|
# <tt>%n</tt>:: Replaced by the label string, as reported by Tms#label (Mnemonic: n of "*n*ame")
|
|
512
526
|
#
|
|
513
527
|
# If +format+ is not given, FORMAT is used as default value, detailing the
|
|
514
|
-
# user, system and real elapsed time.
|
|
528
|
+
# user, system, total and real elapsed time.
|
|
515
529
|
#
|
|
516
530
|
def format(format = nil, *args)
|
|
517
531
|
str = (format || FORMAT).dup
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: benchmark
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yukihiro Matsumoto
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: a performance benchmarking library
|
|
14
13
|
email:
|
|
@@ -37,7 +36,6 @@ licenses:
|
|
|
37
36
|
metadata:
|
|
38
37
|
homepage_uri: https://github.com/ruby/benchmark
|
|
39
38
|
source_code_uri: https://github.com/ruby/benchmark
|
|
40
|
-
post_install_message:
|
|
41
39
|
rdoc_options: []
|
|
42
40
|
require_paths:
|
|
43
41
|
- lib
|
|
@@ -52,8 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
52
50
|
- !ruby/object:Gem::Version
|
|
53
51
|
version: '0'
|
|
54
52
|
requirements: []
|
|
55
|
-
rubygems_version: 3.
|
|
56
|
-
signing_key:
|
|
53
|
+
rubygems_version: 3.6.9
|
|
57
54
|
specification_version: 4
|
|
58
55
|
summary: a performance benchmarking library
|
|
59
56
|
test_files: []
|