speed_gun 0.0.4 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.coveralls.yml +1 -0
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/Rakefile +6 -1
- data/lib/speed_gun/app/views/meter.html.slim +4 -9
- data/lib/speed_gun/config.rb +33 -42
- data/lib/speed_gun/event.rb +72 -0
- data/lib/speed_gun/middleware.rb +43 -43
- data/lib/speed_gun/profile.rb +102 -0
- data/lib/speed_gun/profiler/action_controller_profiler.rb +14 -0
- data/lib/speed_gun/profiler/action_view_profiler.rb +11 -0
- data/lib/speed_gun/profiler/active_record_profiler.rb +11 -0
- data/lib/speed_gun/profiler/active_support_notifications_profiler.rb +29 -0
- data/lib/speed_gun/profiler/rack_profiler.rb +7 -0
- data/lib/speed_gun/profiler.rb +11 -118
- data/lib/speed_gun/railtie.rb +7 -16
- data/lib/speed_gun/store/elastic_search_store.rb +64 -0
- data/lib/speed_gun/store/fluent_logger_store.rb +29 -0
- data/lib/speed_gun/store/memcache_store.rb +40 -0
- data/lib/speed_gun/store/memory_store.rb +23 -0
- data/lib/speed_gun/store/multiple_store.rb +23 -0
- data/lib/speed_gun/store/redis_store.rb +41 -0
- data/lib/speed_gun/store.rb +7 -3
- data/lib/speed_gun/template.rb +1 -1
- data/lib/speed_gun/version.rb +1 -1
- data/lib/speed_gun.rb +30 -39
- data/spec/lib/speed_gun/config_spec.rb +37 -0
- data/spec/lib/speed_gun/event_spec.rb +70 -0
- data/spec/lib/speed_gun/middleware_spec.rb +65 -0
- data/spec/lib/speed_gun/profile_spec.rb +41 -0
- data/spec/lib/speed_gun_spec.rb +52 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/support/simplecov.rb +12 -0
- data/speed_gun.gemspec +10 -7
- metadata +102 -56
- data/app/assets/javascripts/browser.js +0 -83
- data/app/assets/javascripts/profiler.js +0 -45
- data/app/views/speed_gun/_meter.html.slim +0 -9
- data/lib/speed_gun/app/public/browser.js +0 -83
- data/lib/speed_gun/app/public/jquery-1.10.2.min.js +0 -6
- data/lib/speed_gun/app/public/profile.js +0 -5
- data/lib/speed_gun/app/public/profiler.js +0 -45
- data/lib/speed_gun/app/public/style.css +0 -170
- data/lib/speed_gun/app/views/profile.slim +0 -97
- data/lib/speed_gun/app.rb +0 -58
- data/lib/speed_gun/browser/navigation.rb +0 -23
- data/lib/speed_gun/browser/timing.rb +0 -92
- data/lib/speed_gun/browser.rb +0 -22
- data/lib/speed_gun/hook.rb +0 -25
- data/lib/speed_gun/profiler/action_controller.rb +0 -12
- data/lib/speed_gun/profiler/action_view.rb +0 -12
- data/lib/speed_gun/profiler/active_record.rb +0 -16
- data/lib/speed_gun/profiler/base.rb +0 -139
- data/lib/speed_gun/profiler/js.rb +0 -17
- data/lib/speed_gun/profiler/manual.rb +0 -14
- data/lib/speed_gun/profiler/rack.rb +0 -7
- data/lib/speed_gun/store/base.rb +0 -9
- data/lib/speed_gun/store/file.rb +0 -62
- data/lib/speed_gun/store/memcache.rb +0 -27
- data/lib/speed_gun/store/memory.rb +0 -22
- data/lib/speed_gun/store/redis.rb +0 -28
data/speed_gun.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = SpeedGun::VERSION
|
9
9
|
spec.authors = ['Sho Kusano']
|
10
10
|
spec.email = ['rosylilly@aduca.org']
|
11
|
-
spec.summary = %q{
|
12
|
-
spec.description = %q{
|
11
|
+
spec.summary = %q{Better web app profiler for Rails apps}
|
12
|
+
spec.description = %q{Better web app profiler for Rails apps}
|
13
13
|
spec.homepage = 'https://github.com/rosylilly/speed_gun'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
@@ -20,10 +20,13 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency 'bundler'
|
22
22
|
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 2.14.1'
|
24
|
+
spec.add_development_dependency 'simplecov', '~> 0.8.2'
|
25
|
+
spec.add_development_dependency 'simplecov-console'
|
26
|
+
spec.add_development_dependency 'rack-test'
|
27
|
+
spec.add_development_dependency 'coveralls'
|
23
28
|
|
24
|
-
spec.add_dependency '
|
25
|
-
spec.add_dependency 'msgpack'
|
26
|
-
spec.add_dependency '
|
27
|
-
spec.add_dependency 'slim', '~> 2.0'
|
28
|
-
spec.add_dependency 'useragent', '~> 0.10'
|
29
|
+
spec.add_dependency 'hashie'
|
30
|
+
spec.add_dependency 'msgpack'
|
31
|
+
spec.add_dependency 'slim'
|
29
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: speed_gun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 1.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Kusano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -39,123 +39,162 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
48
|
-
type: :
|
47
|
+
version: 2.14.1
|
48
|
+
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.14.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: simplecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
62
|
-
type: :
|
61
|
+
version: 0.8.2
|
62
|
+
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.8.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: simplecov-console
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rack-test
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: coveralls
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: hashie
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
76
118
|
type: :runtime
|
77
119
|
prerelease: false
|
78
120
|
version_requirements: !ruby/object:Gem::Requirement
|
79
121
|
requirements:
|
80
|
-
- - "
|
122
|
+
- - ">="
|
81
123
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
124
|
+
version: '0'
|
83
125
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
126
|
+
name: msgpack
|
85
127
|
requirement: !ruby/object:Gem::Requirement
|
86
128
|
requirements:
|
87
|
-
- - "
|
129
|
+
- - ">="
|
88
130
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
131
|
+
version: '0'
|
90
132
|
type: :runtime
|
91
133
|
prerelease: false
|
92
134
|
version_requirements: !ruby/object:Gem::Requirement
|
93
135
|
requirements:
|
94
|
-
- - "
|
136
|
+
- - ">="
|
95
137
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
138
|
+
version: '0'
|
97
139
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
140
|
+
name: slim
|
99
141
|
requirement: !ruby/object:Gem::Requirement
|
100
142
|
requirements:
|
101
|
-
- - "
|
143
|
+
- - ">="
|
102
144
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0
|
145
|
+
version: '0'
|
104
146
|
type: :runtime
|
105
147
|
prerelease: false
|
106
148
|
version_requirements: !ruby/object:Gem::Requirement
|
107
149
|
requirements:
|
108
|
-
- - "
|
150
|
+
- - ">="
|
109
151
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0
|
111
|
-
description:
|
152
|
+
version: '0'
|
153
|
+
description: Better web app profiler for Rails apps
|
112
154
|
email:
|
113
155
|
- rosylilly@aduca.org
|
114
156
|
executables: []
|
115
157
|
extensions: []
|
116
158
|
extra_rdoc_files: []
|
117
159
|
files:
|
160
|
+
- ".coveralls.yml"
|
118
161
|
- ".gitignore"
|
162
|
+
- ".rspec"
|
119
163
|
- ".rubocop.yml"
|
164
|
+
- ".travis.yml"
|
120
165
|
- Gemfile
|
121
166
|
- LICENSE.txt
|
122
167
|
- README.md
|
123
168
|
- Rakefile
|
124
|
-
- app/assets/javascripts/browser.js
|
125
|
-
- app/assets/javascripts/profiler.js
|
126
|
-
- app/views/speed_gun/_meter.html.slim
|
127
169
|
- lib/speed_gun.rb
|
128
|
-
- lib/speed_gun/app.rb
|
129
|
-
- lib/speed_gun/app/public/browser.js
|
130
|
-
- lib/speed_gun/app/public/jquery-1.10.2.min.js
|
131
|
-
- lib/speed_gun/app/public/profile.js
|
132
|
-
- lib/speed_gun/app/public/profiler.js
|
133
|
-
- lib/speed_gun/app/public/style.css
|
134
170
|
- lib/speed_gun/app/views/meter.html.slim
|
135
|
-
- lib/speed_gun/app/views/profile.slim
|
136
|
-
- lib/speed_gun/browser.rb
|
137
|
-
- lib/speed_gun/browser/navigation.rb
|
138
|
-
- lib/speed_gun/browser/timing.rb
|
139
171
|
- lib/speed_gun/config.rb
|
140
|
-
- lib/speed_gun/
|
172
|
+
- lib/speed_gun/event.rb
|
141
173
|
- lib/speed_gun/middleware.rb
|
174
|
+
- lib/speed_gun/profile.rb
|
142
175
|
- lib/speed_gun/profiler.rb
|
143
|
-
- lib/speed_gun/profiler/
|
144
|
-
- lib/speed_gun/profiler/
|
145
|
-
- lib/speed_gun/profiler/
|
146
|
-
- lib/speed_gun/profiler/
|
147
|
-
- lib/speed_gun/profiler/
|
148
|
-
- lib/speed_gun/profiler/manual.rb
|
149
|
-
- lib/speed_gun/profiler/rack.rb
|
176
|
+
- lib/speed_gun/profiler/action_controller_profiler.rb
|
177
|
+
- lib/speed_gun/profiler/action_view_profiler.rb
|
178
|
+
- lib/speed_gun/profiler/active_record_profiler.rb
|
179
|
+
- lib/speed_gun/profiler/active_support_notifications_profiler.rb
|
180
|
+
- lib/speed_gun/profiler/rack_profiler.rb
|
150
181
|
- lib/speed_gun/railtie.rb
|
151
182
|
- lib/speed_gun/store.rb
|
152
|
-
- lib/speed_gun/store/
|
153
|
-
- lib/speed_gun/store/
|
154
|
-
- lib/speed_gun/store/
|
155
|
-
- lib/speed_gun/store/
|
156
|
-
- lib/speed_gun/store/
|
183
|
+
- lib/speed_gun/store/elastic_search_store.rb
|
184
|
+
- lib/speed_gun/store/fluent_logger_store.rb
|
185
|
+
- lib/speed_gun/store/memcache_store.rb
|
186
|
+
- lib/speed_gun/store/memory_store.rb
|
187
|
+
- lib/speed_gun/store/multiple_store.rb
|
188
|
+
- lib/speed_gun/store/redis_store.rb
|
157
189
|
- lib/speed_gun/template.rb
|
158
190
|
- lib/speed_gun/version.rb
|
191
|
+
- spec/lib/speed_gun/config_spec.rb
|
192
|
+
- spec/lib/speed_gun/event_spec.rb
|
193
|
+
- spec/lib/speed_gun/middleware_spec.rb
|
194
|
+
- spec/lib/speed_gun/profile_spec.rb
|
195
|
+
- spec/lib/speed_gun_spec.rb
|
196
|
+
- spec/spec_helper.rb
|
197
|
+
- spec/support/simplecov.rb
|
159
198
|
- speed_gun.gemspec
|
160
199
|
homepage: https://github.com/rosylilly/speed_gun
|
161
200
|
licenses:
|
@@ -172,13 +211,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
211
|
version: '0'
|
173
212
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
213
|
requirements:
|
175
|
-
- - "
|
214
|
+
- - ">"
|
176
215
|
- !ruby/object:Gem::Version
|
177
|
-
version:
|
216
|
+
version: 1.3.1
|
178
217
|
requirements: []
|
179
218
|
rubyforge_project:
|
180
219
|
rubygems_version: 2.2.0
|
181
220
|
signing_key:
|
182
221
|
specification_version: 4
|
183
|
-
summary:
|
184
|
-
test_files:
|
222
|
+
summary: Better web app profiler for Rails apps
|
223
|
+
test_files:
|
224
|
+
- spec/lib/speed_gun/config_spec.rb
|
225
|
+
- spec/lib/speed_gun/event_spec.rb
|
226
|
+
- spec/lib/speed_gun/middleware_spec.rb
|
227
|
+
- spec/lib/speed_gun/profile_spec.rb
|
228
|
+
- spec/lib/speed_gun_spec.rb
|
229
|
+
- spec/spec_helper.rb
|
230
|
+
- spec/support/simplecov.rb
|
@@ -1,83 +0,0 @@
|
|
1
|
-
if(!window['speedGun']) { window.speedGun = {}; };
|
2
|
-
|
3
|
-
(function($) {
|
4
|
-
if(!$) { return }
|
5
|
-
|
6
|
-
speedGun.sendBrowserInfo = function() {
|
7
|
-
var data = {};
|
8
|
-
var p = window['performance'];
|
9
|
-
|
10
|
-
if(!p) {
|
11
|
-
return;
|
12
|
-
}
|
13
|
-
|
14
|
-
data.user_agent = navigator.userAgent;
|
15
|
-
|
16
|
-
if(p['navigation']) {
|
17
|
-
data.navigation = {
|
18
|
-
type: p.navigation.type,
|
19
|
-
redirect_count: p.navigation.redirectCount
|
20
|
-
};
|
21
|
-
}
|
22
|
-
|
23
|
-
if(p['timing']) {
|
24
|
-
var t = p.timing;
|
25
|
-
data.timing = {
|
26
|
-
navigationStart: t.navigationStart,
|
27
|
-
redirectStart: t.redirectStart,
|
28
|
-
unloadEventStart: t.unloadEventStart,
|
29
|
-
unloadEventEnd: t.unloadEventEnd,
|
30
|
-
redirectEnd: t.redirectEnd,
|
31
|
-
fetchStart: t.fetchStart,
|
32
|
-
domainLookupStart: t.domainLookupStart,
|
33
|
-
domainLookupEnd: t.domainLookupEnd,
|
34
|
-
connectStart: t.connectStart,
|
35
|
-
secureConnectionStart: t.secureConnectionStart,
|
36
|
-
connectEnd: t.connectEnd,
|
37
|
-
requestStart: t.requestStart,
|
38
|
-
responseStart: t.responseStart,
|
39
|
-
responseEnd: t.responseEnd,
|
40
|
-
domLoading: t.domLoading,
|
41
|
-
domInteractive: t.domInteractive,
|
42
|
-
domContentLoadedEventStart: t.domContentLoadedEventStart,
|
43
|
-
domContentLoadedEventEnd: t.domContentLoadedEventEnd,
|
44
|
-
domComplete: t.domComplete,
|
45
|
-
loadEventStart: t.loadEventStart,
|
46
|
-
loadEventEnd: t.loadEventEnd,
|
47
|
-
};
|
48
|
-
}
|
49
|
-
|
50
|
-
speedGun.send({ browser: data });
|
51
|
-
$('#speed_gun_total').text(
|
52
|
-
(t.domContentLoadedEventEnd - t.navigationStart).toString() + 'ms'
|
53
|
-
);
|
54
|
-
};
|
55
|
-
|
56
|
-
speedGun.send = function(data) {
|
57
|
-
if(speedGun.activated) {
|
58
|
-
$.post(speedGun.endpoint, data, function() {});
|
59
|
-
} else {
|
60
|
-
if(!speedGun.queue) { speedGun.queue = [] };
|
61
|
-
speedGun.queue.push(data);
|
62
|
-
}
|
63
|
-
};
|
64
|
-
|
65
|
-
speedGun.processQueue = function() {
|
66
|
-
var queue = speedGun.queue || [];
|
67
|
-
for(var i = 0; i < queue.length; i++) {
|
68
|
-
speedGun.send(queue[i])
|
69
|
-
}
|
70
|
-
}
|
71
|
-
|
72
|
-
var loadedInterval = setInterval(function() {
|
73
|
-
if (performance && performance.timing && performance.timing.loadEventEnd != 0) {
|
74
|
-
clearInterval(loadedInterval);
|
75
|
-
|
76
|
-
speedGun.id = $('#speed_gun').data('speed-gun-id');
|
77
|
-
speedGun.endpoint = $('#speed_gun').data('speed-gun-endpoint') + "/" + speedGun.id;
|
78
|
-
speedGun.activated = true;
|
79
|
-
speedGun.sendBrowserInfo();
|
80
|
-
speedGun.processQueue();
|
81
|
-
}
|
82
|
-
}, 100);
|
83
|
-
})(window['jQuery'] || window['Zepto']);
|
@@ -1,45 +0,0 @@
|
|
1
|
-
if(!window['speedGun']) { window.speedGun = {}; };
|
2
|
-
speedGun.enableConsoleProfile = !!(window['console'] && console['profile']);
|
3
|
-
speedGun.profileCount = 0;
|
4
|
-
|
5
|
-
speedGun.profile = function(title, func) {
|
6
|
-
speedGun.profileCount++;
|
7
|
-
if(!func) {
|
8
|
-
func = title;
|
9
|
-
title = undefined;
|
10
|
-
};
|
11
|
-
if(!title) {
|
12
|
-
title = "Speed Gun Profile #" + speedGun.profileCount;
|
13
|
-
};
|
14
|
-
var callstack = [];
|
15
|
-
var caller = arguments['callee'];
|
16
|
-
if(caller) {
|
17
|
-
while(caller) {
|
18
|
-
caller = caller['caller'];
|
19
|
-
if(caller) { callstack.push(caller.toString()); };
|
20
|
-
}
|
21
|
-
}
|
22
|
-
var before = +(new Date);
|
23
|
-
if(speedGun.enableConsoleProfile) { console.profile(title); };
|
24
|
-
ret = func();
|
25
|
-
if(speedGun.enableConsoleProfile) { console.profileEnd(title); };
|
26
|
-
var elapsedTime = (+(new Date)) - before;
|
27
|
-
if(speedGun['send']) {
|
28
|
-
speedGun.send(
|
29
|
-
{ js: { title: title, elapsed_time: elapsedTime, backtrace: callstack } }
|
30
|
-
);
|
31
|
-
};
|
32
|
-
return ret;
|
33
|
-
};
|
34
|
-
|
35
|
-
speedGun.profileMethod = function(object, methodName, title) {
|
36
|
-
if(!title) { title = "#" + methodName; };
|
37
|
-
var method = object[methodName];
|
38
|
-
var func = function() {
|
39
|
-
var args = arguments;
|
40
|
-
return speedGun.profile(title, function() {
|
41
|
-
return method.apply(object, args);
|
42
|
-
});
|
43
|
-
};
|
44
|
-
object[methodName] = func;
|
45
|
-
}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
#speed_gun(data-speed-gun-endpoint="#{SpeedGun.config.prefix}/profile" data-speed-gun-id="#{SpeedGun.current.id}" data-rack-ms="#{SpeedGun.current.profiles.first.elapsed_time * 1000}")
|
2
|
-
- if SpeedGun.config.show_button?
|
3
|
-
#speed_gun_button(style="position: fixed; bottom: 10px; right: 10px;")
|
4
|
-
a#toggle_speed_gun(href="#{File.join(SpeedGun.config.prefix, 'profile', SpeedGun.current.id)}" target="_blank" style="display: block; padding: 2px 5px; font-size: 9px; line-height: 2; box-shadow: 0 0 2px #333; background-color: #fff; color: #333; text-decoration: none; border-radius: 3px;")
|
5
|
-
span#speed_gun_total(style="vertical-align: middle;")
|
6
|
-
- unless SpeedGun.config.no_include_jquery?
|
7
|
-
script(type="text/javascript" src="#{SpeedGun.config.prefix}/jquery-1.10.2.min.js")
|
8
|
-
script(type="text/javascript" src="#{SpeedGun.config.prefix}/browser.js")
|
9
|
-
script(type="text/javascript" src="#{SpeedGun.config.prefix}/profiler.js")
|
@@ -1,83 +0,0 @@
|
|
1
|
-
if(!window['speedGun']) { window.speedGun = {}; };
|
2
|
-
|
3
|
-
(function($) {
|
4
|
-
if(!$) { return }
|
5
|
-
|
6
|
-
speedGun.sendBrowserInfo = function() {
|
7
|
-
var data = {};
|
8
|
-
var p = window['performance'];
|
9
|
-
|
10
|
-
if(!p) {
|
11
|
-
return;
|
12
|
-
}
|
13
|
-
|
14
|
-
data.user_agent = navigator.userAgent;
|
15
|
-
|
16
|
-
if(p['navigation']) {
|
17
|
-
data.navigation = {
|
18
|
-
type: p.navigation.type,
|
19
|
-
redirect_count: p.navigation.redirectCount
|
20
|
-
};
|
21
|
-
}
|
22
|
-
|
23
|
-
if(p['timing']) {
|
24
|
-
var t = p.timing;
|
25
|
-
data.timing = {
|
26
|
-
navigationStart: t.navigationStart,
|
27
|
-
redirectStart: t.redirectStart,
|
28
|
-
unloadEventStart: t.unloadEventStart,
|
29
|
-
unloadEventEnd: t.unloadEventEnd,
|
30
|
-
redirectEnd: t.redirectEnd,
|
31
|
-
fetchStart: t.fetchStart,
|
32
|
-
domainLookupStart: t.domainLookupStart,
|
33
|
-
domainLookupEnd: t.domainLookupEnd,
|
34
|
-
connectStart: t.connectStart,
|
35
|
-
secureConnectionStart: t.secureConnectionStart,
|
36
|
-
connectEnd: t.connectEnd,
|
37
|
-
requestStart: t.requestStart,
|
38
|
-
responseStart: t.responseStart,
|
39
|
-
responseEnd: t.responseEnd,
|
40
|
-
domLoading: t.domLoading,
|
41
|
-
domInteractive: t.domInteractive,
|
42
|
-
domContentLoadedEventStart: t.domContentLoadedEventStart,
|
43
|
-
domContentLoadedEventEnd: t.domContentLoadedEventEnd,
|
44
|
-
domComplete: t.domComplete,
|
45
|
-
loadEventStart: t.loadEventStart,
|
46
|
-
loadEventEnd: t.loadEventEnd,
|
47
|
-
};
|
48
|
-
}
|
49
|
-
|
50
|
-
speedGun.send({ browser: data });
|
51
|
-
$('#speed_gun_total').text(
|
52
|
-
(t.domContentLoadedEventEnd - t.navigationStart).toString() + 'ms'
|
53
|
-
);
|
54
|
-
};
|
55
|
-
|
56
|
-
speedGun.send = function(data) {
|
57
|
-
if(speedGun.activated) {
|
58
|
-
$.post(speedGun.endpoint, data, function() {});
|
59
|
-
} else {
|
60
|
-
if(!speedGun.queue) { speedGun.queue = [] };
|
61
|
-
speedGun.queue.push(data);
|
62
|
-
}
|
63
|
-
};
|
64
|
-
|
65
|
-
speedGun.processQueue = function() {
|
66
|
-
var queue = speedGun.queue || [];
|
67
|
-
for(var i = 0; i < queue.length; i++) {
|
68
|
-
speedGun.send(queue[i])
|
69
|
-
}
|
70
|
-
}
|
71
|
-
|
72
|
-
var loadedInterval = setInterval(function() {
|
73
|
-
if (performance && performance.timing && performance.timing.loadEventEnd != 0) {
|
74
|
-
clearInterval(loadedInterval);
|
75
|
-
|
76
|
-
speedGun.id = $('#speed_gun').data('speed-gun-id');
|
77
|
-
speedGun.endpoint = $('#speed_gun').data('speed-gun-endpoint') + "/" + speedGun.id;
|
78
|
-
speedGun.activated = true;
|
79
|
-
speedGun.sendBrowserInfo();
|
80
|
-
speedGun.processQueue();
|
81
|
-
}
|
82
|
-
}, 100);
|
83
|
-
})(window['jQuery'] || window['Zepto']);
|