benchmark_driver 0.14.12 → 0.14.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/benchmark_driver/runner/memory.rb +22 -6
- data/lib/benchmark_driver/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22df737d5e378a5ea29b9667ffc96fc767427f27b0bb9e21b548b4fb5caf4463
|
4
|
+
data.tar.gz: fe45db762725218c739bb412a06189221fb6f5cb0e89a27071a1d302ce90c5bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d903d9b8d9b821f6eefbd21defc201714f6ec2e5436ca9374228756873a7693f37c4974cff38bfb2da01711bf394b8c516c8f6ce974ad19574a484ed780d4a7
|
7
|
+
data.tar.gz: 9b7e96da26336be348c4660328330c467f4f92ded7ad60538c23a6bfeb72fb58eddc8e7b7f1cedcccd30d340f34869191b71466e093c2ff93e2b6517ec658c87
|
data/CHANGELOG.md
CHANGED
@@ -29,7 +29,12 @@ class BenchmarkDriver::Runner::Memory
|
|
29
29
|
# @param [Array<BenchmarkDriver::Default::Job>] jobs
|
30
30
|
def run(jobs)
|
31
31
|
# Currently Linux's time(1) support only...
|
32
|
-
|
32
|
+
case Etc.uname.fetch(:sysname)
|
33
|
+
when 'Linux'
|
34
|
+
@time_command = ['/usr/bin/time']
|
35
|
+
when 'Darwin'
|
36
|
+
@time_command = ['/usr/bin/time', '-l']
|
37
|
+
else
|
33
38
|
raise "memory output is not supported for '#{Etc.uname[:sysname]}' for now"
|
34
39
|
end
|
35
40
|
|
@@ -69,12 +74,9 @@ class BenchmarkDriver::Runner::Memory
|
|
69
74
|
)
|
70
75
|
|
71
76
|
with_script(benchmark.render) do |path|
|
72
|
-
output = IO.popen([
|
77
|
+
output = IO.popen([*@time_command, *context.executable.command, path], err: [:child, :out], &:read)
|
73
78
|
if $?.success?
|
74
|
-
|
75
|
-
raise "Unexpected format given from /usr/bin/time:\n#{out}" unless match_data[:maxresident]
|
76
|
-
|
77
|
-
Integer(match_data[:maxresident]) * 1000.0 # kilobytes -> bytes
|
79
|
+
extract_maxresident_from_time_output(output)
|
78
80
|
else
|
79
81
|
$stdout.print(output)
|
80
82
|
BenchmarkDriver::Result::ERROR
|
@@ -82,6 +84,20 @@ class BenchmarkDriver::Runner::Memory
|
|
82
84
|
end
|
83
85
|
end
|
84
86
|
|
87
|
+
def extract_maxresident_from_time_output(output)
|
88
|
+
case Etc.uname.fetch(:sysname)
|
89
|
+
when 'Linux'
|
90
|
+
pattern = /^(?<user>\d+.\d+)user\s+(?<system>\d+.\d+)system\s+(?<elapsed1>\d+):(?<elapsed2>\d+.\d+)elapsed.+\([^\s]+\s+(?<maxresident>\d+)maxresident\)k$/
|
91
|
+
scale = 1000.0 # kilobytes -> bytes
|
92
|
+
when 'Darwin'
|
93
|
+
pattern = /^\s+(?<real>\d+\.\d+)\s+real\s+(?<user>\d+\.\d+)\s+user\s+(?<system>\d+\.\d+)\s+sys$\s+(?<maxresident>\d+)\s+maximum resident set size$/
|
94
|
+
scale = 1.0
|
95
|
+
end
|
96
|
+
match_data = pattern.match(output)
|
97
|
+
raise "Unexpected format given from /usr/bin/time:\n#{out}" unless match_data[:maxresident]
|
98
|
+
Integer(match_data[:maxresident]) * scale
|
99
|
+
end
|
100
|
+
|
85
101
|
def with_script(script)
|
86
102
|
if @config.verbose >= 2
|
87
103
|
sep = '-' * 30
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benchmark_driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|