httperfrb 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -6
- data/HISTORY.md +4 -0
- data/README.md +2 -2
- data/lib/httperf/parser.rb +36 -32
- data/lib/httperf/version.rb +1 -1
- data/lib/httperf.rb +0 -5
- metadata +10 -10
data/Gemfile
CHANGED
data/HISTORY.md
CHANGED
data/README.md
CHANGED
@@ -5,9 +5,9 @@ HTTPERF.rb
|
|
5
5
|
|
6
6
|
Simple Ruby interface for httperf.
|
7
7
|
|
8
|
-
###
|
8
|
+
### Known Issues
|
9
9
|
|
10
|
-
|
10
|
+
* Verbose handling isn't parsing correctly, but should not cause errors either.
|
11
11
|
|
12
12
|
## Installing 'httperf'
|
13
13
|
|
data/lib/httperf/parser.rb
CHANGED
@@ -9,19 +9,23 @@ class HTTPerf
|
|
9
9
|
# @param [String] raw httperf output
|
10
10
|
def self.parse raw
|
11
11
|
|
12
|
-
verbose = false
|
13
12
|
lines = raw.split("\n")
|
14
13
|
matches = {}
|
15
14
|
|
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
|
+
#
|
16
19
|
# for verbose matching
|
17
|
-
|
20
|
+
#verbose = false
|
21
|
+
#verbose_connection_times = []
|
18
22
|
|
19
23
|
lines.each do |line|
|
20
24
|
|
21
|
-
if verbose_expression.match(line)
|
22
|
-
verbose_connection_times.push($1)
|
23
|
-
next
|
24
|
-
end
|
25
|
+
#if verbose_expression.match(line)
|
26
|
+
#verbose_connection_times.push($1)
|
27
|
+
#next
|
28
|
+
#end
|
25
29
|
|
26
30
|
matched = false
|
27
31
|
unless line.empty?
|
@@ -35,28 +39,28 @@ class HTTPerf
|
|
35
39
|
end
|
36
40
|
end
|
37
41
|
|
38
|
-
unless verbose_connection_times.empty?
|
39
|
-
percentiles.each do |percentile|
|
40
|
-
matches["connection_time_#{percentile}_pct".to_sym] = calculate_percentile(percentile, verbose_connection_times)
|
41
|
-
end
|
42
|
-
matches[:connection_times] = verbose_connection_times
|
43
|
-
verbose = true
|
44
|
-
end
|
45
|
-
|
46
|
-
if verbose
|
47
|
-
raise "mismatch error occurred" unless expressions.keys.count+percentiles.count+1 == matches.keys.count
|
48
|
-
else
|
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
|
49
53
|
raise "mismatch error occurred" unless expressions.keys.count == matches.keys.count
|
50
|
-
end
|
54
|
+
#end
|
51
55
|
|
52
56
|
return matches
|
53
57
|
end
|
54
58
|
|
55
59
|
protected
|
56
60
|
|
57
|
-
def self.verbose_expression
|
58
|
-
|
59
|
-
end
|
61
|
+
#def self.verbose_expression
|
62
|
+
#/^Connection lifetime = ([0-9]*?\.?[0-9]+)$/
|
63
|
+
#end
|
60
64
|
|
61
65
|
def self.expressions
|
62
66
|
# While this isn't the most efficent way of doing this, it's the most maintainable.
|
@@ -142,19 +146,19 @@ class HTTPerf
|
|
142
146
|
}
|
143
147
|
end
|
144
148
|
|
145
|
-
def self.percentiles
|
146
|
-
[ 75, 80, 85, 90, 95, 99 ]
|
147
|
-
end
|
149
|
+
#def self.percentiles
|
150
|
+
#[ 75, 80, 85, 90, 95, 99 ]
|
151
|
+
#end
|
148
152
|
|
149
|
-
private
|
150
|
-
def self.calculate_percentile percentile, values
|
151
|
-
v = values.sort
|
152
|
-
v[percentile_index(percentile, values.count)]
|
153
|
-
end
|
153
|
+
#private
|
154
|
+
#def self.calculate_percentile percentile, values
|
155
|
+
#v = values.sort
|
156
|
+
#v[percentile_index(percentile, values.count)]
|
157
|
+
#end
|
154
158
|
|
155
|
-
def self.percentile_index percentile, count
|
156
|
-
((count/100)*percentile)-1
|
157
|
-
end
|
159
|
+
#def self.percentile_index percentile, count
|
160
|
+
#((count/100)*percentile)-1
|
161
|
+
#end
|
158
162
|
end
|
159
163
|
end
|
160
164
|
|
data/lib/httperf/version.rb
CHANGED
data/lib/httperf.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.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-08-13 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &17940520 !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: *17940520
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: simplecov
|
27
|
-
requirement: &
|
27
|
+
requirement: &17939680 !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: *17939680
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: yard
|
38
|
-
requirement: &
|
38
|
+
requirement: &17939000 !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: *17939000
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: open4
|
49
|
-
requirement: &
|
49
|
+
requirement: &17938280 !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: *17938280
|
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: -407478064777664208
|
86
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
87
|
none: false
|
88
88
|
requirements:
|