httperfrb 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,6 +8,7 @@ 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
+
11
12
  lines = raw.split("\n")
12
13
  matches = {}
13
14
 
@@ -19,6 +20,12 @@ class HTTPerf
19
20
  verbose_connection_times = []
20
21
 
21
22
  lines.each do |line|
23
+
24
+ if verbose_expression.match(line)
25
+ verbose_connection_times.push($1)
26
+ next
27
+ end
28
+
22
29
  matched = false
23
30
  unless line.empty?
24
31
  next if matched
@@ -30,11 +37,30 @@ class HTTPerf
30
37
  end
31
38
  end
32
39
  end
33
- raise "mismatch error occurred" unless expressions.keys.count == matches.keys.count
40
+
41
+ unless verbose_connection_times.empty?
42
+ percentiles.each do |percentile|
43
+ matches["connection_time_#{percentile}_pct".to_sym] = calculate_percentile(percentile, verbose_connection_times)
44
+ end
45
+ matches[:connection_times] = verbose_connection_times
46
+ verbose = true
47
+ end
48
+
49
+ if verbose
50
+ raise "mismatch error occurred" unless expressions.keys.count+percentiles.count+1 == matches.keys.count
51
+ else
52
+ raise "mismatch error occurred" unless expressions.keys.count == matches.keys.count
53
+ end
54
+
34
55
  return matches
35
56
  end
36
57
 
37
58
  protected
59
+
60
+ def self.verbose_expression
61
+ /^Connection lifetime = ([0-9]*?\.?[0-9]+)$/
62
+ end
63
+
38
64
  def self.expressions
39
65
  # While this isn't the most efficent way of doing this, it's the most maintainable.
40
66
  {
@@ -1,4 +1,4 @@
1
1
  class HTTPerf
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
4
4
 
data/lib/httperf.rb CHANGED
@@ -3,7 +3,10 @@ $:.unshift File.dirname(__FILE__)
3
3
  require 'open4'
4
4
  require 'httperf/parser'
5
5
  require 'httperf/version'
6
-
6
+ begin
7
+ require 'httperf/grapher'
8
+ rescue LoadError
9
+ end
7
10
  class HTTPerf
8
11
 
9
12
  # @return [Boolean] parse flag
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.3
4
+ version: 0.3.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-08-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &20381740 !ruby/object:Gem::Requirement
16
+ requirement: &12594280 !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: *20381740
24
+ version_requirements: *12594280
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: simplecov
27
- requirement: &20381080 !ruby/object:Gem::Requirement
27
+ requirement: &12593740 !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: *20381080
35
+ version_requirements: *12593740
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: yard
38
- requirement: &20380540 !ruby/object:Gem::Requirement
38
+ requirement: &12593260 !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: *20380540
46
+ version_requirements: *12593260
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: open4
49
- requirement: &20380060 !ruby/object:Gem::Requirement
49
+ requirement: &12592720 !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: *20380060
57
+ version_requirements: *12592720
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: 568389306351562567
85
+ hash: -4553796568660204658
86
86
  required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  none: false
88
88
  requirements: