httperfrb 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -1
- data/HISTORY.md +4 -0
- data/README.md +5 -15
- data/lib/httperf/parser.rb +18 -44
- data/lib/httperf/version.rb +1 -1
- metadata +11 -11
data/Gemfile
CHANGED
data/HISTORY.md
CHANGED
data/README.md
CHANGED
@@ -1,14 +1,10 @@
|
|
1
|
-
|
1
|
+
HTTPerf.rb
|
2
2
|
==========
|
3
3
|
|
4
4
|
### [Documentation](http://rubyops.github.com/httperfrb/doc/) | [Coverage](http://rubyops.github.com/httperfrb/coverage/) | [RSpec Out](https://github.com/rubyops/httperfrb/blob/master/RSPECOUT.md)
|
5
5
|
|
6
6
|
Simple Ruby interface for httperf.
|
7
7
|
|
8
|
-
### Known Issues
|
9
|
-
|
10
|
-
* Verbose handling isn't parsing correctly, but should not cause errors either.
|
11
|
-
|
12
8
|
## Installing 'httperf'
|
13
9
|
|
14
10
|
Requires httperf, of course...
|
@@ -24,6 +20,10 @@ Requires httperf, of course...
|
|
24
20
|
#### Redhat / CentOS
|
25
21
|
|
26
22
|
sudo yum install httperf
|
23
|
+
|
24
|
+
#### My 'httperf'
|
25
|
+
|
26
|
+
See: [httperf-0.9.1 with individual connection times](http://www.rubyops.net/2012/08/13/httperf-0_9_1_with_individual_connection_times).
|
27
27
|
|
28
28
|
## Install
|
29
29
|
|
@@ -135,13 +135,3 @@ Something I've been playing around with, it's more of hack really. But it works
|
|
135
135
|
:errors_ftab_full
|
136
136
|
:errors_other
|
137
137
|
|
138
|
-
|
139
|
-
##### Addtional Verbose Parser Keys:
|
140
|
-
|
141
|
-
:connection_time_75_pct
|
142
|
-
:connection_time_80_pct
|
143
|
-
:connection_time_85_pct
|
144
|
-
:connection_time_90_pct
|
145
|
-
:connection_time_95_pct
|
146
|
-
:connection_time_99_pct
|
147
|
-
|
data/lib/httperf/parser.rb
CHANGED
@@ -8,25 +8,17 @@ class HTTPerf
|
|
8
8
|
# @return [Hash] returns hash of parsed httperf output
|
9
9
|
# @param [String] raw httperf output
|
10
10
|
def self.parse raw
|
11
|
-
|
12
11
|
lines = raw.split("\n")
|
13
12
|
matches = {}
|
14
13
|
|
15
|
-
# NOTE: commenting out all verbose handling, as the parsed
|
16
|
-
# strings do not exist in standard httperf. This code was
|
17
|
-
# based off of a custom hacked version.
|
18
|
-
#
|
19
14
|
# for verbose matching
|
20
|
-
#
|
21
|
-
#
|
15
|
+
# this only works if httperf output is
|
16
|
+
# generated using my version of httperf
|
17
|
+
# see: https://github.com/rubyops/httperf
|
18
|
+
verbose = false
|
19
|
+
verbose_connection_times = []
|
22
20
|
|
23
21
|
lines.each do |line|
|
24
|
-
|
25
|
-
#if verbose_expression.match(line)
|
26
|
-
#verbose_connection_times.push($1)
|
27
|
-
#next
|
28
|
-
#end
|
29
|
-
|
30
22
|
matched = false
|
31
23
|
unless line.empty?
|
32
24
|
next if matched
|
@@ -38,30 +30,11 @@ class HTTPerf
|
|
38
30
|
end
|
39
31
|
end
|
40
32
|
end
|
41
|
-
|
42
|
-
#unless verbose_connection_times.empty?
|
43
|
-
#percentiles.each do |percentile|
|
44
|
-
#matches["connection_time_#{percentile}_pct".to_sym] = calculate_percentile(percentile, verbose_connection_times)
|
45
|
-
#end
|
46
|
-
#matches[:connection_times] = verbose_connection_times
|
47
|
-
#verbose = true
|
48
|
-
#end
|
49
|
-
|
50
|
-
#if verbose
|
51
|
-
#raise "mismatch error occurred" unless expressions.keys.count+percentiles.count+1 == matches.keys.count
|
52
|
-
#else
|
53
|
-
raise "mismatch error occurred" unless expressions.keys.count == matches.keys.count
|
54
|
-
#end
|
55
|
-
|
33
|
+
raise "mismatch error occurred" unless expressions.keys.count == matches.keys.count
|
56
34
|
return matches
|
57
35
|
end
|
58
36
|
|
59
37
|
protected
|
60
|
-
|
61
|
-
#def self.verbose_expression
|
62
|
-
#/^Connection lifetime = ([0-9]*?\.?[0-9]+)$/
|
63
|
-
#end
|
64
|
-
|
65
38
|
def self.expressions
|
66
39
|
# While this isn't the most efficent way of doing this, it's the most maintainable.
|
67
40
|
{
|
@@ -146,19 +119,20 @@ class HTTPerf
|
|
146
119
|
}
|
147
120
|
end
|
148
121
|
|
149
|
-
#
|
150
|
-
|
151
|
-
|
122
|
+
# everything below is for verbose mode
|
123
|
+
def self.percentiles
|
124
|
+
[ 75, 80, 85, 90, 95, 99 ]
|
125
|
+
end
|
152
126
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
127
|
+
private
|
128
|
+
def self.calculate_percentile percentile, values
|
129
|
+
v = values.sort
|
130
|
+
v[percentile_index(percentile, values.count)]
|
131
|
+
end
|
158
132
|
|
159
|
-
|
160
|
-
|
161
|
-
|
133
|
+
def self.percentile_index percentile, count
|
134
|
+
((count/100)*percentile)-1
|
135
|
+
end
|
162
136
|
end
|
163
137
|
end
|
164
138
|
|
data/lib/httperf/version.rb
CHANGED
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.3
|
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-08-
|
12
|
+
date: 2012-08-14 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &20381740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *20381740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: simplecov
|
27
|
-
requirement: &
|
27
|
+
requirement: &20381080 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *20381080
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: yard
|
38
|
-
requirement: &
|
38
|
+
requirement: &20380540 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *20380540
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: open4
|
49
|
-
requirement: &
|
49
|
+
requirement: &20380060 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *20380060
|
58
58
|
description: Simple interface for calling httperf via ruby.
|
59
59
|
email:
|
60
60
|
- joshua@mervine.net
|
@@ -82,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
82
|
version: '0'
|
83
83
|
segments:
|
84
84
|
- 0
|
85
|
-
hash:
|
85
|
+
hash: 568389306351562567
|
86
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
87
|
none: false
|
88
88
|
requirements:
|