httperfrb-grapher 0.0.4
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 +12 -0
- data/HISTORY.md +12 -0
- data/README.md +59 -0
- data/lib/httperf/grapher.rb +59 -0
- data/lib/httperf/grapher/version.rb +6 -0
- metadata +121 -0
data/Gemfile
ADDED
data/HISTORY.md
ADDED
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
HTTPerf::Grapher
|
2
|
+
================
|
3
|
+
|
4
|
+
### [Documentation](http://rubyops.github.com/httperfrb-grapher/doc/) | [Coverage](http://rubyops.github.com/httperfrb-grapher/coverage/) | [RSpec Out](https://github.com/rubyops/httperfrb-grapher/blob/master/RSPECOUT.md)
|
5
|
+
|
6
|
+
|
7
|
+
### WARNING
|
8
|
+
|
9
|
+
You can use this with my version of [httperf](https://github.com/rubyops/httperf), which adds the necessary output. *This is very experimental, so use at your own risk.*
|
10
|
+
|
11
|
+
If your verbose output contains the following type of output, this will work for you:
|
12
|
+
|
13
|
+
Connection lifetime = 719.5
|
14
|
+
Connection lifetime = 575.5
|
15
|
+
Connection lifetime = 285.5
|
16
|
+
Connection lifetime = 156.5
|
17
|
+
Connection lifetime = 400.5
|
18
|
+
Connection lifetime = 145.5
|
19
|
+
Connection lifetime = 349.5
|
20
|
+
Connection lifetime = 583.5
|
21
|
+
Connection lifetime = 147.5
|
22
|
+
Connection lifetime = 138.5
|
23
|
+
|
24
|
+
|
25
|
+
You will also know if HTTPerf::Grapher is usable if your HTTPerf parsed results contain the following keys:
|
26
|
+
|
27
|
+
:connection_times
|
28
|
+
:connection_time_75_pct
|
29
|
+
:connection_time_80_pct
|
30
|
+
:connection_time_85_pct
|
31
|
+
:connection_time_90_pct
|
32
|
+
:connection_time_95_pct
|
33
|
+
:connection_time_99_pct
|
34
|
+
|
35
|
+
|
36
|
+
## Installing 'rubyops httperf'
|
37
|
+
|
38
|
+
#### See: [httperf-0.9.1 with individual connection times](http://www.rubyops.net/2012/08/13/httperf-0_9_1_with_individual_connection_times) for installation instructions.
|
39
|
+
|
40
|
+
## Installing 'httperfrb'
|
41
|
+
|
42
|
+
#### See: [httperfrb](http://www.github.com/rubyops/httperfrb/)
|
43
|
+
|
44
|
+
## Usage - HTTPerf
|
45
|
+
|
46
|
+
#### See: [httperfrb](http://www.github.com/rubyops/httperfrb/)
|
47
|
+
|
48
|
+
## Usage - HTTPerf::Grapher
|
49
|
+
|
50
|
+
httperf_graph = HTTPerf::Grapher.new
|
51
|
+
httperf_graph.output_file = "/tmp/httperf_graph.png"
|
52
|
+
|
53
|
+
#
|
54
|
+
# httperf_graph.graph_settings = { ... overide Gruff defaults }
|
55
|
+
#
|
56
|
+
|
57
|
+
httperf_graph.graph( HTTPerf::Parser( httperf_verbose_results ) )
|
58
|
+
|
59
|
+
|
@@ -0,0 +1,59 @@
|
|
1
|
+
$:.unshift File.dirname(__FILE__)
|
2
|
+
require 'httperf'
|
3
|
+
require 'httperf/parser'
|
4
|
+
require 'grapher'
|
5
|
+
require 'grapher/version'
|
6
|
+
require 'gruff'
|
7
|
+
class HTTPerf
|
8
|
+
class Grapher
|
9
|
+
attr_accessor :output_file
|
10
|
+
attr_reader :graph_settings
|
11
|
+
|
12
|
+
def initialize gs={}
|
13
|
+
@output_file = "httperf_graph.png"
|
14
|
+
@graph_settings = default_graph_settings.merge(gs)
|
15
|
+
end
|
16
|
+
|
17
|
+
def graph_settings=(s)
|
18
|
+
@graph_settings = graph_settings.merge(s)
|
19
|
+
end
|
20
|
+
|
21
|
+
def graph results
|
22
|
+
raise "missing connection times, ensure that you have the correct version of httperf installed and it was run verbosely -- see documentation at http://github.com/rubyops/httperfrb-grapher" unless results.has_key?(:connection_times)
|
23
|
+
graph = Gruff::Line.new
|
24
|
+
|
25
|
+
conn_times = results[:connection_times].map { |i| i.to_f }
|
26
|
+
|
27
|
+
graph_settings.each do |key,val|
|
28
|
+
graph.send("#{key}=".to_sym, val)
|
29
|
+
end
|
30
|
+
|
31
|
+
graph.data("Connection Times", conn_times)
|
32
|
+
graph.data("Average [#{results[:connection_time_avg].to_f}]", draw_line(results[:connection_time_avg].to_f, conn_times.count))
|
33
|
+
graph.data("85th [#{results[:connection_time_85_pct].to_f}]", draw_line(results[:connection_time_85_pct].to_f, conn_times.count))
|
34
|
+
graph.data("95th [#{results[:connection_time_95_pct].to_f}]", draw_line(results[:connection_time_95_pct].to_f, conn_times.count))
|
35
|
+
graph.data("99th [#{results[:connection_time_99_pct].to_f}]", draw_line(results[:connection_time_99_pct].to_f, conn_times.count))
|
36
|
+
|
37
|
+
graph.labels = {}
|
38
|
+
(1..(conn_times.count/10)).each do |i|
|
39
|
+
graph.labels[i*10] = (i*10).to_s
|
40
|
+
end
|
41
|
+
|
42
|
+
graph.write(output_file)
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
def default_graph_settings
|
47
|
+
{
|
48
|
+
hide_dots: true,
|
49
|
+
legend_font_size: 14,
|
50
|
+
marker_font_size: 14,
|
51
|
+
title: "HTTPerf Results"
|
52
|
+
}
|
53
|
+
end
|
54
|
+
def draw_line value, length
|
55
|
+
(1..length).collect { value }
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: httperfrb-grapher
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Joshua Mervine
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-14 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &22825000 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *22825000
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: simplecov
|
27
|
+
requirement: &24191360 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *24191360
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: yard
|
38
|
+
requirement: &24927700 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *24927700
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: httperfrb
|
49
|
+
requirement: &25196700 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.3.3
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *25196700
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rmagick
|
60
|
+
requirement: &25196200 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 2.13.1
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *25196200
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: gruff
|
71
|
+
requirement: &25195720 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.3.6
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *25195720
|
80
|
+
description: Graphing utility for httperfrb.
|
81
|
+
email:
|
82
|
+
- joshua@mervine.net
|
83
|
+
executables: []
|
84
|
+
extensions: []
|
85
|
+
extra_rdoc_files: []
|
86
|
+
files:
|
87
|
+
- lib/httperf/grapher/version.rb
|
88
|
+
- lib/httperf/grapher.rb
|
89
|
+
- README.md
|
90
|
+
- HISTORY.md
|
91
|
+
- Gemfile
|
92
|
+
homepage: http://github.com/rubyops/httperfrb-grapher
|
93
|
+
licenses: []
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
segments:
|
105
|
+
- 0
|
106
|
+
hash: 1265237183241649452
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 1.3.6
|
113
|
+
requirements:
|
114
|
+
- rubyops httperf 0.9.1 (https://github.com/rubyops/httperf)
|
115
|
+
rubyforge_project:
|
116
|
+
rubygems_version: 1.7.2
|
117
|
+
signing_key:
|
118
|
+
specification_version: 3
|
119
|
+
summary: HTTPerf via Ruby
|
120
|
+
test_files: []
|
121
|
+
has_rdoc:
|