grntest 1.6.9 → 1.7.1

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
2
  SHA256:
3
- metadata.gz: 874f9b46d80e926dac44a36947f89cb2f8fee99a1e00ae1063b5e3d79b07d706
4
- data.tar.gz: 44643f5dc0b404cbfde294a218f19a0251afef70c01ae6d8a9ab3130556af3e3
3
+ metadata.gz: 7175e168334b0747450ac82d996961d56921fd71cb3570dd79c087f1ed12ccb9
4
+ data.tar.gz: 374847e51cc75585df02626162347cf1b96d0c774cc65379c7b9e3a782ad5f5a
5
5
  SHA512:
6
- metadata.gz: 13b411cbd6573214a097ca372a9e0a810b81c485dd4a241030996f3030561082a82939f278417ec2eb213e64505a9dab4c693130403ee30c557cc73b58f9915e
7
- data.tar.gz: 7ae1e11e823be0eda76acc7e0af1f11d168e2859287c4cfb435ffd69b0dd034a6065befab670997972eca56dbb1d769e8756705edc505bb51a3cf42f6e8a8abd
6
+ metadata.gz: 79e28ea7a29e3b6a2bbed57c80d5f284dbf737e91d9963ff3b7c8063dfb1b850021f65a66a589f182d76aab5b3d6e1ce91d877d0634d76b0f16d3164df8cea35
7
+ data.tar.gz: 6d2ed0c3743e99d7ec2219c80618ff5f3959389bb675fe49f747d579bcd413c0fc42aa3e3e61fbff82848b953a8828386eb139ec47089fb9ada556ea9370f6d1
data/doc/text/news.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # News
2
2
 
3
+ ## 1.7.1: 2024-02-05
4
+
5
+ ### Improvements
6
+
7
+ * benchmark: Removed load preparation part from elapsed time.
8
+
9
+ ## 1.7.0: 2024-02-05
10
+
11
+ ### Fixes
12
+
13
+ * reporter: benchmark-json: Fixed a bug that invalid JSON may be
14
+ generated.
15
+
3
16
  ## 1.6.9: 2024-02-05
4
17
 
5
18
  ### Improvements
@@ -29,12 +29,12 @@ module Grntest
29
29
  ensure
30
30
  cpu_finish_time = Process.times
31
31
  real_finish_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
32
- @cpu_elapsed_time =
32
+ @cpu_elapsed_time +=
33
33
  (cpu_finish_time.utime - cpu_start_time.utime) +
34
34
  (cpu_finish_time.stime - cpu_start_time.stime) +
35
35
  (cpu_finish_time.cutime - cpu_start_time.cutime) +
36
36
  (cpu_finish_time.cstime - cpu_start_time.cstime)
37
- @real_elapsed_time = real_finish_time - real_start_time
37
+ @real_elapsed_time += real_finish_time - real_start_time
38
38
  end
39
39
  end
40
40
  end
@@ -646,11 +646,9 @@ module Grntest
646
646
  timeout = @context.timeout
647
647
  response = nil
648
648
  begin
649
- @benchmark_result.measure do
650
- @benchmark_result.n_iterations.times do
651
- Timeout.timeout(timeout) do
652
- response = send_command(command)
653
- end
649
+ @benchmark_result.n_iterations.times do
650
+ Timeout.timeout(timeout) do
651
+ response = send_command(command)
654
652
  end
655
653
  end
656
654
  rescue Timeout::Error
@@ -127,15 +127,17 @@ module Grntest
127
127
  request = Net::HTTP::Post.new(path)
128
128
  request.content_type = content_type
129
129
  set_request_body(request, body)
130
- run_http_request(url) do
131
- http = Net::HTTP.new(@host, @port)
132
- http.set_debug_output($stderr) if LOAD_DEBUG
133
- response = http.start do
134
- http.read_timeout = read_timeout
135
- http.request(request)
130
+ @benchmark_result.measure do
131
+ run_http_request(url) do
132
+ http = Net::HTTP.new(@host, @port)
133
+ http.set_debug_output($stderr) if LOAD_DEBUG
134
+ response = http.start do
135
+ http.read_timeout = read_timeout
136
+ http.request(request)
137
+ end
138
+ check_response(response)
139
+ normalize_response_data(command, response.body)
136
140
  end
