rack-mini-profiler 0.1.29 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rack-mini-profiler might be problematic. Click here for more details.

Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/{Ruby/CHANGELOG → CHANGELOG} +29 -0
  3. data/README.md +269 -0
  4. data/{Ruby/lib → lib}/html/includes.css +0 -0
  5. data/{Ruby/lib → lib}/html/includes.js +9 -8
  6. data/{Ruby/lib → lib}/html/includes.less +0 -0
  7. data/{Ruby/lib → lib}/html/includes.tmpl +3 -1
  8. data/{Ruby/lib → lib}/html/jquery.1.7.1.js +0 -0
  9. data/{Ruby/lib → lib}/html/jquery.tmpl.js +0 -0
  10. data/{Ruby/lib → lib}/html/list.css +2 -2
  11. data/{Ruby/lib → lib}/html/list.js +1 -1
  12. data/{Ruby/lib → lib}/html/list.tmpl +2 -2
  13. data/lib/html/profile_handler.js +1 -0
  14. data/{Ruby/lib → lib}/html/share.html +2 -2
  15. data/{Ruby/lib → lib}/mini_profiler/client_settings.rb +11 -11
  16. data/{Ruby/lib → lib}/mini_profiler/client_timer_struct.rb +0 -0
  17. data/{Ruby/lib → lib}/mini_profiler/config.rb +11 -4
  18. data/{Ruby/lib → lib}/mini_profiler/context.rb +1 -1
  19. data/{Ruby/lib → lib}/mini_profiler/custom_timer_struct.rb +0 -0
  20. data/lib/mini_profiler/gc_profiler.rb +181 -0
  21. data/{Ruby/lib → lib}/mini_profiler/page_timer_struct.rb +4 -4
  22. data/{Ruby/lib → lib}/mini_profiler/profiler.rb +110 -122
  23. data/{Ruby/lib → lib}/mini_profiler/profiling_methods.rb +31 -11
  24. data/{Ruby/lib → lib}/mini_profiler/request_timer_struct.rb +5 -5
  25. data/{Ruby/lib → lib}/mini_profiler/sql_timer_struct.rb +0 -0
  26. data/{Ruby/lib → lib}/mini_profiler/storage/abstract_store.rb +0 -0
  27. data/{Ruby/lib → lib}/mini_profiler/storage/file_store.rb +26 -4
  28. data/{Ruby/lib → lib}/mini_profiler/storage/memcache_store.rb +0 -0
  29. data/{Ruby/lib → lib}/mini_profiler/storage/memory_store.rb +25 -4
  30. data/{Ruby/lib → lib}/mini_profiler/storage/redis_store.rb +0 -0
  31. data/{Ruby/lib → lib}/mini_profiler/timer_struct.rb +0 -0
  32. data/lib/mini_profiler/version.rb +5 -0
  33. data/{Ruby/lib → lib}/mini_profiler_rails/railtie.rb +16 -4
  34. data/{Ruby/lib → lib}/patches/net_patches.rb +0 -0
  35. data/{Ruby/lib → lib}/patches/sql_patches.rb +15 -8
  36. data/{Ruby/lib → lib}/rack-mini-profiler.rb +0 -0
  37. data/rack-mini-profiler.gemspec +13 -5
  38. metadata +163 -53
  39. data/Ruby/README.md +0 -172
  40. data/Ruby/lib/html/flamegraph.html +0 -351
  41. data/Ruby/lib/html/profile_handler.js +0 -1
  42. data/Ruby/lib/mini_profiler/flame_graph.rb +0 -54
  43. data/Ruby/lib/mini_profiler/gc_profiler.rb +0 -107
  44. data/Ruby/lib/mini_profiler/version.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca3a413c784a90f894e6ae5b6025f9203d161d1f
4
- data.tar.gz: 570faec20b83dc6069a7b91fb065835668093ad9
3
+ metadata.gz: d38192262a50a132bef944ea6508e5c2edd65d30
4
+ data.tar.gz: 3f9c5065465f08cdf643b701185b383eaa04b182
5
5
  SHA512:
