clientperf 0.0.3 → 0.1.0
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/CONTRIBUTORS +1 -1
- data/History.rdoc +1 -0
- data/Manifest +2 -0
- data/README.rdoc +8 -0
- data/Rakefile +0 -1
- data/TODO.rdoc +2 -3
- data/bin/clientperf +12 -4
- data/clientperf.gemspec +5 -8
- data/lib/clientperf.rb +1 -1
- data/lib/clientperf_config.rb +0 -4
- data/lib/clientperf_controller.rb +1 -11
- data/lib/clientperf_data_builder.rb +19 -0
- data/lib/clientperf_helper.rb +21 -0
- data/lib/clientperf_migrations.rb +21 -26
- data/lib/clientperf_result.rb +20 -0
- data/lib/clientperf_uri.rb +13 -79
- data/lib/extend_action_controller.rb +18 -38
- data/views/clientperf/index.html.erb +26 -20
- data/views/clientperf/show.html.erb +23 -17
- data/views/layouts/clientperf.html.erb +59 -6
- metadata +8 -12
data/CONTRIBUTORS
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
* Thanks to Howard Rauscher for providing
|
1
|
+
* Thanks to Howard Rauscher for providing the javascript measurement code.
|
2
2
|
|
3
3
|
* Thanks to the FiveRuns team, especially Bruce Williams for helping me to understand how to write rails plugins and hook into ActionController
|
data/History.rdoc
CHANGED
data/Manifest
CHANGED
data/README.rdoc
CHANGED
@@ -6,9 +6,17 @@ Measures the time it takes a user's browser to get from the top of a web page to
|
|
6
6
|
|
7
7
|
== Installation
|
8
8
|
|
9
|
+
Most cases:
|
10
|
+
|
9
11
|
sudo gem install clientperf
|
10
12
|
clientperf /path/to/rails/app
|
13
|
+
cd /path/to/rails/app
|
11
14
|
rake db:migrate
|
15
|
+
|
16
|
+
For clientperf developers, follow the above steps to generate the clientperf tables for a rails app, then:
|
17
|
+
cd /path/to/rails/app
|
18
|
+
rm -rf vendor/plugins/clientperf
|
19
|
+
git clone git://github.com/efalcao/clientperf.git vendor/plugins/clientperf
|
12
20
|
|
13
21
|
== Usage
|
14
22
|
|
data/Rakefile
CHANGED
data/TODO.rdoc
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
= TODO
|
2
|
-
* charts
|
3
|
-
* make it pretty
|
4
2
|
* tests (how to test a plugin?)
|
5
|
-
* indexes? other small optimizations?
|
3
|
+
* indexes? other small optimizations?
|
4
|
+
* rake-based installation rather than a gem binary? how to behave as a rail 2.1 gem when it comes to the migration?
|
data/bin/clientperf
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# USAGE: clientperf [RAILS_ROOT]
|
4
|
+
rails_dir = ARGV[0] || Dir.pwd
|
5
|
+
|
2
6
|
require 'fileutils'
|
7
|
+
|
8
|
+
require rails_dir + '/config/boot'
|
9
|
+
require "#{RAILS_ROOT}/config/environment"
|
10
|
+
require 'rails_generator'
|
11
|
+
require 'rails_generator/scripts/generate'
|
12
|
+
|
3
13
|
require File.dirname(__FILE__) << "/../lib/clientperf"
|
4
14
|
require File.dirname(__FILE__) << "/../lib/clientperf_config"
|
5
15
|
require File.dirname(__FILE__) << "/../lib/clientperf_migrations"
|
6
16
|
|
7
|
-
|
8
|
-
# USAGE: clientperf [RAILS_ROOT]
|
9
|
-
rails_dir = ARGV[0] || Dir.pwd
|
17
|
+
|
10
18
|
plugin_dir = File.join(rails_dir, 'vendor/plugins')
|
11
19
|
unless File.directory?(plugin_dir)
|
12
20
|
abort "clientperf: #{plugin_dir} does not exist; cannot install plugin"
|
@@ -25,7 +33,7 @@ File.readlines(File.dirname(__FILE__) << "/../Manifest").each do |line|
|
|
25
33
|
end
|
26
34
|
end
|
27
35
|
|
28
|
-
ClientperfMigrations.
|
36
|
+
ClientperfMigrations.install_new
|
29
37
|
ClientperfConfig.create_unless_exists(rails_dir)
|
30
38
|
|
31
39
|
STDERR.puts "Installed clientperf (v#{Clientperf.version}) in vendor/plugins/clientperf"
|
data/clientperf.gemspec
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Clientperf-0.0
|
2
|
+
# Gem::Specification for Clientperf-0.1.0
|
3
3
|
# Originally generated by Echoe
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = %q{clientperf}
|
7
|
-
s.version = "0.0
|
7
|
+
s.version = "0.1.0"
|
8
8
|
|
9
9
|
s.specification_version = 2 if s.respond_to? :specification_version=
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["Eric Falcao"]
|
13
|
-
s.date = %q{2008-06-
|
13
|
+
s.date = %q{2008-06-21}
|
14
14
|
s.default_executable = %q{clientperf}
|
15
15
|
s.description = %q{Instrumentation for the FiveRuns TuneUp product.}
|
16
16
|
s.email = %q{efalcao@gmail.com}
|
17
17
|
s.executables = ["clientperf"]
|
18
|
-
s.extra_rdoc_files = ["bin/clientperf", "lib/clientperf.rb", "lib/clientperf_config.rb", "lib/clientperf_controller.rb", "lib/clientperf_migrations.rb", "lib/clientperf_result.rb", "lib/clientperf_uri.rb", "lib/extend_action_controller.rb", "LICENSE", "README.rdoc", "TODO.rdoc"]
|
19
|
-
s.files = ["bin/clientperf", "CONTRIBUTORS", "History.rdoc", "init.rb", "lib/clientperf.rb", "lib/clientperf_config.rb", "lib/clientperf_controller.rb", "lib/clientperf_migrations.rb", "lib/clientperf_result.rb", "lib/clientperf_uri.rb", "lib/extend_action_controller.rb", "LICENSE", "Manifest", "rails/init.rb", "Rakefile", "README.rdoc", "TODO.rdoc", "views/clientperf/index.html.erb", "views/clientperf/show.html.erb", "views/layouts/clientperf.html.erb", "clientperf.gemspec"]
|
18
|
+
s.extra_rdoc_files = ["bin/clientperf", "lib/clientperf.rb", "lib/clientperf_config.rb", "lib/clientperf_controller.rb", "lib/clientperf_data_builder.rb", "lib/clientperf_helper.rb", "lib/clientperf_migrations.rb", "lib/clientperf_result.rb", "lib/clientperf_uri.rb", "lib/extend_action_controller.rb", "LICENSE", "README.rdoc", "TODO.rdoc"]
|
19
|
+
s.files = ["bin/clientperf", "CONTRIBUTORS", "History.rdoc", "init.rb", "lib/clientperf.rb", "lib/clientperf_config.rb", "lib/clientperf_controller.rb", "lib/clientperf_data_builder.rb", "lib/clientperf_helper.rb", "lib/clientperf_migrations.rb", "lib/clientperf_result.rb", "lib/clientperf_uri.rb", "lib/extend_action_controller.rb", "LICENSE", "Manifest", "rails/init.rb", "Rakefile", "README.rdoc", "TODO.rdoc", "views/clientperf/index.html.erb", "views/clientperf/show.html.erb", "views/layouts/clientperf.html.erb", "clientperf.gemspec"]
|
20
20
|
s.has_rdoc = true
|
21
21
|
s.homepage = %q{http://github.com/efalcao/clientperf}
|
22
22
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Clientperf", "--main", "README.rdoc"]
|
@@ -24,8 +24,6 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.rubyforge_project = %q{clientperf}
|
25
25
|
s.rubygems_version = %q{1.0.1}
|
26
26
|
s.summary = %q{Instrumentation for the FiveRuns TuneUp product.}
|
27
|
-
|
28
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
29
27
|
end
|
30
28
|
|
31
29
|
|
@@ -43,6 +41,5 @@ end
|
|
43
41
|
# p.project = 'clientperf'
|
44
42
|
# p.summary = "Instrumentation for the FiveRuns TuneUp product."
|
45
43
|
# p.url = "http://github.com/efalcao/clientperf"
|
46
|
-
# p.dependencies = %w(activesupport)
|
47
44
|
# p.include_rakefile = true
|
48
45
|
# end
|
data/lib/clientperf.rb
CHANGED
data/lib/clientperf_config.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
class ClientperfController < ActionController::Base
|
2
2
|
def index
|
3
|
+
ClientperfUri.destroy_all ["updated_at < ?", 1.year.ago]
|
3
4
|
@uris = ClientperfUri.find(:all, :include => :clientperf_results)
|
4
5
|
end
|
5
6
|
|
@@ -8,17 +9,6 @@ class ClientperfController < ActionController::Base
|
|
8
9
|
@page_title = @uri.uri
|
9
10
|
end
|
10
11
|
|
11
|
-
def reset
|
12
|
-
if request.post?
|
13
|
-
if params[:id]
|
14
|
-
ClientperfUri.destroy(params[:id])
|
15
|
-
else
|
16
|
-
ClientperfUri.destroy_all
|
17
|
-
end
|
18
|
-
end
|
19
|
-
redirect_to :action => 'index'
|
20
|
-
end
|
21
|
-
|
22
12
|
def measure
|
23
13
|
milliseconds = params[:e].to_i - params[:b].to_i rescue nil
|
24
14
|
if milliseconds && params[:u]
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module ClientperfDataBuilder
|
2
|
+
def build_data_for_chart(results, start_time, periods, period_increment)
|
3
|
+
max = 0
|
4
|
+
padded_results = (0..periods).map do |delta|
|
5
|
+
time_period = start_time + delta.send(period_increment)
|
6
|
+
data = get_data_or_pad(time_period, results)
|
7
|
+
max = data if data && data > max
|
8
|
+
[time_period, data]
|
9
|
+
end
|
10
|
+
[padded_results, max]
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def get_data_or_pad(point, results)
|
16
|
+
data = results.detect {|p,d| point == p.to_time(:local)}
|
17
|
+
data ? data[1].to_i : 0
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ClientperfHelper
|
2
|
+
def chart(data)
|
3
|
+
"http://chart.apis.google.com/chart?cht=ls&chs=300x100&chm=B,e6f2fa,0,0,0|R,000000,0,0.998,1.0&chco=0f7fcf&chxt=r&chd=s:#{chart_data(data)}"
|
4
|
+
end
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
def chart_data(args)
|
9
|
+
data, max = args
|
10
|
+
max += max * 0.1
|
11
|
+
encode = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
12
|
+
|
13
|
+
encoded = data.map do |result|
|
14
|
+
char = 62 * result[1] / max.to_f
|
15
|
+
encode[char.round,1]
|
16
|
+
end.join
|
17
|
+
max_in_seconds = number_with_precision(max/ 1000.to_f, 2)
|
18
|
+
half_in_seconds = number_with_precision(max/ 2000.to_f, 2)
|
19
|
+
"#{encoded}&chxl=0:|0s|#{half_in_seconds}s|#{max_in_seconds}s"
|
20
|
+
end
|
21
|
+
end
|
@@ -23,33 +23,28 @@ class AddClientperfTables < ActiveRecord::Migration
|
|
23
23
|
end)
|
24
24
|
}
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
MIGRATION_NAMES.reject {|name| exists?(name) }.each do |migration|
|
34
|
-
generate(migration)
|
35
|
-
install(migration)
|
26
|
+
class << self
|
27
|
+
def install_new
|
28
|
+
to_migrate = MIGRATION_NAMES.reject {|name| exists?(name) }
|
29
|
+
to_migrate.each do |migration|
|
30
|
+
generate(migration)
|
31
|
+
install(migration)
|
32
|
+
end
|
36
33
|
end
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
File.open(migration_path(migration), 'w') do |file|
|
52
|
-
file << MIGRATION_CONTENTS[migration.to_sym]
|
34
|
+
|
35
|
+
def generate(migration_name)
|
36
|
+
Rails::Generator::Scripts::Generate.new.run(['migration', migration_name])
|
37
|
+
end
|
38
|
+
|
39
|
+
def migration_path(migration_name)
|
40
|
+
Dir[File.join(RAILS_ROOT, 'db', 'migrate', "*_#{migration_name}.rb")].first
|
41
|
+
end
|
42
|
+
alias_method :exists?, :migration_path
|
43
|
+
|
44
|
+
def install(migration)
|
45
|
+
File.open(migration_path(migration), 'w') do |file|
|
46
|
+
file << MIGRATION_CONTENTS[migration.to_sym]
|
47
|
+
end
|
53
48
|
end
|
54
49
|
end
|
55
50
|
end
|
data/lib/clientperf_result.rb
CHANGED
@@ -2,6 +2,26 @@ class ClientperfResult < ActiveRecord::Base
|
|
2
2
|
belongs_to :clientperf_uri
|
3
3
|
after_create :update_uri
|
4
4
|
|
5
|
+
class << self
|
6
|
+
include ClientperfDataBuilder
|
7
|
+
|
8
|
+
def last_24_hours
|
9
|
+
start_time = (Time.now + 1.hour - 1.day).change(:min => 0)
|
10
|
+
results = average(:milliseconds, :conditions => ['created_at > ?', start_time],
|
11
|
+
:group => "date_format(created_at,'%Y-%m-%d %H')")
|
12
|
+
|
13
|
+
build_data_for_chart(results, start_time, 23, :hours)
|
14
|
+
end
|
15
|
+
|
16
|
+
def last_30_days
|
17
|
+
start_time = (Time.now + 1.day - 30.days).change(:hour => 0)
|
18
|
+
results = average(:milliseconds, :conditions => ['created_at > ?', start_time],
|
19
|
+
:group => "date_format(created_at,'%Y-%m-%d')")
|
20
|
+
|
21
|
+
build_data_for_chart(results, start_time, 29, :days)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
5
25
|
private
|
6
26
|
|
7
27
|
def update_uri
|
data/lib/clientperf_uri.rb
CHANGED
@@ -1,86 +1,20 @@
|
|
1
1
|
class ClientperfUri < ActiveRecord::Base
|
2
|
+
include ClientperfDataBuilder
|
3
|
+
has_many :clientperf_results, :dependent => :delete_all
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
results = average(:milliseconds, :conditions => ['created_at between ? and ?', start_time, end_time] ,
|
8
|
-
:group => 'minute(created_at)')
|
5
|
+
def last_24_hours
|
6
|
+
start_time = (Time.now + 1.hour - 1.day).change(:min => 0)
|
7
|
+
results = clientperf_results.average(:milliseconds, :conditions => ['created_at > ?', start_time],
|
8
|
+
:group => "date_format(created_at,'%Y-%m-%d %H')")
|
9
9
|
|
10
|
-
|
11
|
-
padded_results = (start_time.min..start_time.min + 59).map do |i|
|
12
|
-
minute = i % 60
|
13
|
-
data = data_for(minute, results)
|
14
|
-
max = data if data && data > max
|
15
|
-
[minute, data]
|
16
|
-
end
|
17
|
-
[padded_results, max]
|
18
|
-
end
|
19
|
-
|
20
|
-
def last_day
|
21
|
-
end_time = (Time.now + 1.hour).change(:min => 0)
|
22
|
-
start_time = end_time - 1.day
|
23
|
-
results = average(:milliseconds, :conditions => ['created_at between ? and ?', start_time, end_time],
|
24
|
-
:group => 'hour(created_at)')
|
25
|
-
|
26
|
-
max = 0
|
27
|
-
padded_results = (start_time.hour..start_time.hour + 23).map do |i|
|
28
|
-
hour = i % 24
|
29
|
-
data = data_for(hour, results)
|
30
|
-
max = data if data && data > max
|
31
|
-
[hour, data]
|
32
|
-
end
|
33
|
-
[padded_results, max]
|
34
|
-
end
|
35
|
-
|
36
|
-
def last_month
|
37
|
-
end_time = (Time.now + 1.day).change(:hour => 0)
|
38
|
-
start_time = end_time - 30.days
|
39
|
-
results = average(:milliseconds, :conditions => ['created_at between ? and ?', start_time, end_time],
|
40
|
-
:group => 'day(created_at)')
|
41
|
-
|
42
|
-
max = 0
|
43
|
-
padded_results = (start_time.day..start_time.day + 29).map do |i|
|
44
|
-
day = i % Time.days_in_month(start_time.month)
|
45
|
-
data = data_for(day, results)
|
46
|
-
max = data if data && data > max
|
47
|
-
[day, data]
|
48
|
-
end
|
49
|
-
[padded_results, max]
|
50
|
-
end
|
51
|
-
|
52
|
-
def data_for(point, results)
|
53
|
-
data = results.detect {|p,d| point == p.to_i}
|
54
|
-
data ? data[1].to_i : 0
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def chart_url
|
59
|
-
"http://chart.apis.google.com/chart?cht=ls&chs=300x50&chm=B&chd=s:"
|
60
|
-
end
|
61
|
-
|
62
|
-
def hour_chart
|
63
|
-
"#{chart_url}#{chart_data(clientperf_results.last_hour)}"
|
64
|
-
end
|
65
|
-
|
66
|
-
def day_chart
|
67
|
-
"#{chart_url}#{chart_data(clientperf_results.last_day)}"
|
68
|
-
end
|
69
|
-
|
70
|
-
def month_chart
|
71
|
-
"#{chart_url}#{chart_data(clientperf_results.last_month)}"
|
10
|
+
build_data_for_chart(results, start_time, 23, :hours)
|
72
11
|
end
|
73
12
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
data.map do |result|
|
82
|
-
char = 62 * result[1] / max.to_f
|
83
|
-
encode[char.round,1]
|
84
|
-
end.join
|
13
|
+
def last_30_days
|
14
|
+
start_time = (Time.now + 1.day - 30.days).change(:hour => 0)
|
15
|
+
results = clientperf_results.average(:milliseconds, :conditions => ['created_at > ?', start_time],
|
16
|
+
:group => "date_format(created_at,'%Y-%m-%d')")
|
17
|
+
|
18
|
+
build_data_for_chart(results, start_time, 29, :days)
|
85
19
|
end
|
86
20
|
end
|
@@ -12,48 +12,28 @@ module ExtendActionController
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def add_clientperf_to(response)
|
15
|
-
if response.body =~
|
16
|
-
|
15
|
+
if response.body =~ /(<html[^>]*?>).*(<\/html>)/im
|
16
|
+
top = %q(\1
|
17
17
|
<script type='text/javascript'>
|
18
|
-
var
|
19
|
-
var clientPerf = function() {
|
20
|
-
var attach = function(instance, eventName, listener) {
|
21
|
-
var listenerFn = listener;
|
22
|
-
if (instance.addEventListener) {
|
23
|
-
instance.addEventListener(eventName, listenerFn, false);
|
24
|
-
}
|
25
|
-
else if (instance.attachEvent) { // Internet explorer
|
26
|
-
listenerFn = function() {
|
27
|
-
listener(window.event);
|
28
|
-
};
|
29
|
-
instance.attachEvent("on" + eventName, listenerFn);
|
30
|
-
}
|
31
|
-
else {
|
32
|
-
// I could do some further attachment here, if I wanted too. for older browsers
|
33
|
-
// ex: instance['on' + eventName] = listener;
|
34
|
-
throw new Error("Event registration not supported");
|
35
|
-
}
|
36
|
-
};
|
37
|
-
|
38
|
-
var endRun = function() {
|
39
|
-
var clientPerfEnd = (new Date()).getTime();
|
40
|
-
var img = document.createElement('img');
|
41
|
-
img.src = '/clientperf/measure.gif?b=' + clientPerfStart + '&e=' + clientPerfEnd + '&u=' + location.href;
|
42
|
-
document.body.appendChild(img);
|
43
|
-
};
|
44
|
-
|
45
|
-
try {
|
46
|
-
attach(window, 'load', endRun);
|
47
|
-
}
|
48
|
-
catch(e) {
|
49
|
-
window.onload = endRun;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
clientPerf();
|
18
|
+
var _clientPerfStart = (new Date()).getTime();
|
53
19
|
</script>
|
54
20
|
)
|
55
21
|
|
56
|
-
|
22
|
+
bottom = %q(
|
23
|
+
<script type='text/javascript'>
|
24
|
+
(function() {
|
25
|
+
function fn() { var end = (new Date()).getTime(), img = document.createElement('img'); img.src = '/clientperf/measure.gif?b='+_clientPerfStart+'&e='+end+'&u='+encodeURIComponent(location.href); document.body.appendChild(img); };
|
26
|
+
if (window.addEventListener) { window.addEventListener('load', fn, false); }
|
27
|
+
else if (window.attachEvent) { window.attachEvent('onload', fn); }
|
28
|
+
else { var chain = window.onload; window.onload = function(e) { if(chain !== undefined) { chain(e); } fn(); } }
|
29
|
+
})();
|
30
|
+
</script>
|
31
|
+
</html>
|
32
|
+
)
|
33
|
+
|
34
|
+
response.body.sub!(/(<html[^>]*?>)/im, top)
|
35
|
+
response.body.sub!(/<\/html>/im, bottom)
|
36
|
+
|
57
37
|
response.headers["Content-Length"] = response.body.size
|
58
38
|
end
|
59
39
|
end
|
@@ -1,20 +1,26 @@
|
|
1
|
-
<
|
2
|
-
<
|
3
|
-
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
<
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
1
|
+
<div id="urls">
|
2
|
+
<div class="block">
|
3
|
+
<h2>all urls<span id="explanation">[ avg. seconds | # of times seen ]</span></h2>
|
4
|
+
<table>
|
5
|
+
<% @uris.each do |uri| %>
|
6
|
+
<tr>
|
7
|
+
<td class="vital-stats">[ <%= number_with_precision(uri.clientperf_results.average(:milliseconds) / 1000.to_f, 2) %>s | <%= uri.clientperf_results.count %> ]</td>
|
8
|
+
<td><%= link_to uri.uri, "/clientperf/#{uri.id}" %></td>
|
9
|
+
</tr>
|
10
|
+
<% end %>
|
11
|
+
</table>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
<div id="overall">
|
15
|
+
<div class="block">
|
16
|
+
<h2>overall graphs</h2>
|
17
|
+
<div class="chart">
|
18
|
+
<h4>24 hour</h4>
|
19
|
+
<img src="<%= chart(ClientperfResult.last_24_hours) %>" />
|
20
|
+
</div>
|
21
|
+
<div class="chart">
|
22
|
+
<h4>30 day</h4>
|
23
|
+
<img src="<%= chart(ClientperfResult.last_30_days)%>" />
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
</div>
|
@@ -1,18 +1,24 @@
|
|
1
|
-
<
|
2
|
-
<
|
3
|
-
|
4
|
-
<
|
5
|
-
<
|
6
|
-
|
7
|
-
|
1
|
+
<div id="trends">
|
2
|
+
<div class="block">
|
3
|
+
<h2>trends</h2>
|
4
|
+
<div class="chart">
|
5
|
+
<h4>24 hour</h4>
|
6
|
+
<img src="<%= chart(@uri.last_24_hours) %>" />
|
7
|
+
</div>
|
8
|
+
<div class="chart">
|
9
|
+
<h4>30 day</h4>
|
10
|
+
<img src="<%= chart(@uri.last_30_days)%>" />
|
11
|
+
</div>
|
12
|
+
</div>
|
8
13
|
</div>
|
9
|
-
<div
|
10
|
-
<
|
11
|
-
|
12
|
-
|
13
|
-
<
|
14
|
-
|
15
|
-
|
16
|
-
</
|
17
|
-
|
18
|
-
|
14
|
+
<div id="summary">
|
15
|
+
<div class="block">
|
16
|
+
<h2>summary</h2>
|
17
|
+
<ul>
|
18
|
+
<li><span>measured:</span><b><%= @uri.clientperf_results.count %></b> times</li>
|
19
|
+
<li><span>average time:</span><b><%= number_with_precision(@uri.clientperf_results.average(:milliseconds) / 1000.to_f, 2) %></b> seconds</li>
|
20
|
+
<li><span>first seen:</span><b><%= @uri.created_at.strftime("%m/%d/%Y") %></b></li>
|
21
|
+
<li><span>last seen:</span><b><%= distance_of_time_in_words(@uri.updated_at, Time.now) %></b> ago</li>
|
22
|
+
</ul>
|
23
|
+
</div>
|
24
|
+
</div>
|
@@ -2,7 +2,21 @@
|
|
2
2
|
<head>
|
3
3
|
<title>clientperf <%= ": #{@page_title}" if @page_title %></title>
|
4
4
|
<style type="text/css">
|
5
|
-
body {
|
5
|
+
body {
|
6
|
+
margin:0;
|
7
|
+
font-family: helvetica, arial, sans-serif;
|
8
|
+
font-size: 14px;
|
9
|
+
min-width: 990px;
|
10
|
+
}
|
11
|
+
|
12
|
+
ul {
|
13
|
+
margin: 0;
|
14
|
+
padding: 0;
|
15
|
+
}
|
16
|
+
|
17
|
+
li {
|
18
|
+
list-style-type: none;
|
19
|
+
}
|
6
20
|
|
7
21
|
#header {
|
8
22
|
background-color: #dedede;
|
@@ -29,14 +43,53 @@
|
|
29
43
|
#header h3 span {
|
30
44
|
}
|
31
45
|
|
32
|
-
#content {
|
33
|
-
padding: 0 20px;
|
34
|
-
}
|
35
|
-
|
36
46
|
#content h2 {
|
37
|
-
margin
|
47
|
+
margin: 0 0 20px 0;
|
38
48
|
border-bottom: 1px solid #d3d3d3;
|
39
49
|
}
|
50
|
+
|
51
|
+
#urls, #overall, #trends, #summary {
|
52
|
+
float: left;
|
53
|
+
}
|
54
|
+
|
55
|
+
#urls, #trends {
|
56
|
+
width: 60%;
|
57
|
+
}
|
58
|
+
|
59
|
+
#urls li {
|
60
|
+
margin-bottom: 3px ;
|
61
|
+
}
|
62
|
+
|
63
|
+
.vital-stats, #explanation {
|
64
|
+
color: #666;
|
65
|
+
padding-right: 5px;
|
66
|
+
font-weight: normal;
|
67
|
+
}
|
68
|
+
|
69
|
+
#explanation {
|
70
|
+
margin-left: 10px;
|
71
|
+
font-style: italic;
|
72
|
+
font-size: 12px;
|
73
|
+
position: relative;
|
74
|
+
bottom: 2px;
|
75
|
+
}
|
76
|
+
|
77
|
+
table {
|
78
|
+
font-size: 14px;
|
79
|
+
}
|
80
|
+
|
81
|
+
td { padding-bottom: 3px;}
|
82
|
+
|
83
|
+
#overall, #summary{
|
84
|
+
width: 40%;
|
85
|
+
}
|
86
|
+
|
87
|
+
.block {
|
88
|
+
padding: 20px;
|
89
|
+
}
|
90
|
+
|
91
|
+
#summary li {margin-bottom: 6px;}
|
92
|
+
#summary li span { float:left; width: 100px; }
|
40
93
|
</style>
|
41
94
|
</head>
|
42
95
|
<body>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clientperf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Falcao
|
@@ -9,18 +9,10 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-06-
|
12
|
+
date: 2008-06-21 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
name: activesupport
|
17
|
-
version_requirement:
|
18
|
-
version_requirements: !ruby/object:Gem::Requirement
|
19
|
-
requirements:
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: "0"
|
23
|
-
version:
|
14
|
+
dependencies: []
|
15
|
+
|
24
16
|
description: Instrumentation for the FiveRuns TuneUp product.
|
25
17
|
email: efalcao@gmail.com
|
26
18
|
executables:
|
@@ -32,6 +24,8 @@ extra_rdoc_files:
|
|
32
24
|
- lib/clientperf.rb
|
33
25
|
- lib/clientperf_config.rb
|
34
26
|
- lib/clientperf_controller.rb
|
27
|
+
- lib/clientperf_data_builder.rb
|
28
|
+
- lib/clientperf_helper.rb
|
35
29
|
- lib/clientperf_migrations.rb
|
36
30
|
- lib/clientperf_result.rb
|
37
31
|
- lib/clientperf_uri.rb
|
@@ -47,6 +41,8 @@ files:
|
|
47
41
|
- lib/clientperf.rb
|
48
42
|
- lib/clientperf_config.rb
|
49
43
|
- lib/clientperf_controller.rb
|
44
|
+
- lib/clientperf_data_builder.rb
|
45
|
+
- lib/clientperf_helper.rb
|
50
46
|
- lib/clientperf_migrations.rb
|
51
47
|
- lib/clientperf_result.rb
|
52
48
|
- lib/clientperf_uri.rb
|