httperfrb 0.3.5 → 0.3.6
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.
- data/Gemfile +2 -0
- data/HISTORY.md +5 -1
- data/lib/httperf/parser.rb +13 -13
- data/lib/httperf/version.rb +1 -1
- data/lib/httperf.rb +10 -6
- metadata +32 -15
data/Gemfile
CHANGED
data/HISTORY.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
HTTPerf.rb
|
2
2
|
==========
|
3
3
|
|
4
|
+
### 0.3.6
|
5
|
+
|
6
|
+
* cleaning up Open3 vs. Open4 and making them autoload for a slight performance increase
|
7
|
+
|
4
8
|
### 0.3.5
|
5
9
|
|
6
10
|
* fixing bug with parsing verbose output
|
@@ -22,7 +26,7 @@ HTTPerf.rb
|
|
22
26
|
|
23
27
|
* added handling for [HTTPerf::Grapher](http://github.com/rubyops/httperfrb-grapher)
|
24
28
|
|
25
|
-
### 0.2.1
|
29
|
+
### 0.2.1
|
26
30
|
|
27
31
|
* added verbose handling
|
28
32
|
* refactored parser a bit
|
data/lib/httperf/parser.rb
CHANGED
@@ -9,7 +9,7 @@ class HTTPerf
|
|
9
9
|
# @param [String] raw httperf output
|
10
10
|
def self.parse raw
|
11
11
|
|
12
|
-
lines = raw.split("\n")
|
12
|
+
lines = raw.split("\n")
|
13
13
|
matches = {}
|
14
14
|
|
15
15
|
# for verbose matching
|
@@ -22,7 +22,7 @@ class HTTPerf
|
|
22
22
|
lines.each do |line|
|
23
23
|
|
24
24
|
if verbose_expression.match(line)
|
25
|
-
verbose_connection_times.push($1)
|
25
|
+
verbose_connection_times.push($1)
|
26
26
|
next
|
27
27
|
end
|
28
28
|
|
@@ -68,7 +68,7 @@ class HTTPerf
|
|
68
68
|
|
69
69
|
# Maximum connect burst length:
|
70
70
|
:max_connect_burst_length => /Maximum connect burst length: ([0-9]*?\.?[0-9]+)$/,
|
71
|
-
|
71
|
+
|
72
72
|
# Total:
|
73
73
|
:total_connections => /^Total: connections ([0-9]*?\.?[0-9]+) /,
|
74
74
|
:total_requests => /^Total: connections .+ requests ([0-9]*?\.?[0-9]+) /,
|
@@ -76,15 +76,15 @@ class HTTPerf
|
|
76
76
|
:total_test_duration => /^Total: connections .+ test-duration ([0-9]*?\.?[0-9]+) /,
|
77
77
|
|
78
78
|
# Connection rate:
|
79
|
-
:connection_rate_per_sec => /^Connection rate: ([0-9]*?\.?[0-9]+) /,
|
80
|
-
:connection_rate_ms_conn => /^Connection rate: .+ \(([0-9]*?\.?[0-9]+) ms/,
|
79
|
+
:connection_rate_per_sec => /^Connection rate: ([0-9]*?\.?[0-9]+) /,
|
80
|
+
:connection_rate_ms_conn => /^Connection rate: .+ \(([0-9]*?\.?[0-9]+) ms/,
|
81
81
|
|
82
82
|
# Connection time [ms]:
|
83
|
-
:connection_time_min => /^Connection time \[ms\]: min ([0-9]*?\.?[0-9]+) /,
|
84
|
-
:connection_time_avg => /^Connection time \[ms\]: min .+ avg ([0-9]*?\.?[0-9]+) /,
|
85
|
-
:connection_time_max => /^Connection time \[ms\]: min .+ max ([0-9]*?\.?[0-9]+) /,
|
86
|
-
:connection_time_median => /^Connection time \[ms\]: min .+ median ([0-9]*?\.?[0-9]+) /,
|
87
|
-
:connection_time_stddev => /^Connection time \[ms\]: min .+ stddev ([0-9]*?\.?[0-9]+)$/,
|
83
|
+
:connection_time_min => /^Connection time \[ms\]: min ([0-9]*?\.?[0-9]+) /,
|
84
|
+
:connection_time_avg => /^Connection time \[ms\]: min .+ avg ([0-9]*?\.?[0-9]+) /,
|
85
|
+
:connection_time_max => /^Connection time \[ms\]: min .+ max ([0-9]*?\.?[0-9]+) /,
|
86
|
+
:connection_time_median => /^Connection time \[ms\]: min .+ median ([0-9]*?\.?[0-9]+) /,
|
87
|
+
:connection_time_stddev => /^Connection time \[ms\]: min .+ stddev ([0-9]*?\.?[0-9]+)$/,
|
88
88
|
:connection_time_connect => /^Connection time \[ms\]: connect ([0-9]*?\.?[0-9]+)$/,
|
89
89
|
|
90
90
|
# Connection length [replies/conn]:
|
@@ -103,7 +103,7 @@ class HTTPerf
|
|
103
103
|
:reply_rate_max => /^Reply rate \[replies\/s\]: min .+ max ([0-9]*?\.?[0-9]+) /,
|
104
104
|
:reply_rate_stddev => /^Reply rate \[replies\/s\]: min .+ stddev ([0-9]*?\.?[0-9]+) /,
|
105
105
|
:reply_rate_samples => /^Reply rate \[replies\/s\]: min .+ \(([0-9]*?\.?[0-9]+) samples/,
|
106
|
-
|
106
|
+
|
107
107
|
# Reply time [ms]:
|
108
108
|
:reply_time_response => /^Reply time \[ms\]: response ([0-9]*?\.?[0-9]+) /,
|
109
109
|
:reply_time_transfer => /^Reply time \[ms\]: response .+ transfer ([0-9]*?\.?[0-9]+)$/,
|
@@ -127,7 +127,7 @@ class HTTPerf
|
|
127
127
|
:cpu_time_user_pct => /^CPU time \[s\]: user .+ \(user ([0-9]*?\.?[0-9]+)\% /,
|
128
128
|
:cpu_time_system_pct => /^CPU time \[s\]: user .+ system .+ system ([0-9]*?\.?[0-9]+)\% /,
|
129
129
|
:cpu_time_total_pct => /^CPU time \[s\]: user .+ total ([0-9]*?\.?[0-9]+)\%/,
|
130
|
-
|
130
|
+
|
131
131
|
# Net I/O:
|
132
132
|
:net_io_kb_sec => /^Net I\/O: ([0-9]*?\.?[0-9]+) KB/,
|
133
133
|
:net_io_bps => /^Net I\/O: .+ \((.+) bps\)/,
|
@@ -158,7 +158,7 @@ class HTTPerf
|
|
158
158
|
when 2
|
159
159
|
values.last
|
160
160
|
else
|
161
|
-
values.sort[((values.count.to_f/100)*percentile.to_f).round(0)-1]
|
161
|
+
values.sort[((values.count.to_f/100)*percentile.to_f).round(0)-1]
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
data/lib/httperf/version.rb
CHANGED
data/lib/httperf.rb
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
# @author Joshua Mervine <joshua@mervine.net>
|
2
2
|
$:.unshift File.dirname(__FILE__)
|
3
|
-
require 'open4'
|
4
3
|
require 'httperf/parser'
|
5
4
|
require 'httperf/version'
|
6
|
-
|
5
|
+
|
6
|
+
autoload :Open3, 'open3'
|
7
|
+
autoload :Open4, 'open4'
|
8
|
+
|
9
|
+
begin
|
7
10
|
require 'httperf/grapher'
|
8
11
|
rescue LoadError
|
9
12
|
end
|
13
|
+
|
10
14
|
class HTTPerf
|
11
15
|
|
12
16
|
# @return [Boolean] parse flag
|
@@ -61,11 +65,11 @@ class HTTPerf
|
|
61
65
|
# - wsesslog
|
62
66
|
# - wset
|
63
67
|
def initialize options={}, path=nil
|
64
|
-
self.parse = options.delete("parse")
|
68
|
+
self.parse = options.delete("parse")
|
65
69
|
options.each_key do |k|
|
66
70
|
raise "'#{k}' is an invalid httperf param" unless params.keys.include?(k)
|
67
71
|
end
|
68
|
-
@options = params.merge(options)
|
72
|
+
@options = params.merge(options)
|
69
73
|
if path.nil?
|
70
74
|
@command = %x{ which httperf }.chomp
|
71
75
|
raise "httperf not found" unless @command =~ /httperf/
|
@@ -84,7 +88,7 @@ class HTTPerf
|
|
84
88
|
# run httperf and wait for it to finish
|
85
89
|
# return errors if any, otherwise return
|
86
90
|
# results
|
87
|
-
def run
|
91
|
+
def run
|
88
92
|
status, out, err = nil
|
89
93
|
Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
|
90
94
|
pid = wait_thr.pid
|
@@ -127,7 +131,7 @@ class HTTPerf
|
|
127
131
|
|
128
132
|
# print httperf command to be run
|
129
133
|
# - for debugging and testing
|
130
|
-
def command
|
134
|
+
def command
|
131
135
|
return "#{@command} #{options}"
|
132
136
|
end
|
133
137
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httperfrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: simplecov
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: yard
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: open4
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,7 +69,12 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
description: Simple interface for calling httperf via ruby.
|
59
79
|
email:
|
60
80
|
- joshua@mervine.net
|
@@ -62,9 +82,9 @@ executables: []
|
|
62
82
|
extensions: []
|
63
83
|
extra_rdoc_files: []
|
64
84
|
files:
|
85
|
+
- lib/httperf.rb
|
65
86
|
- lib/httperf/version.rb
|
66
87
|
- lib/httperf/parser.rb
|
67
|
-
- lib/httperf.rb
|
68
88
|
- README.md
|
69
89
|
- HISTORY.md
|
70
90
|
- Gemfile
|
@@ -80,9 +100,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
100
|
- - ! '>='
|
81
101
|
- !ruby/object:Gem::Version
|
82
102
|
version: '0'
|
83
|
-
segments:
|
84
|
-
- 0
|
85
|
-
hash: 3635307491401586106
|
86
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
104
|
none: false
|
88
105
|
requirements:
|
@@ -91,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
108
|
version: 1.3.6
|
92
109
|
requirements: []
|
93
110
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.
|
111
|
+
rubygems_version: 1.8.24
|
95
112
|
signing_key:
|
96
113
|
specification_version: 3
|
97
114
|
summary: HTTPerf via Ruby
|