6
- metadata.gz: c2c03d9750cfa1411b78993f16303bdb836a81b741cfea22cccc6209df9c506b6cf020cd0c3409fe77c869009fded27316683ded937b02759b990dbc5dde4a27
7
- data.tar.gz: ba89510aba2923e06632876f740242325e26ebecd48d231b4fcef03cfe1a1417878eba48c63c0ca7d1e040ba029ff2493afdc0e1ff764be6d91fbb1c2c2abf20
6
+ metadata.gz: 47dc4effcf2bbd0d46a0be9738e761783a23bb6f2a35778913f02fc01910ee3b143d72b858007ef0e7dcb0e3570f7637b86ef6f1e3d013b7b71715cc6919c5b8
7
+ data.tar.gz: ac388ffaa4ea593ac4f96dd507d5d638a35bae9e526dffb772bacf0c8afd4f0f8639e8b255ff186e5e358ed921ed8cdce1d6a95fb152271462c97ab31610ae74
@@ -148,5 +148,34 @@
148
148
  * Bugfix: SOLR patching had an incorrect monkey patch
149
149
  * Implemented exception tracing using TracePoint see pp=trace-exceptions
150
150
 
151
+ 30-August-2013
152
+
153
+ * 1.30
154
+ * Feature: Added Rack::MiniProfiler.counter_method(klass,name) for injecting counters
155
+ * Bug: Counters were not shifting the table correctly
156
+
157
+ 3-September-2013
158
+
159
+ * Ripped out flamegraph so it can be isolated into a gem
160
+ * Flamegraph now has much increased fidelity
161
+ * Ripped out pp=sample it just was never really used
162
+
163
+ 17-September-2013 - Ross Wilson
164
+ * Instead of supressing all "/assets/" requests we now check the configured
165
+ config.assets.prefix path since developers can rename the path to serve Asset Pipeline
166
+ files from
167
+
168
+ 12-December-2013 - Sam Saffron
169
+ * Version 0.9.0.pre (bumped up to reflect the stability of the project)
170
+ * Improved reports for pp=profile-gc
171
+ * pp=flamegraph&flamegraph_sample_rate=1 , allow you to specify sampling rates
172
+
173
+ 13-March-2013 - Sam Saffron
174
+ * Version 0.9.1
175
+ * Added back Ruby 1.8 support (thanks Malet)
176
+ * Corrected Rails 3.0 support (thanks Zlatko)
177
+ * Corrected fix possible XSS (admin only)
178
+ * Amend Railstie so MiniProfiler can be launched with action view or action controller (Thanks Akira)
179
+ * Corrected Sql patching to avoid setting instance vars on nil which is frozen (thanks Andy, huoxito)
151
180
 
152
181
 