137
- check_response(response)
138
- normalize_response_data(command, response.body)
139
141
  end
140
142
  end
141
143
 
@@ -150,15 +152,17 @@ module Grntest
150
152
  request = Net::HTTP::Get.new(path_with_query)
151
153
  end
152
154
  url = "http://#{@host}:#{@port}#{path_with_query}"
153
- run_http_request(url) do
154
- http = Net::HTTP.new(@host, @port)
155
- http.set_debug_output($stderr) if DEBUG
156
- response = http.start do
157
- http.read_timeout = read_timeout
158
- http.request(request)
155
+ @benchmark_result.measure do
156
+ run_http_request(url) do
157
+ http = Net::HTTP.new(@host, @port)
158
+ http.set_debug_output($stderr) if DEBUG
159
+ response = http.start do
160
+ http.read_timeout = read_timeout
161
+ http.request(request)
162
+ end
163
+ check_response(response)
164
+ normalize_response_data(command, response.body)
159
165
  end
160
- check_response(response)
161
- normalize_response_data(command, response.body)
162
166
  end
163
167
  end
164
168
 
@@ -29,16 +29,18 @@ module Grntest
29
29
  if !command.key?(:output_type) and @output_type
30
30
  command_line = command_line.sub(/$/, " --output_type #{@output_type}")
31
31
  end
32
- begin
33
- debug_input(command_line)
34
- @input.print(command_line)
35
- @input.print("\n")
36
- @input.flush
37
- rescue SystemCallError
38
- message = "failed to write to groonga: <#{command_line}>: #{$!}"
39
- raise Error.new(message)
32
+ @benchmark_result.measure do
33
+ begin
34
+ debug_input(command_line)
35
+ @input.print(command_line)
36
+ @input.print("\n")
37
+ @input.flush
38
+ rescue SystemCallError
39
+ message = "failed to write to groonga: <#{command_line}>: #{$!}"
40
+ raise Error.new(message)
41
+ end
42
+ read_output(command)
40
43
  end
41
- read_output(command)
42
44
  end
43
45
 
44
46
  def ensure_groonga_ready
@@ -21,10 +21,6 @@ require "grntest/reporters/base-reporter"
21
21
  module Grntest
22
22
  module Reporters
23
23
  class BenchmarkJSONReporter < BaseReporter
24
- def initialize(tester)
25
- super
26
- end
27
-
28
24
  def on_start(result)
29
25
  puts(<<-JSON)
30
26
  {
@@ -40,11 +36,12 @@ module Grntest
40
36
  "mhz_per_cpu": #{cpu_cycles_per_second / 1_000_000.0},
41
37
  JSON
42
38
  end
43
- puts(<<-JSON)
39
+ print(<<-JSON.chomp)
44
40
  "caches": []
45
41
  },
46
42
  "benchmarks": [
47
43
  JSON
44
+ @first_benchmark = true
48
45
  end
49
46
 
50
47
  def on_worker_start(worker)
@@ -79,6 +76,8 @@ module Grntest
79
76
 
80
77
  def on_test_finish(worker, result)
81
78
  return if result.benchmarks.empty?
79
+ print(",") unless @first_benchmark
80
+ puts
82
81
  benchmarks = result.benchmarks.collect do |benchmark|
83
82
  name = "#{worker.suite_name}/#{result.test_name}"
84
83
  <<-JSON.chomp
@@ -94,7 +93,8 @@ module Grntest
94
93
  }
95
94
  JSON
96
95
  end
97
- puts(benchmarks.join(",\n"))
96
+ print(benchmarks.join(",\n"))
97
+ @first_benchmark = false
98
98
  end
99
99
 
100
100
  def on_suite_finish(worker)
@@ -104,6 +104,7 @@ module Grntest
104
104
  end
105
105
 
106
106
  def on_finish(result)
107
+ puts
107
108
  puts(<<-JSON)
108
109
  ]
109
110
  }
@@ -14,5 +14,5 @@
14
14
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
15
 
16
16
  module Grntest
17
- VERSION = "1.6.9"
17
+ VERSION = "1.7.1"
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grntest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.9
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-02-05 00:00:00.000000000 Z
12
+ date: 2024-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diff-lcs