benchmark_driver-output-rubybench 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2bc6351039a09bb76469c4724acc477f1540e161
4
- data.tar.gz: 813f1b4dd49d166104aaf6b7369ca549eb774eac
2
+ SHA256:
3
+ metadata.gz: 2ac3b43d5332f007435fe219875e4c0da251038dcd12b12f87609c4b4d9d85f6
4
+ data.tar.gz: 3a0c5c3dbaa42e4f1b4f0ef33259eb4db26bd098ac394b0615ab24a3ce92c557
5
5
  SHA512:
6
- metadata.gz: 89c812cb868c85e647eecae81e5e59ebe8016098aa7ca958e9f49300828705092332aa994c05baed2c7ca18ead3f47bb7306b5ecee1ce89dac8f074850e7a8e3
7
- data.tar.gz: 1d1cae04cf6ba272e533d39627db850ac8e66d1df427ecbca0901bedef220780ebbdf175d4cd22aa90c2d7ec17381a9bf0627aba2dc9688aad9cef968210d807
6
+ metadata.gz: 71ebd1fd40794389827eb9b75bed3214232c5b4f1556dc8f52bf66110f5da32a82fa1654ed27c3bf2791cd97ac8aa33ccc041c79eb96c6d80811b31180ebf085
7
+ data.tar.gz: a6695e9fc85824e4b1a60f839db328d784b166da2e88f871f938ddc43aca74ef30ab2b4914711d06e2bbb4b839081e7e33e1026ba10c82a91c05e4781d06a9ee
@@ -1,10 +1,11 @@
1
1
 
2
2
  lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "benchmark_driver/output/rubybench/version"
4
5
 
5
6
  Gem::Specification.new do |spec|
6
7
  spec.name = "benchmark_driver-output-rubybench"
7
- spec.version = "0.2.1"
8
+ spec.version = BenchmarkDriver::Output::Rubybench::VERSION
8
9
  spec.authors = ["Takashi Kokubun"]
9
10
  spec.email = ["takashikkbn@gmail.com"]
10
11
 
@@ -12,6 +12,8 @@ require 'net/http'
12
12
  # BENCHMARK_TYPE_DIGEST
13
13
  # REPO_NAME
14
14
  # ORGANIZATION_NAME
15
+ # Optional environment variables:
16
+ # RUBY_ENVIRONMENT
15
17
  class BenchmarkDriver::Output::Rubybench < BenchmarkDriver::BulkOutput
16
18
  # For maintainability, this doesn't support streaming progress output.
17
19
  # @param [Hash{ BenchmarkDriver::Job => Hash{ BenchmarkDriver::Context => BenchmarkDriver::Result } }] job_context_result
@@ -49,7 +51,11 @@ class BenchmarkDriver::Output::Rubybench < BenchmarkDriver::BulkOutput
49
51
  end
50
52
 
51
53
  ruby_version = context_result.keys.first.executable.description
52
- environment = context_result.values.first.environment
54
+ if ENV['RUBY_ENVIRONMENT'] == 'true'
55
+ environment = ruby_version
56
+ else
57
+ environment = { 'Ruby version' => ruby_version }.merge(context_result.values.first.environment).to_yaml
58
+ end
53
59
 
54
60
  request.set_form_data({
55
61
  'benchmark_result_type[name]' => metric.name,
@@ -57,7 +63,7 @@ class BenchmarkDriver::Output::Rubybench < BenchmarkDriver::BulkOutput
57
63
  'benchmark_type[category]' => job.name,
58
64
  'benchmark_type[script_url]' => ENV.fetch('BENCHMARK_TYPE_SCRIPT_URL'),
59
65
  'benchmark_type[digest]' => ENV.fetch('BENCHMARK_TYPE_DIGEST'),
60
- 'benchmark_run[environment]' => { 'Ruby version' => ruby_version }.merge(environment).to_yaml,
66
+ 'benchmark_run[environment]' => environment,
61
67
  'repo' => ENV.fetch('REPO_NAME'),
62
68
  'organization' => ENV.fetch('ORGANIZATION_NAME'),
63
69
  }.merge(initiator_hash).merge(result_hash))
@@ -0,0 +1,7 @@
1
+ module BenchmarkDriver
2
+ module Output
3
+ class Rubybench
4
+ VERSION = "0.2.2"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ require 'benchmark_driver/runner/time'
2
+
3
+ # For having a metric label compatible with RubyBench
4
+ class BenchmarkDriver::Runner::Seconds < BenchmarkDriver::Runner::Time
5
+ METRIC = BenchmarkDriver::Metric.new(name: 'Execution time', unit: 'Seconds', larger_better: false)
6
+
7
+ # JobParser returns this, `BenchmarkDriver::Runner.runner_for` searches "*::Job"
8
+ Job = Class.new(BenchmarkDriver::DefaultJob)
9
+ # Dynamically fetched and used by `BenchmarkDriver::JobParser.parse`
10
+ JobParser = BenchmarkDriver::DefaultJobParser.for(klass: Job, metrics: [METRIC])
11
+
12
+ # Overriding BenchmarkDriver::Runner::Ips#metric
13
+ def metric
14
+ METRIC
15
+ end
16
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benchmark_driver-output-rubybench
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
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-07-01 00:00:00.000000000 Z
11
+ date: 2018-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark_driver
@@ -66,6 +66,8 @@ files:
66
66
  - Rakefile
67
67
  - benchmark_driver-output-rubybench.gemspec
68
68
  - lib/benchmark_driver/output/rubybench.rb
69
+ - lib/benchmark_driver/output/rubybench/version.rb
70
+ - lib/benchmark_driver/runner/seconds.rb
69
71
  homepage: https://github.com/ruby-bench/ruby-bench-suite
70
72
  licenses:
71
73
  - MIT
@@ -86,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
88
  version: '0'
87
89
  requirements: []
88
90
  rubyforge_project:
89
- rubygems_version: 2.6.14.1
91
+ rubygems_version: 2.7.6
90
92
  signing_key:
91
93
  specification_version: 4
92
94
  summary: benchmark_driver plugin to output result to RubyBench