@@ -0,0 +1,269 @@
1
+ # rack-mini-profiler
2
+
3
+ [![Code Climate](https://codeclimate.com/github/MiniProfiler/rack-mini-profiler.png)](https://codeclimate.com/github/MiniProfiler/rack-mini-profiler) [![Build Status](https://travis-ci.org/MiniProfiler/rack-mini-profiler.png)](https://travis-ci.org/MiniProfiler/rack-mini-profiler)
4
+
5
+ Middleware that displays speed badge for every html page. Designed to work both in production and in development.
6
+
7
+ #### Features
8
+
9
+ * database profiling. Currently supports Mysql2, Postgres, and Mongoid3 (with fallback support to ActiveRecord)
10
+
11
+ #### Learn more
12
+
13
+ * [Visit our community](http://community.miniprofiler.com)
14
+ * [Watch the RailsCast](http://railscasts.com/episodes/368-miniprofiler)
15
+ * [Read about Flame graphs in rack-mini-profiler](http://samsaffron.com/archive/2013/03/19/flame-graphs-in-ruby-miniprofiler)
16
+ * [Read the announcement posts from 2012](http://samsaffron.com/archive/2012/07/12/miniprofiler-ruby-edition)
17
+
18
+ ## rack-mini-profiler needs your help
19
+
20
+ We have decided to restructure our repository so there is a central UI repo and the various language implementation have their own.
21
+
22
+ **WE NEED HELP.**
23
+
24
+ - Setting up a build that reuses https://github.com/MiniProfiler/ui
25
+ - Migrating the internal data structures [per the spec](https://github.com/MiniProfiler/ui)
26
+ - Cleaning up the [horrendous class structure that is using strings as keys and crazy non-objects](https://github.com/MiniProfiler/rack-mini-profiler/blob/master/lib/mini_profiler/sql_timer_struct.rb#L36-L44)
27
+
28
+ If you feel like taking on any of this start an issue and update us on your progress.
29
+
30
+ ## Installation
31
+
32
+ Install/add to Gemfile
33
+
34
+ ```ruby
35
+ gem 'rack-mini-profiler'
36
+ ```
37
+
38
+ NOTE: Be sure to require rack_mini_profiler below the `pg` and `mysql` gems in your Gemfile. rack_mini_profiler will identify these gems if they are loaded to insert instrumentation. If included too early no SQL will show up.
39
+
40
+ #### Rails
41
+
42
+ All you have to do is include the Gem and you're good to go in development. See notes below for use in production.
43
+
44
+ #### Rails and manual initialization
45
+
46
+ In case you need to make sure rack_mini_profiler initialized after all other gems.
47
+ Or you want to execute some code before rack_mini_profiler required.
48
+
49
+ ```ruby
50
+ gem 'rack-mini-profiler', require: false
51
+ ```
52
+
53
+ Then put initialize code in file like `config/initializers/rack_profiler.rb`
54
+
55
+ ```ruby
56
+ if Rails.env == 'development'
57
+ require 'rack-mini-profiler'
58
+
59
+ # initialization is skipped so trigger it
60
+ Rack::MiniProfilerRails.initialize!(Rails.application)
61
+ end
62
+ ```
63
+
64
+ #### Rack Builder
65
+
66
+ ```ruby
67
+ require 'rack-mini-profiler'
68
+ builder = Rack::Builder.new do
69
+ use Rack::MiniProfiler
70
+
71
+ map('/') { run get }
72
+ end
73
+ ```
74
+
75
+ #### Sinatra
76
+
77
+ ```ruby
78
+ require 'rack-mini-profiler'
79
+ class MyApp < Sinatra::Base
80
+ use Rack::MiniProfiler
81
+ end
82
+ ```
83
+
84
+ ### Flamegraphs
85
+
86
+ To generate [flamegraphs](http://samsaffron.com/archive/2013/03/19/flame-graphs-in-ruby-miniprofiler):
87
+
88
+ * add the **flamegraph** gem to your Gemfile
89
+ * visit a page in your app with `?pp=flamegraph`
90
+
91
+ Flamegraph generation is supported in MRI 2.0 and 2.1 only.
92
+
93
+
94
+ ## Access control in production
95
+
96
+ rack-mini-profiler is designed with production profiling in mind. To enable that just run `Rack::MiniProfiler.authorize_request` once you know a request is allowed to profile.
97
+
98
+ ```ruby
99
+ # A hook in your ApplicationController
100
+ def authorize
101
+ if current_user.is_admin?
102
+ Rack::MiniProfiler.authorize_request
103
+ end
104
+ end
105
+ ```
106
+
107
+ ## Configuration
108
+
109
+ Various aspects of rack-mini-profiler's behavior can be configured when your app boots.
110
+ For example in a Rails app, this should be done in an initializer:
111
+ **config/initializers/mini_profiler.rb**
112
+
113
+ ### Storage
114
+
115
+ rack-mini-profiler stores its results so they can be shared later and aren't lost at the end of the request.
116
+
117
+ There are 4 storage options: `MemoryStore`, `RedisStore`, `MemcacheStore`, and `FileStore`.
118
+
119
+ `FileStore` is the default in Rails environments and will write files to `tmp/miniprofiler/*`. `MemoryStore` is the default otherwise.
120
+
121
+ ```ruby
122
+ # set MemoryStore
123
+ Rack::MiniProfiler.config.storage = Rack::MiniProfiler::MemoryStore
124
+
125
+ # set RedisStore
126
+ if Rails.env.production?
127
+ uri = URI.parse(ENV["REDIS_SERVER_URL"])
128
+ Rack::MiniProfiler.config.storage_options = { :host => uri.host, :port => uri.port, :password => uri.password }
129
+ Rack::MiniProfiler.config.storage = Rack::MiniProfiler::RedisStore
130
+ end
131
+ ```
132
+
133
+ MemoryStore stores results in a processes heap - something that does not work well in a multi process environment.
134
+ FileStore stores results in the file system - something that may not work well in a multi machine environment.
135
+ RedisStore/MemcacheStore work in multi process and multi machine environments (RedisStore only saves results for up to 24 hours so it won't continue to fill up Redis).
136
+
137
+ Additionally you may implement an AbstractStore for your own provider.
138
+
139
+ ### User result segregation
140
+
141
+ MiniProfiler will attempt to keep all user results isolated, out-of-the-box the user provider uses the ip address:
142
+
143
+ ```ruby
144
+ Rack::MiniProfiler.config.user_provider = Proc.new{|env| Rack::Request.new(env).ip}
145
+ ```
146
+
147
+ You can override (something that is very important in a multi-machine production setup):
148
+
149
+ ```ruby
150
+ Rack::MiniProfiler.config.user_provider = Proc.new{ |env| CurrentUser.get(env) }
151
+ ```
152
+
153
+ The string this function returns should be unique for each user on the system (for anonymous you may need to fall back to ip address)
154
+
155
+ ### Configuration Options
156
+
157
+ You can set configuration options using the configuration accessor on `Rack::MiniProfiler`.
158
+ For example:
159
+
160
+ ```ruby
161
+ Rack::MiniProfiler.config.position = 'right'
162
+ Rack::MiniProfiler.config.start_hidden = true
163
+ ```
164
+ The available configuration options are:
165
+
166
+ * pre_authorize_cb - A lambda callback you can set to determine whether or not mini_profiler should be visible on a given request. Default in a Rails environment is only on in development mode. If in a Rack app, the default is always on.
167
+ * position - Can either be 'right' or 'left'. Default is 'left'.
168
+ * skip_schema_queries - Whether or not you want to log the queries about the schema of your tables. Default is 'false', 'true' in rails development.
169
+ * auto_inject (default true) - when false the miniprofiler script is not injected in the page
170
+ * backtrace_filter - a regex you can use to filter out unwanted lines from the backtraces
171
+ * toggle_shortcut (default Alt+P) - a jquery.hotkeys.js-style keyboard shortcut, used to toggle the mini_profiler's visibility. See http://code.google.com/p/js-hotkeys/ for more info.
172
+ * start_hidden (default false) - Whether or not you want the mini_profiler to be visible when loading a page
173
+ * backtrace_threshold_ms (default zero) - Minimum SQL query elapsed time before a backtrace is recorded. Backtrace recording can take a couple of milliseconds on rubies earlier than 2.0, impacting performance for very small queries.
174
+ * flamegraph_sample_rate (default 0.5ms) - How often fast_stack should get stack trace info to generate flamegraphs
175
+
176
+ ### Custom middleware ordering (required if using `Rack::Deflate` with Rails)
177
+
178
+ If you are using `Rack::Deflate` with rails and rack-mini-profiler in its default configuration,
179
+ `Rack::MiniProfiler` will be injected (as always) at position 0 in the middleware stack. This
180
+ will result in it attempting to inject html into the already-compressed response body. To fix this,
181
+ the middleware ordering must be overriden.
182
+
183
+ To do this, first add `, require: false` to the gemfile entry for rack-mini-profiler.
184
+ This will prevent the railtie from running. Then, customize the initialization
185
+ in the initializer like so:
186
+
187
+ ```ruby
188
+ require 'rack-mini-profiler'
189
+
190
+ Rack::MiniProfilerRails.initialize!(Rails.application)
191
+
192
+ Rails.application.middleware.delete(Rack::MiniProfiler)
193
+ Rails.application.middleware.insert_after(Rack::Deflater, Rack::MiniProfiler)
194
+ ```
195
+
196
+ Deleting the middleware and then reinserting it is a bit inelegant, but
197
+ a sufficient and costless solution. It is possible that rack-mini-profiler might
198
+ support this scenario more directly if it is found that
199
+ there is significant need for this confriguration or that
200
+ the above recipe causes problems.
201
+
202
+
203
+ ## Special query strings
204
+
205
+ If you include the query string `pp=help` at the end of your request you will see the various options available. You can use these options to extend or contract the amount of diagnostics rack-mini-profiler gathers.
206
+
207
+
208
+ ## Rails 2.X support
209
+
210
+ To get MiniProfiler working with Rails 2.3.X you need to do the initialization manually as well as monkey patch away an incompatibility between activesupport and json_pure.
211
+
212
+ Add the following code to your environment.rb (or just in a specific environment such as development.rb) for initialization and configuration of MiniProfiler.
213
+
214
+ ```ruby
215
+ # configure and initialize MiniProfiler
216
+ require 'rack-mini-profiler'
217
+ c = ::Rack::MiniProfiler.config
218
+ c.pre_authorize_cb = lambda { |env|
219
+ Rails.env.development? || Rails.env.production?
220
+ }
221
+ tmp = Rails.root.to_s + "/tmp/miniprofiler"
222
+ FileUtils.mkdir_p(tmp) unless File.exists?(tmp)
223
+ c.storage_options = {:path => tmp}
224
+ c.storage = ::Rack::MiniProfiler::FileStore
225
+ config.middleware.use(::Rack::MiniProfiler)
226
+ ::Rack::MiniProfiler.profile_method(ActionController::Base, :process) {|action| "Executing action: #{action}"}
227
+ ::Rack::MiniProfiler.profile_method(ActionView::Template, :render) {|x,y| "Rendering: #{path_without_format_and_extension}"}
228
+
229
+ # monkey patch away an activesupport and json_pure incompatability
230
+ # http://pivotallabs.com/users/alex/blog/articles/1332-monkey-patch-of-the-day-activesupport-vs-json-pure-vs-ruby-1-8
231
+ if JSON.const_defined?(:Pure)
232
+ class JSON::Pure::Generator::State
233
+ include ActiveSupport::CoreExtensions::Hash::Except
234
+ end
235
+ end
236
+ ```
237
+
238
+ ## Running the Specs
239
+
240
+ ```
241
+ $ rake build
242
+ $ rake spec
243
+ ```
244
+
245
+ Additionally you can also run `autotest` if you like.
246
+
247
+ ## Licence
248
+
249
+ The MIT License (MIT)
250
+
251
+ Copyright (c) 2013 Sam Saffron
252
+
253
+ Permission is hereby granted, free of charge, to any person obtaining a copy
254
+ of this software and associated documentation files (the "Software"), to deal
255
+ in the Software without restriction, including without limitation the rights
256
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
257
+ copies of the Software, and to permit persons to whom the Software is
258
+ furnished to do so, subject to the following conditions:
259
+
260
+ The above copyright notice and this permission notice shall be included in
261
+ all copies or substantial portions of the Software.
262
+
263
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
264
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
265
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
266
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
267
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
268
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
269
+ THE SOFTWARE.
File without changes
@@ -1,4 +1,4 @@
1
- "use strict";
1
+ "use strict";
2
2
  var MiniProfiler = (function () {
3
3
  var $;
4
4
 
@@ -659,6 +659,14 @@ var MiniProfiler = (function () {
659
659
  } else {
660
660
  doInit();
661
661
  }
662
+
663
+ // jquery.hotkeys.js
664
+ // https://github.com/jeresig/jquery.hotkeys/blob/master/jquery.hotkeys.js
665
+
666
+ (function(d){function h(g){if("string"===typeof g.data){var h=g.handler,j=g.data.toLowerCase().split(" ");g.handler=function(b){if(!(this!==b.target&&(/textarea|select/i.test(b.target.nodeName)||"text"===b.target.type))){var c="keypress"!==b.type&&d.hotkeys.specialKeys[b.which],e=String.fromCharCode(b.which).toLowerCase(),a="",f={};b.altKey&&"alt"!==c&&(a+="alt+");b.ctrlKey&&"ctrl"!==c&&(a+="ctrl+");b.metaKey&&(!b.ctrlKey&&"meta"!==c)&&(a+="meta+");b.shiftKey&&"shift"!==c&&(a+="shift+");c?f[a+c]=
667
+ !0:(f[a+e]=!0,f[a+d.hotkeys.shiftNums[e]]=!0,"shift+"===a&&(f[d.hotkeys.shiftNums[e]]=!0));c=0;for(e=j.length;c<e;c++)if(f[j[c]])return h.apply(this,arguments)}}}}d.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",
668
+ 109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};d.each(["keydown","keyup","keypress"],function(){d.event.special[this]={add:h}})})(MiniProfiler.jQuery);
669
+
662
670
  };
663
671
 
664
672
  var major, minor;
@@ -901,13 +909,6 @@ var MiniProfiler = (function () {
901
909
 
902
910
  MiniProfiler.init();
903
911
 
904
- // jquery.hotkeys.js
905
- // https://github.com/jeresig/jquery.hotkeys/blob/master/jquery.hotkeys.js
906
-
907
- (function(d){function h(g){if("string"===typeof g.data){var h=g.handler,j=g.data.toLowerCase().split(" ");g.handler=function(b){if(!(this!==b.target&&(/textarea|select/i.test(b.target.nodeName)||"text"===b.target.type))){var c="keypress"!==b.type&&d.hotkeys.specialKeys[b.which],e=String.fromCharCode(b.which).toLowerCase(),a="",f={};b.altKey&&"alt"!==c&&(a+="alt+");b.ctrlKey&&"ctrl"!==c&&(a+="ctrl+");b.metaKey&&(!b.ctrlKey&&"meta"!==c)&&(a+="meta+");b.shiftKey&&"shift"!==c&&(a+="shift+");c?f[a+c]=
908
- !0:(f[a+e]=!0,f[a+d.hotkeys.shiftNums[e]]=!0,"shift+"===a&&(f[d.hotkeys.shiftNums[e]]=!0));c=0;for(e=j.length;c<e;c++)if(f[j[c]])return h.apply(this,arguments)}}}}d.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",
909
- 109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(","0":")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}};d.each(["keydown","keyup","keypress"],function(){d.event.special[this]={add:h}})})(jQuery);
910
-
911
912
  if (typeof prettyPrint === "undefined") {
912
913
 
913
914
  // prettify.js
File without changes
@@ -1,4 +1,4 @@
1
- <script id="profilerTemplate" type="text/x-jquery-tmpl">
1
+ <script id="profilerTemplate" type="text/x-jquery-tmpl">
2
2
 
3
3
  <div class="profiler-result">
4
4
 
@@ -159,6 +159,8 @@
159
159
  <td class="profiler-duration" title="aggregate duration of all queries in this step (excludes children)">
160
160
  ${MiniProfiler.formatDuration(timing.SqlTimingsDurationMilliseconds)}
161
161
  </td>
162
+ {{else}}
163
+ <td colspan="2"></td>
162
164
  {{/if}}
163
165
 
164
166
  {{each page.CustomTimingNames}}
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- tbody tr:nth-child(odd) { background-color:#eee; }
1
+ tbody tr:nth-child(odd) { background-color:#eee; }
2
2
  tbody tr:nth-child(even) { background-color:#fff; }
3
3
  table { border: 0; border-spacing:0;}
4
4
  tr {border: 0;}
@@ -6,4 +6,4 @@ tr {border: 0;}
6
6
  td {padding: 8px;}
7
7
  .time {text-align:center;}
8
8
  thead tr {background-color: #bbb; color: #444; font-size: 12px;}
9
- thead tr th { padding: 5px 15px;}
9
+ thead tr th { padding: 5px 15px;}
@@ -1,4 +1,4 @@
1
- var MiniProfiler = MiniProfiler || {};
1
+ var MiniProfiler = MiniProfiler || {};
2
2
  MiniProfiler.list = {
3
3
  init:
4
4
  function (options) {
@@ -1,4 +1,4 @@
1
- <script id="tableTemplate" type="text/x-jquery-tmpl">
1
+ <script id="tableTemplate" type="text/x-jquery-tmpl">
2
2
  <table>
3
3
  <thead>
4
4
  <tr>
@@ -31,4 +31,4 @@
31
31
  <td colspan="3"></td>
32
32
  {{/if}}
33
33
  </tr>
34
- </script>
34
+ </script>
@@ -0,0 +1 @@
1
+ <script async type="text/javascript" id="mini-profiler" src="{path}includes.js?v={version}" data-version="{version}" data-path="{path}" data-current-id="{currentId}" data-ids="{ids}" data-position="{position}" data-trivial="{showTrivial}" data-children="{showChildren}" data-max-traces="{maxTracesToShow}" data-controls="{showControls}" data-authorized="{authorized}" data-toggle-shortcut="{toggleShortcut}" data-start-hidden="{startHidden}"></script>
@@ -1,4 +1,4 @@
1
- <html>
1
+ <html>
2
2
  <head>
3
3
  <title>{name} ({duration} ms) - Profiling Results</title>
4
4
  <script type='text/javascript' src='{path}jquery.1.7.1.js?v={version}'></script>
@@ -8,4 +8,4 @@
8
8
  <body>
9
9
  <div class='profiler-result-full'></div>
10
10
  </body>
11
- </html>
11
+ </html>
@@ -1,20 +1,20 @@
1
1
  module Rack
2
2
  class MiniProfiler
3
3
  class ClientSettings
4
-
4
+
5
5
  COOKIE_NAME = "__profilin"
6
6
 
7
7
  BACKTRACE_DEFAULT = nil
8
- BACKTRACE_FULL = 1
8
+ BACKTRACE_FULL = 1
9
9
  BACKTRACE_NONE = 2
10
10
 
11
11
  attr_accessor :disable_profiling
12
12
  attr_accessor :backtrace_level
13
13
 
14
-
14
+
15
15
  def initialize(env)
16
16
  request = ::Rack::Request.new(env)
17
- @cookie = request.cookies[COOKIE_NAME]
17
+ @cookie = request.cookies[COOKIE_NAME]
18
18
  if @cookie
19
19
  @cookie.split(",").map{|pair| pair.split("=")}.each do |k,v|
20
20
  @orig_disable_profiling = @disable_profiling = (v=='t') if k == "dp"
@@ -22,7 +22,7 @@ module Rack
22
22
  end
23
23
  end
24
24
 
25
- @backtrace_level = nil if !@backtrace_level.nil? && (@backtrace_level == 0 || @backtrace_level > BACKTRACE_NONE)
25
+ @backtrace_level = nil if !@backtrace_level.nil? && (@backtrace_level == 0 || @backtrace_level > BACKTRACE_NONE)
26
26
  @orig_backtrace_level = @backtrace_level
27
27
 
28
28
  end
@@ -30,7 +30,7 @@ module Rack
30
30
  def write!(headers)
31
31
  if @orig_disable_profiling != @disable_profiling || @orig_backtrace_level != @backtrace_level || @cookie.nil?
32
32
  settings = {"p" => "t" }
33
- settings["dp"] = "t" if @disable_profiling
33
+ settings["dp"] = "t" if @disable_profiling
34
34
  settings["bt"] = @backtrace_level if @backtrace_level
35
35
  settings_string = settings.map{|k,v| "#{k}=#{v}"}.join(",")
36
36
  Rack::Utils.set_cookie_header!(headers, COOKIE_NAME, :value => settings_string, :path => '/')
@@ -45,19 +45,19 @@ module Rack
45
45
  !@cookie.nil?
46
46
  end
47
47
 
48
- def disable_profiling?
48
+ def disable_profiling?
49
49
  @disable_profiling
50
50
  end
51
51
 
52
- def backtrace_full?
52
+ def backtrace_full?
53
53
  @backtrace_level == BACKTRACE_FULL
54
54
  end
55
55
 
56
- def backtrace_default?
56
+ def backtrace_default?
57
57
  @backtrace_level == BACKTRACE_DEFAULT
58
58
  end
59
-
60
- def backtrace_none?
59
+
60
+ def backtrace_none?
61
61
  @backtrace_level == BACKTRACE_NONE
62
62
  end
63
63
  end