glimpse-performance_bar 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # 1.0.0
2
+
3
+ - Initial release.
4
+
5
+ # 1.1.0
6
+
7
+ - Add support for Turbolinks.
data/README.md CHANGED
@@ -1,11 +1,15 @@
1
1
  # Glimpse::PerformanceBar
2
2
 
3
- Provide a glimpse into the MySQL queries made during your application's requests.
3
+ Provide a glimpse into `window.performance` timing.
4
4
 
5
5
  Things this glimpse view provides:
6
6
 
7
- - Total number of MySQL queries called during the request
8
- - The duration of the queries made during the request
7
+ - Frontend
8
+ - Latency / Receiving
9
+ - Backend
10
+ - TCP / SSL
11
+ - Redirect
12
+ - DNS Lookup
9
13
 
10
14
  ## Installation
11
15
 
@@ -29,6 +33,40 @@ Add the following to your `config/initializers/glimpse.rb`:
29
33
  Glimpse.into Glimpse::Views::PerformanceBar
30
34
  ```
31
35
 
36
+ You'll then need to add the following CSS and CoffeeScript:
37
+
38
+ CSS:
39
+
40
+ ```scss
41
+ //= require glimpse
42
+ //= require glimpse/views/performance_bar
43
+ ```
44
+
45
+ CoffeeScript:
46
+
47
+ ```coffeescript
48
+ #= require glimpse
49
+ #= require glimpse/views/performance_bar
50
+ ```
51
+
52
+ Lastly this view requires you insert an additional partial after the `glimpse/results`:
53
+
54
+ ```erb
55
+ ...
56
+ <%= yield %>
57
+ <%= render 'glimpse/results' %>
58
+ <%= render 'glimpse/results/performance_bar' %>
59
+ ...
60
+ ```
61
+
62
+ ## Contributors
63
+
64
+ - [@josh](https://github.com/josh) - The original implementation.
65
+ - [@tmm1](https://github.com/tmm1) - The original implementation.
66
+ - [@rtomayko](https://github.com/rtomayko) - The original implementation.
67
+ - [@kneath](https://github.com/kneath) - The original implementation.
68
+ - [@dewski](https://github.com/dewski) - Just the extractor.
69
+
32
70
  ## Contributing
33
71
 
34
72
  1. Fork it
@@ -125,13 +125,13 @@ renderPerformanceBar = ->
125
125
  updateStatus = (html) ->
126
126
  $('#serverstats').html html
127
127
 
128
- pjaxStart = null
129
- $(document).on 'pjax:start', (event) ->
130
- pjaxStart = event.timeStamp
128
+ ajaxStart = null
129
+ $(document).on 'pjax:start page:fetch', (event) ->
130
+ ajaxStart = event.timeStamp
131
131
 
132
- $(document).on 'pjax:end', (event, xhr) ->
133
- pjaxEnd = event.timeStamp
134
- total = pjaxEnd - pjaxStart
132
+ $(document).on 'pjax:end page:change', (event, xhr) ->
133
+ ajaxEnd = event.timeStamp
134
+ total = ajaxEnd - ajaxStart
135
135
  serverTime = if xhr then parseInt(xhr.getResponseHeader('X-Runtime')) else 0
136
136
 
137
137
  # Defer to include the timing of pjax hook evaluation
@@ -139,23 +139,27 @@ $(document).on 'pjax:end', (event, xhr) ->
139
139
  now = new Date().getTime()
140
140
  bar = new PerformanceBar
141
141
  timing:
142
- requestStart: pjaxStart,
143
- responseEnd: pjaxEnd,
144
- domLoading: pjaxEnd,
142
+ requestStart: ajaxStart,
143
+ responseEnd: ajaxEnd,
144
+ domLoading: ajaxEnd,
145
145
  domInteractive: now
146
146
  isLoaded: -> true
147
- start: -> pjaxStart
147
+ start: -> ajaxStart
148
148
  end: -> now
149
149
 
150
150
  bar.render serverTime
151
151
 
152
- console.log 'why u called'
153
- span = $('<span>', {'class': 'tooltip', title: 'PJAX navigation time'})
152
+ if $.fn.pjax?
153
+ tech = 'PJAX'
154
+ else
155
+ tech = 'Turbolinks'
156
+
157
+ span = $('<span>', {'class': 'tooltip', title: "#{tech} navigation time"})
154
158
  .text(PerformanceBar.formatTime(total))
155
159
  span.tipsy({ gravity: 'n' })
156
160
  updateStatus span
157
161
 
158
- pjaxStart = null
162
+ ajaxStart = null
159
163
  , 0
160
164
 
161
165
  $ ->
@@ -1,5 +1,5 @@
1
1
  module Glimpse
2
2
  module PerformanceBar
3
- VERSION = '1.0.0'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimpse-performance_bar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-11 00:00:00.000000000 Z
12
+ date: 2013-03-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: glimpse
@@ -36,6 +36,7 @@ extensions: []
36
36
  extra_rdoc_files: []
37
37
  files:
38
38
  - .gitignore
39
+ - CHANGELOG.md
39
40
  - Gemfile
40
41
  - LICENSE.txt
41
42
  - README.md