rack-mini-profiler 0.1.6 → 0.1.11.pre

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.

data/CHANGELOG CHANGED
@@ -24,3 +24,26 @@
24
24
  * Added some more client probing built in to rails
25
25
  * More tests
26
26
 
27
+ 18-July-2012 - Sam
28
+
29
+ * Added First Paint time for chrome
30
+ * Bug fix to ensure non Rails installs have mini profiler
31
+ * Version 0.1.7
32
+
33
+ 30-July-2012 - Sam
34
+
35
+ * Made compliant with ancient versions of Rack (including Rack used by Rails2)
36
+ * Fixed broken share link
37
+ * Fixed crashes on startup (in MemoryStore and FileStore)
38
+ * Version 0.1.8
39
+ * Unicode fix
40
+ * Version 0.1.9
41
+
42
+ 7-August-2012 - Sam
43
+
44
+ * Added option to disable profiler for the current session (pp=disable / pp=enable)
45
+ * yajl compatability contributed by Sven Riedel
46
+
47
+ 10-August-2012 - Sam
48
+
49
+ * Added basic prepared statement profiling for postgres
data/README.md CHANGED
@@ -47,6 +47,24 @@ class MyApp < Sinatra::Base
47
47
  end
48
48
  ```
49
49
 
50
+ ## Storage
51
+
52
+ By default, rack-mini-profiler stores its results in a memory store:
53
+
54
+ ```ruby
55
+ # our default
56
+ Rack::MiniProfiler.config.storage = Rack::MiniProfiler::MemoryStore
57
+ ```
58
+
59
+ There are 2 other available storage engines, `RedisStore` and `FileStore`.
60
+
61
+ MemoryStore is stores results in a processes heap - something that does not work well in a multi process environment.
62
+ FileStore stores results in the file system - something that may not work well in a multi machine environment.
63
+
64
+ Additionally you may implement an AbstractStore for your own provider.
65
+
66
+ Rails hooks up a FileStore for all environments.
67
+
50
68
  ## Running the Specs
51
69
 
52
70
  ```
@@ -67,11 +85,18 @@ Rack::MiniProfiler.config.position = 'right'
67
85
 
68
86
  In a Rails app, this can be done conveniently in an initializer such as config/initializers/mini_profiler.rb.
69
87
 
88
+ ## Rails 2.X support
89
+
90
+ MiniProfiler uses [railtie](https://github.com/SamSaffron/MiniProfiler/blob/master/Ruby/lib/mini_profiler_rails/railtie.rb) to bootstrap itself. This will not be called in a Rails 2 app. You are going to need to hook it up manually. (TODO: document this - pull request please)
91
+
70
92
  ## Available Options
71
93
 
72
94
  * 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.
73
95
  * position - Can either be 'right' or 'left'. Default is 'left'.
74
96
  * 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.
97
+ * use_existing_jquery - Use the version of jQuery on the page as opposed to the self contained one
98
+ * auto_inject (default true) - when false the miniprofiler script is not injected in the page
99
+ * backtrace_filter - a regex you can use to filter out unwanted lines from the backtraces
75
100
 
76
101
  ## Special query strings
77
102
 
@@ -1 +1,75 @@
1
- .profiler-result,.profiler-queries{color:#555;line-height:1;font-size:12px;}.profiler-result pre,.profiler-queries pre,.profiler-result code,.profiler-queries code,.profiler-result label,.profiler-queries label,.profiler-result table,.profiler-queries table,.profiler-result tbody,.profiler-queries tbody,.profiler-result thead,.profiler-queries thead,.profiler-result tfoot,.profiler-queries tfoot,.profiler-result tr,.profiler-queries tr,.profiler-result th,.profiler-queries th,.profiler-result td,.profiler-queries td{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline;background-color:transparent;overflow:visible;max-height:none;}.profiler-result table,.profiler-queries table{border-collapse:collapse;border-spacing:0;}.profiler-result a,.profiler-queries a,.profiler-result a:hover,.profiler-queries a:hover{cursor:pointer;color:#07c;}.profiler-result a,.profiler-queries a{text-decoration:none;}.profiler-result a:hover,.profiler-queries a:hover{text-decoration:underline;}.profiler-result{font-family:Helvetica,Arial,sans-serif;}.profiler-result .profiler-toggle-duration-with-children{float:right;}.profiler-result table.profiler-client-timings{margin-top:10px;}.profiler-result .profiler-label{color:#555;overflow:hidden;text-overflow:ellipsis;}.profiler-result .profiler-unit{color:#aaa;}.profiler-result .profiler-trivial{display:none;}.profiler-result .profiler-trivial td,.profiler-result .profiler-trivial td *{color:#aaa !important;}.profiler-result pre,.profiler-result code,.profiler-result .profiler-number,.profiler-result .profiler-unit{font-family:Consolas,monospace,serif;}.profiler-result .profiler-number{color:#111;}.profiler-result .profiler-info{text-align:right;}.profiler-result .profiler-info .profiler-name{float:left;}.profiler-result .profiler-info .profiler-server-time{white-space:nowrap;}.profiler-result .profiler-timings th{background-color:#fff;color:#aaa;text-align:right;}.profiler-result .profiler-timings th,.profiler-result .profiler-timings td{white-space:nowrap;}.profiler-result .profiler-timings .profiler-duration-with-children{display:none;}.profiler-result .profiler-timings .profiler-duration{font-family:Consolas,monospace,serif;color:#111;text-align:right;}.profiler-result .profiler-timings .profiler-indent{letter-spacing:4px;}.profiler-result .profiler-timings .profiler-queries-show .profiler-number,.profiler-result .profiler-timings .profiler-queries-show .profiler-unit{color:#07c;}.profiler-result .profiler-timings .profiler-queries-duration{padding-left:6px;}.profiler-result .profiler-timings .profiler-percent-in-sql{white-space:nowrap;text-align:right;}.profiler-result .profiler-timings tfoot td{padding-top:10px;text-align:right;}.profiler-result .profiler-timings tfoot td a{font-size:95%;display:inline-block;margin-left:12px;}.profiler-result .profiler-timings tfoot td a:first-child{float:left;margin-left:0px;}.profiler-result .profiler-queries{font-family:Helvetica,Arial,sans-serif;}.profiler-result .profiler-queries .profiler-stack-trace{margin-bottom:15px;}.profiler-result .profiler-queries pre{font-family:Consolas,monospace,serif;white-space:pre-wrap;}.profiler-result .profiler-queries th{background-color:#fff;border-bottom:1px solid #555;font-weight:bold;padding:15px;white-space:nowrap;}.profiler-result .profiler-queries td{padding:15px;text-align:left;background-color:#fff;}.profiler-result .profiler-queries td:last-child{padding-right:25px;}.profiler-result .profiler-queries .profiler-odd td{background-color:#e5e5e5;}.profiler-result .profiler-queries .profiler-since-start,.profiler-result .profiler-queries .profiler-duration{text-align:right;}.profiler-result .profiler-queries .profiler-info div{text-align:right;margin-bottom:5px;}.profiler-result .profiler-queries .profiler-gap-info,.profiler-result .profiler-queries .profiler-gap-info td{background-color:#ccc;}.profiler-result .profiler-queries .profiler-gap-info .profiler-unit{color:#777;}.profiler-result .profiler-queries .profiler-gap-info .profiler-info{text-align:right;}.profiler-result .profiler-queries .profiler-gap-info.profiler-trivial-gaps{display:none;}.profiler-result .profiler-queries .profiler-trivial-gap-container{text-align:center;}.profiler-result .profiler-queries .str{color:maroon;}.profiler-result .profiler-queries .kwd{color:#00008b;}.profiler-result .profiler-queries .com{color:gray;}.profiler-result .profiler-queries .typ{color:#2b91af;}.profiler-result .profiler-queries .lit{color:maroon;}.profiler-result .profiler-queries .pun{color:#000;}.profiler-result .profiler-queries .pln{color:#000;}.profiler-result .profiler-queries .tag{color:maroon;}.profiler-result .profiler-queries .atn{color:red;}.profiler-result .profiler-queries .atv{color:blue;}.profiler-result .profiler-queries .dec{color:purple;}.profiler-result .profiler-warning,.profiler-result .profiler-warning *,.profiler-result .profiler-warning .profiler-queries-show,.profiler-result .profiler-warning .profiler-queries-show .profiler-unit{color:#f00;}.profiler-result .profiler-warning:hover,.profiler-result .profiler-warning *:hover,.profiler-result .profiler-warning .profiler-queries-show:hover,.profiler-result .profiler-warning .profiler-queries-show .profiler-unit:hover{color:#f00;}.profiler-result .profiler-nuclear{color:#f00;font-weight:bold;padding-right:2px;}.profiler-result .profiler-nuclear:hover{color:#f00;}.profiler-results{z-index:2147483643;position:fixed;top:0px;}.profiler-results.profiler-left{left:0px;}.profiler-results.profiler-left.profiler-no-controls .profiler-result:last-child .profiler-button,.profiler-results.profiler-left .profiler-controls{-webkit-border-bottom-right-radius:10px;-moz-border-radius-bottomright:10px;border-bottom-right-radius:10px;}.profiler-results.profiler-left .profiler-button,.profiler-results.profiler-left .profiler-controls{border-right:1px solid #888;}.profiler-results.profiler-right{right:0px;}.profiler-results.profiler-right.profiler-no-controls .profiler-result:last-child .profiler-button,.profiler-results.profiler-right .profiler-controls{-webkit-border-bottom-left-radius:10px;-moz-border-radius-bottomleft:10px;border-bottom-left-radius:10px;}.profiler-results.profiler-right .profiler-button,.profiler-results.profiler-right .profiler-controls{border-left:1px solid #888;}.profiler-results .profiler-button,.profiler-results .profiler-controls{display:none;z-index:2147483640;border-bottom:1px solid #888;background-color:#fff;padding:4px 7px;text-align:right;cursor:pointer;}.profiler-results .profiler-button.profiler-button-active,.profiler-results .profiler-controls.profiler-button-active{background-color:maroon;}.profiler-results .profiler-button.profiler-button-active .profiler-number,.profiler-results .profiler-controls.profiler-button-active .profiler-number,.profiler-results .profiler-button.profiler-button-active .profiler-nuclear,.profiler-results .profiler-controls.profiler-button-active .profiler-nuclear{color:#fff;font-weight:bold;}.profiler-results .profiler-button.profiler-button-active .profiler-unit,.profiler-results .profiler-controls.profiler-button-active .profiler-unit{color:#fff;font-weight:normal;}.profiler-results .profiler-controls{display:block;font-size:12px;font-family:Consolas,monospace,serif;cursor:default;text-align:center;}.profiler-results .profiler-controls span{border-right:1px solid #aaa;padding-right:5px;margin-right:5px;cursor:pointer;}.profiler-results .profiler-controls span:last-child{border-right:none;}.profiler-results .profiler-popup{display:none;z-index:2147483641;position:absolute;background-color:#fff;border:1px solid #aaa;padding:5px 10px;text-align:left;line-height:18px;overflow:auto;-moz-box-shadow:0px 1px 15px #555;-webkit-box-shadow:0px 1px 15px #555;box-shadow:0px 1px 15px #555;}.profiler-results .profiler-popup .profiler-info{margin-bottom:3px;padding-bottom:2px;border-bottom:1px solid #ddd;}.profiler-results .profiler-popup .profiler-info .profiler-name{font-size:110%;font-weight:bold;}.profiler-results .profiler-popup .profiler-info .profiler-name .profiler-overall-duration{display:none;}.profiler-results .profiler-popup .profiler-info .profiler-server-time{font-size:95%;}.profiler-results .profiler-popup .profiler-timings th,.profiler-results .profiler-popup .profiler-timings td{padding-left:6px;padding-right:6px;}.profiler-results .profiler-popup .profiler-timings th{font-size:95%;padding-bottom:3px;}.profiler-results .profiler-popup .profiler-timings .profiler-label{max-width:275px;}.profiler-results .profiler-queries{display:none;z-index:2147483643;position:absolute;overflow-y:auto;overflow-x:hidden;background-color:#fff;}.profiler-results .profiler-queries th{font-size:17px;}.profiler-results.profiler-min .profiler-result{display:none;}.profiler-results.profiler-min .profiler-controls span{display:none;}.profiler-results.profiler-min .profiler-controls .profiler-min-max{border-right:none;padding:0px;margin:0px;}.profiler-queries-bg{z-index:2147483642;display:none;background:#000;opacity:0.7;position:absolute;top:0px;left:0px;min-width:100%;}.profiler-result-full .profiler-result{width:950px;margin:30px auto;}.profiler-result-full .profiler-result .profiler-button{display:none;}.profiler-result-full .profiler-result .profiler-popup .profiler-info{font-size:25px;border-bottom:1px solid #aaa;padding-bottom:3px;margin-bottom:25px;}.profiler-result-full .profiler-result .profiler-popup .profiler-info .profiler-overall-duration{padding-right:20px;font-size:80%;color:#888;}.profiler-result-full .profiler-result .profiler-popup .profiler-timings td,.profiler-result-full .profiler-result .profiler-popup .profiler-timings th{padding-left:8px;padding-right:8px;}.profiler-result-full .profiler-result .profiler-popup .profiler-timings th{padding-bottom:7px;}.profiler-result-full .profiler-result .profiler-popup .profiler-timings td{font-size:14px;padding-bottom:4px;}.profiler-result-full .profiler-result .profiler-popup .profiler-timings td:first-child{padding-left:10px;}.profiler-result-full .profiler-result .profiler-popup .profiler-timings .profiler-label{max-width:550px;}.profiler-result-full .profiler-result .profiler-queries{margin:25px 0;}.profiler-result-full .profiler-result .profiler-queries table{width:100%;}.profiler-result-full .profiler-result .profiler-queries th{font-size:16px;color:#555;line-height:20px;}.profiler-result-full .profiler-result .profiler-queries td{padding:15px 10px;text-align:left;}.profiler-result-full .profiler-result .profiler-queries .profiler-info div{text-align:right;margin-bottom:5px;}
1
+ .profiler-result,.profiler-queries{color:#555;line-height:1;font-size:12px;}.profiler-result pre,.profiler-queries pre,.profiler-result code,.profiler-queries code,.profiler-result label,.profiler-queries label,.profiler-result table,.profiler-queries table,.profiler-result tbody,.profiler-queries tbody,.profiler-result thead,.profiler-queries thead,.profiler-result tfoot,.profiler-queries tfoot,.profiler-result tr,.profiler-queries tr,.profiler-result th,.profiler-queries th,.profiler-result td,.profiler-queries td{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline;background-color:transparent;overflow:visible;max-height:none;}
2
+ .profiler-result table,.profiler-queries table{border-collapse:collapse;border-spacing:0;}
3
+ .profiler-result a,.profiler-queries a,.profiler-result a:hover,.profiler-queries a:hover{cursor:pointer;color:#0077cc;}
4
+ .profiler-result a,.profiler-queries a{text-decoration:none;}.profiler-result a:hover,.profiler-queries a:hover{text-decoration:underline;}
5
+ .profiler-result{font-family:Helvetica,Arial,sans-serif;}.profiler-result .profiler-toggle-duration-with-children{float:right;}
6
+ .profiler-result table.profiler-client-timings{margin-top:10px;}
7
+ .profiler-result .profiler-label{color:#555555;overflow:hidden;text-overflow:ellipsis;}
8
+ .profiler-result .profiler-unit{color:#aaaaaa;}
9
+ .profiler-result .profiler-trivial{display:none;}.profiler-result .profiler-trivial td,.profiler-result .profiler-trivial td *{color:#aaaaaa !important;}
10
+ .profiler-result pre,.profiler-result code,.profiler-result .profiler-number,.profiler-result .profiler-unit{font-family:Consolas,monospace,serif;}
11
+ .profiler-result .profiler-number{color:#111111;}
12
+ .profiler-result .profiler-info{text-align:right;}.profiler-result .profiler-info .profiler-name{float:left;}
13
+ .profiler-result .profiler-info .profiler-server-time{white-space:nowrap;}
14
+ .profiler-result .profiler-timings th{background-color:#fff;color:#aaaaaa;text-align:right;}
15
+ .profiler-result .profiler-timings th,.profiler-result .profiler-timings td{white-space:nowrap;}
16
+ .profiler-result .profiler-timings .profiler-duration-with-children{display:none;}
17
+ .profiler-result .profiler-timings .profiler-duration{font-family:Consolas,monospace,serif;color:#111111;text-align:right;}
18
+ .profiler-result .profiler-timings .profiler-indent{letter-spacing:4px;}
19
+ .profiler-result .profiler-timings .profiler-queries-show .profiler-number,.profiler-result .profiler-timings .profiler-queries-show .profiler-unit{color:#0077cc;}
20
+ .profiler-result .profiler-timings .profiler-queries-duration{padding-left:6px;}
21
+ .profiler-result .profiler-timings .profiler-percent-in-sql{white-space:nowrap;text-align:right;}
22
+ .profiler-result .profiler-timings tfoot td{padding-top:10px;text-align:right;}.profiler-result .profiler-timings tfoot td a{font-size:95%;display:inline-block;margin-left:12px;}.profiler-result .profiler-timings tfoot td a:first-child{float:left;margin-left:0px;}
23
+ .profiler-result .profiler-queries{font-family:Helvetica,Arial,sans-serif;}.profiler-result .profiler-queries .profiler-stack-trace{margin-bottom:15px;}
24
+ .profiler-result .profiler-queries pre{font-family:Consolas,monospace,serif;white-space:pre-wrap;}
25
+ .profiler-result .profiler-queries th{background-color:#fff;border-bottom:1px solid #555;font-weight:bold;padding:15px;white-space:nowrap;}
26
+ .profiler-result .profiler-queries td{padding:15px;text-align:left;background-color:#fff;}.profiler-result .profiler-queries td:last-child{padding-right:25px;}
27
+ .profiler-result .profiler-queries .profiler-odd td{background-color:#e5e5e5;}
28
+ .profiler-result .profiler-queries .profiler-since-start,.profiler-result .profiler-queries .profiler-duration{text-align:right;}
29
+ .profiler-result .profiler-queries .profiler-info div{text-align:right;margin-bottom:5px;}
30
+ .profiler-result .profiler-queries .profiler-gap-info,.profiler-result .profiler-queries .profiler-gap-info td{background-color:#ccc;}
31
+ .profiler-result .profiler-queries .profiler-gap-info .profiler-unit{color:#777;}
32
+ .profiler-result .profiler-queries .profiler-gap-info .profiler-info{text-align:right;}
33
+ .profiler-result .profiler-queries .profiler-gap-info.profiler-trivial-gaps{display:none;}
34
+ .profiler-result .profiler-queries .profiler-trivial-gap-container{text-align:center;}
35
+ .profiler-result .profiler-queries .str{color:#800000;}
36
+ .profiler-result .profiler-queries .kwd{color:#00008b;}
37
+ .profiler-result .profiler-queries .com{color:#808080;}
38
+ .profiler-result .profiler-queries .typ{color:#2b91af;}
39
+ .profiler-result .profiler-queries .lit{color:#800000;}
40
+ .profiler-result .profiler-queries .pun{color:#000000;}
41
+ .profiler-result .profiler-queries .pln{color:#000000;}
42
+ .profiler-result .profiler-queries .tag{color:#800000;}
43
+ .profiler-result .profiler-queries .atn{color:#ff0000;}
44
+ .profiler-result .profiler-queries .atv{color:#0000ff;}
45
+ .profiler-result .profiler-queries .dec{color:#800080;}
46
+ .profiler-result .profiler-warning,.profiler-result .profiler-warning *,.profiler-result .profiler-warning .profiler-queries-show,.profiler-result .profiler-warning .profiler-queries-show .profiler-unit{color:#f00;}.profiler-result .profiler-warning:hover,.profiler-result .profiler-warning *:hover,.profiler-result .profiler-warning .profiler-queries-show:hover,.profiler-result .profiler-warning .profiler-queries-show .profiler-unit:hover{color:#f00;}
47
+ .profiler-result .profiler-nuclear{color:#f00;font-weight:bold;padding-right:2px;}.profiler-result .profiler-nuclear:hover{color:#f00;}
48
+ .profiler-results{z-index:2147483643;position:fixed;top:0px;}.profiler-results.profiler-left{left:0px;}.profiler-results.profiler-left.profiler-no-controls .profiler-result:last-child .profiler-button,.profiler-results.profiler-left .profiler-controls{-webkit-border-bottom-right-radius:10px;-moz-border-radius-bottomright:10px;border-bottom-right-radius:10px;}
49
+ .profiler-results.profiler-left .profiler-button,.profiler-results.profiler-left .profiler-controls{border-right:1px solid #888888;}
50
+ .profiler-results.profiler-right{right:0px;}.profiler-results.profiler-right.profiler-no-controls .profiler-result:last-child .profiler-button,.profiler-results.profiler-right .profiler-controls{-webkit-border-bottom-left-radius:10px;-moz-border-radius-bottomleft:10px;border-bottom-left-radius:10px;}
51
+ .profiler-results.profiler-right .profiler-button,.profiler-results.profiler-right .profiler-controls{border-left:1px solid #888888;}
52
+ .profiler-results .profiler-button,.profiler-results .profiler-controls{display:none;z-index:2147483640;border-bottom:1px solid #888888;background-color:#fff;padding:4px 7px;text-align:right;cursor:pointer;}.profiler-results .profiler-button.profiler-button-active,.profiler-results .profiler-controls.profiler-button-active{background-color:maroon;}.profiler-results .profiler-button.profiler-button-active .profiler-number,.profiler-results .profiler-controls.profiler-button-active .profiler-number,.profiler-results .profiler-button.profiler-button-active .profiler-nuclear,.profiler-results .profiler-controls.profiler-button-active .profiler-nuclear{color:#fff;font-weight:bold;}
53
+ .profiler-results .profiler-button.profiler-button-active .profiler-unit,.profiler-results .profiler-controls.profiler-button-active .profiler-unit{color:#fff;font-weight:normal;}
54
+ .profiler-results .profiler-controls{display:block;font-size:12px;font-family:Consolas,monospace,serif;cursor:default;text-align:center;}.profiler-results .profiler-controls span{border-right:1px solid #aaaaaa;padding-right:5px;margin-right:5px;cursor:pointer;}
55
+ .profiler-results .profiler-controls span:last-child{border-right:none;}
56
+ .profiler-results .profiler-popup{display:none;z-index:2147483641;position:absolute;background-color:#fff;border:1px solid #aaa;padding:5px 10px;text-align:left;line-height:18px;overflow:auto;-moz-box-shadow:0px 1px 15px #555555;-webkit-box-shadow:0px 1px 15px #555555;box-shadow:0px 1px 15px #555555;}.profiler-results .profiler-popup .profiler-info{margin-bottom:3px;padding-bottom:2px;border-bottom:1px solid #ddd;}.profiler-results .profiler-popup .profiler-info .profiler-name{font-size:110%;font-weight:bold;}.profiler-results .profiler-popup .profiler-info .profiler-name .profiler-overall-duration{display:none;}
57
+ .profiler-results .profiler-popup .profiler-info .profiler-server-time{font-size:95%;}
58
+ .profiler-results .profiler-popup .profiler-timings th,.profiler-results .profiler-popup .profiler-timings td{padding-left:6px;padding-right:6px;}
59
+ .profiler-results .profiler-popup .profiler-timings th{font-size:95%;padding-bottom:3px;}
60
+ .profiler-results .profiler-popup .profiler-timings .profiler-label{max-width:275px;}
61
+ .profiler-results .profiler-queries{display:none;z-index:2147483643;position:absolute;overflow-y:auto;overflow-x:hidden;background-color:#fff;}.profiler-results .profiler-queries th{font-size:17px;}
62
+ .profiler-results.profiler-min .profiler-result{display:none;}
63
+ .profiler-results.profiler-min .profiler-controls span{display:none;}
64
+ .profiler-results.profiler-min .profiler-controls .profiler-min-max{border-right:none;padding:0px;margin:0px;}
65
+ .profiler-queries-bg{z-index:2147483642;display:none;background:#000;opacity:0.7;position:absolute;top:0px;left:0px;min-width:100%;}
66
+ .profiler-result-full .profiler-result{width:950px;margin:30px auto;}.profiler-result-full .profiler-result .profiler-button{display:none;}
67
+ .profiler-result-full .profiler-result .profiler-popup .profiler-info{font-size:25px;border-bottom:1px solid #aaaaaa;padding-bottom:3px;margin-bottom:25px;}.profiler-result-full .profiler-result .profiler-popup .profiler-info .profiler-overall-duration{padding-right:20px;font-size:80%;color:#888;}
68
+ .profiler-result-full .profiler-result .profiler-popup .profiler-timings td,.profiler-result-full .profiler-result .profiler-popup .profiler-timings th{padding-left:8px;padding-right:8px;}
69
+ .profiler-result-full .profiler-result .profiler-popup .profiler-timings th{padding-bottom:7px;}
70
+ .profiler-result-full .profiler-result .profiler-popup .profiler-timings td{font-size:14px;padding-bottom:4px;}.profiler-result-full .profiler-result .profiler-popup .profiler-timings td:first-child{padding-left:10px;}
71
+ .profiler-result-full .profiler-result .profiler-popup .profiler-timings .profiler-label{max-width:550px;}
72
+ .profiler-result-full .profiler-result .profiler-queries{margin:25px 0;}.profiler-result-full .profiler-result .profiler-queries table{width:100%;}
73
+ .profiler-result-full .profiler-result .profiler-queries th{font-size:16px;color:#555;line-height:20px;}
74
+ .profiler-result-full .profiler-result .profiler-queries td{padding:15px 10px;text-align:left;}
75
+ .profiler-result-full .profiler-result .profiler-queries .profiler-info div{text-align:right;margin-bottom:5px;}
@@ -100,6 +100,18 @@ var MiniProfiler = (function ($) {
100
100
  copy.navigation.redirectCount = clientPerformance.navigation.redirectCount;
101
101
  }
102
102
  clientPerformance = copy;
103
+
104
+ // hack to add chrome timings
105
+ if (window.chrome && window.chrome.loadTimes) {
106
+ var chromeTimes = window.chrome.loadTimes();
107
+ if (chromeTimes.firstPaintTime) {
108
+ clientPerformance.timing["First Paint Time"] = Math.round(chromeTimes.firstPaintTime * 1000);
109
+ }
110
+ if (chromeTimes.firstPaintTime) {
111
+ clientPerformance.timing["First Paint After Load Time"] = Math.round(chromeTimes.firstPaintAfterLoadTime * 1000);
112
+ }
113
+
114
+ }
103
115
  }
104
116
  }
105
117
 
@@ -593,7 +605,7 @@ var MiniProfiler = (function ($) {
593
605
 
594
606
  for (var i = 0; i < clientTimings.Timings.length; i++) {
595
607
  t = clientTimings.Timings[i];
596
- var trivial = t.Name != "Dom Complete" && t.Name != "Response";
608
+ var trivial = t.Name != "Dom Complete" && t.Name != "Response" && t.Name != "First Paint Time";
597
609
  trivial = t.Duration < 2 ? trivial : false;
598
610
  list.push(
599
611
  {
@@ -811,4 +823,4 @@ PR_TAG:"tag",PR_TYPE:S}})()
811
823
  PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^\"\\]|\\.)*"|'(?:[^\'\\]|\\.)*')/,null,"\"'"]],[["com",/^(?:--[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$))/],["kwd",/^(?:ADD|ALL|ALTER|AND|ANY|AS|ASC|AUTHORIZATION|BACKUP|BEGIN|BETWEEN|BREAK|BROWSE|BULK|BY|CASCADE|CASE|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COMMIT|COMPUTE|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|DATABASE|DBCC|DEALLOCATE|DECLARE|DEFAULT|DELETE|DENY|DESC|DISK|DISTINCT|DISTRIBUTED|DOUBLE|DROP|DUMMY|DUMP|ELSE|END|ERRLVL|ESCAPE|EXCEPT|EXEC|EXECUTE|EXISTS|EXIT|FETCH|FILE|FILLFACTOR|FOR|FOREIGN|FREETEXT|FREETEXTTABLE|FROM|FULL|FUNCTION|GOTO|GRANT|GROUP|HAVING|HOLDLOCK|IDENTITY|IDENTITYCOL|IDENTITY_INSERT|IF|IN|INDEX|INNER|INSERT|INTERSECT|INTO|IS|JOIN|KEY|KILL|LEFT|LIKE|LINENO|LOAD|NATIONAL|NOCHECK|NONCLUSTERED|NOT|NULL|NULLIF|OF|OFF|OFFSETS|ON|OPEN|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPENXML|OPTION|OR|ORDER|OUTER|OVER|PERCENT|PLAN|PRECISION|PRIMARY|PRINT|PROC|PROCEDURE|PUBLIC|RAISERROR|READ|READTEXT|RECONFIGURE|REFERENCES|REPLICATION|RESTORE|RESTRICT|RETURN|REVOKE|RIGHT|ROLLBACK|ROWCOUNT|ROWGUIDCOL|RULE|SAVE|SCHEMA|SELECT|SESSION_USER|SET|SETUSER|SHUTDOWN|SOME|STATISTICS|SYSTEM_USER|TABLE|TEXTSIZE|THEN|TO|TOP|TRAN|TRANSACTION|TRIGGER|TRUNCATE|TSEQUAL|UNION|UNIQUE|UPDATE|UPDATETEXT|USE|USER|VALUES|VARYING|VIEW|WAITFOR|WHEN|WHERE|WHILE|WITH|WRITETEXT)(?=[^\w-]|$)/i,
812
824
  null],["lit",/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],["pln",/^[a-z_][\w-]*/i],["pun",/^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0+\-\"\']*/]]),["sql"])
813
825
 
814
- ;
826
+ ;
@@ -1,4 +1,4 @@
1
- .box-shadow(@dx, @dy, @radius, @color) {
1
+ .box-shadow(@dx, @dy, @radius, @color) {
2
2
  -moz-box-shadow: @dx @dy @radius @color;
3
3
  -webkit-box-shadow: @dx @dy @radius @color;
4
4
  box-shadow: @dx @dy @radius @color;
@@ -1,6 +1,6 @@
1
- <script type="text/javascript">
1
+ <script type="text/javascript">
2
2
  (function(){{
3
- var init = function() {{
3
+ var init = function() {{
4
4
  var load = function(s,f){{
5
5
  var sc = document.createElement('script');
6
6
  sc.async = 'async';
@@ -14,8 +14,8 @@
14
14
  }};
15
15
 
16
16
  document.getElementsByTagName('head')[0].appendChild(sc);
17
- }};
18
-
17
+ }};
18
+
19
19
  var initMp = function(){{
20
20
  load('{path}includes.js?v={version}',function(){{
21
21
  MiniProfiler.init({{
@@ -32,18 +32,18 @@
32
32
  }});
33
33
  }});
34
34
  }};
35
- if ({useExistingjQuery}) {{
35
+ if ({useExistingjQuery} && typeof(jQuery) === 'function') {{
36
36
  jQueryMP = jQuery;
37
37
  initMp();
38
38
  }} else {{
39
39
  load('{path}jquery.1.7.1.js?v={version}', initMp);
40
40
  }}
41
-
41
+
42
42
  }};
43
43
 
44
- var w = 0;
44
+ var w = 0;
45
45
  var f = false;
46
- var deferInit = function(){{
46
+ var deferInit = function(){{
47
47
  if (f) return;
48
48
  if (window.performance && window.performance.timing && window.performance.timing.loadEventEnd == 0 && w < 10000){{
49
49
  setTimeout(deferInit, 100);
@@ -59,4 +59,4 @@
59
59
  var o = window.onload;
60
60
  window.onload = function(){{if(o)o; deferInit()}};
61
61
  }})();
62
- </script>
62
+ </script>
@@ -23,7 +23,7 @@ module Rack
23
23
  super
24
24
  end
25
25
 
26
- def init_from_form_data(env, page_struct)
26
+ def self.init_from_form_data(env, page_struct)
27
27
  timings = []
28
28
  clientTimes, clientPerf, baseTime = nil
29
29
  form = env['rack.request.form_hash']
@@ -67,8 +67,10 @@ module Rack
67
67
  timings.push("Name" => k, "Start" => clientTimes[k].to_i - baseTime, "Duration" => -1)
68
68
  end
69
69
 
70
- self['RedirectCount'] = env['rack.request.form_hash']['clientPerformance']['navigation']['redirectCount']
71
- self['Timings'] = timings
70
+ rval = self.new
71
+ rval['RedirectCount'] = env['rack.request.form_hash']['clientPerformance']['navigation']['redirectCount']
72
+ rval['Timings'] = timings
73
+ rval
72
74
  end
73
75
  end
74
76
 
@@ -14,7 +14,7 @@ module Rack
14
14
 
15
15
  attr_accessor :auto_inject, :base_url_path, :pre_authorize_cb, :position,
16
16
  :backtrace_remove, :backtrace_filter, :skip_schema_queries,
17
- :storage, :user_provider, :storage_instance, :storage_options, :skip_paths, :authorization_mode
17
+ :storage, :user_provider, :storage_instance, :storage_options, :skip_paths, :authorization_mode, :use_existing_jquery
18
18
 
19
19
  def self.default
20
20
  new.instance_eval {
@@ -30,6 +30,7 @@ module Rack
30
30
  @storage = MiniProfiler::MemoryStore
31
31
  @user_provider = Proc.new{|env| Rack::Request.new(env).ip}
32
32
  @authorization_mode = :allow_all
33
+ @use_existing_jquery = false
33
34
  self
34
35
  }
35
36
  end
@@ -16,7 +16,7 @@ module Rack
16
16
  "Level" => 0,
17
17
  "User" => "unknown user",
18
18
  "HasUserViewed" => false,
19
- "ClientTimings" => ClientTimerStruct.new,
19
+ "ClientTimings" => nil,
20
20
  "DurationMilliseconds" => 0,
21
21
  "HasTrivialTimings" => true,
22
22
  "HasAllTrivialTimigs" => false,
@@ -6,7 +6,6 @@ require 'mini_profiler/page_timer_struct'
6
6
  require 'mini_profiler/sql_timer_struct'
7
7
  require 'mini_profiler/client_timer_struct'
8
8
  require 'mini_profiler/request_timer_struct'
9
- require 'mini_profiler/body_add_proxy'
10
9
  require 'mini_profiler/storage/abstract_store'
11
10
  require 'mini_profiler/storage/memory_store'
12
11
  require 'mini_profiler/storage/redis_store'
@@ -19,7 +18,7 @@ module Rack
19
18
 
20
19
  class MiniProfiler
21
20
 
22
- VERSION = 'rZlycOOTnzxZvxTmFuOEV0dSmu4P5m5bLrCtwJHVXPA=A'.freeze
21
+ VERSION = '104'.freeze
23
22
 
24
23
  class << self
25
24
 
@@ -64,11 +63,26 @@ module Rack
64
63
 
65
64
  # remove the mini profiler cookie, only used when config.authorization_mode == :whitelist
66
65
  def remove_profiling_cookie(headers)
67
- Rack::Utils.delete_cookie_header!(headers, '__profilin')
66
+ Rack::Utils.set_cookie_header!(headers, '__profilin', :value => 'notstylin', :path => '/')
68
67
  end
69
68
 
70
69
  def set_profiling_cookie(headers)
71
- Rack::Utils.set_cookie_header!(headers, '__profilin', 'stylin')
70
+ Rack::Utils.set_cookie_header!(headers, '__profilin', :value => 'stylin', :path => '/')
71
+ end
72
+
73
+ # user has the mini profiler cookie, only used when config.authorization_mode == :whitelist
74
+ def has_disable_profiling_cookie?(env)
75
+ env['HTTP_COOKIE'] && env['HTTP_COOKIE'].include?("__profilin_disable=stylin")
76
+ end
77
+
78
+ # remove the mini profiler cookie, only used when config.authorization_mode == :whitelist
79
+ def remove_disable_profiling_cookie(headers)
80
+ #something is odd with delete_cookie_header
81
+ Rack::Utils.set_cookie_header!(headers, '__profilin_disable', :value => 'notstylin', :path => '/')
82
+ end
83
+
84
+ def set_disable_profiling_cookie(headers)
85
+ Rack::Utils.set_cookie_header!(headers, '__profilin_disable', :value => 'stylin', :path => '/')
72
86
  end
73
87
 
74
88
  def create_current(env={}, options={})
@@ -101,8 +115,9 @@ module Rack
101
115
  @app = app
102
116
  @config.base_url_path << "/" unless @config.base_url_path.end_with? "/"
103
117
  unless @config.storage_instance
104
- @storage = @config.storage_instance = @config.storage.new(@config.storage_options)
118
+ @config.storage_instance = @config.storage.new(@config.storage_options)
105
119
  end
120
+ @storage = @config.storage_instance
106
121
  end
107
122
 
108
123
  def user(env)
@@ -118,7 +133,7 @@ module Rack
118
133
  return [404, {}, ["Request not found: #{request['id']} - user #{user(env)}"]]
119
134
  end
120
135
  unless page_struct['HasUserViewed']
121
- page_struct['ClientTimings'].init_from_form_data(env, page_struct)
136
+ page_struct['ClientTimings'] = ClientTimerStruct.init_from_form_data(env, page_struct)
122
137
  page_struct['HasUserViewed'] = true
123
138
  @storage.save(page_struct)
124
139
  @storage.set_viewed(user(env), id)
@@ -151,8 +166,17 @@ module Rack
151
166
  return [404, {}, ["Not found"]] unless ::File.exists? full_path
152
167
  f = Rack::File.new nil
153
168
  f.path = full_path
154
- f.cache_control = "max-age:86400"
155
- f.serving env
169
+
170
+ begin
171
+ f.cache_control = "max-age:86400"
172
+ f.serving env
173
+ rescue
174
+ # old versions of rack have a different api
175
+ status, headers, body = f.serving
176
+ headers.merge! 'Cache-Control' => "max-age:86400"
177
+ [status, headers, body]
178
+ end
179
+
156
180
  end
157
181
 
158
182
 
@@ -172,11 +196,12 @@ module Rack
172
196
 
173
197
  def call(env)
174
198
  status = headers = body = nil
199
+ query_string = env['QUERY_STRING']
175
200
  path = env['PATH_INFO']
176
201
 
177
202
  skip_it = (@config.pre_authorize_cb && !@config.pre_authorize_cb.call(env)) ||
178
203
  (@config.skip_paths && @config.skip_paths.any?{ |p| path[0,p.length] == p}) ||
179
- env["QUERY_STRING"] =~ /pp=skip/
204
+ query_string =~ /pp=skip/
180
205
 
181
206
  has_profiling_cookie = MiniProfiler.has_profiling_cookie?(env)
182
207
 
@@ -189,13 +214,29 @@ module Rack
189
214
  end
190
215
 
191
216
  # handle all /mini-profiler requests here
192
- return serve_html(env) if env['PATH_INFO'].start_with? @config.base_url_path
217
+ return serve_html(env) if path.start_with? @config.base_url_path
218
+
219
+ has_disable_cookie = MiniProfiler.has_disable_profiling_cookie?(env)
220
+ # manual session disable / enable
221
+ if query_string =~ /pp=disable/ || has_disable_cookie
222
+ skip_it = true
223
+ end
224
+
225
+ if query_string =~ /pp=enable/
226
+ skip_it = false
227
+ end
228
+
229
+ if skip_it
230
+ status,headers,body = @app.call(env)
231
+ MiniProfiler.set_disable_profiling_cookie(headers) unless has_disable_cookie
232
+ return [status,headers,body]
233
+ end
193
234
 
194
235
  MiniProfiler.create_current(env, @config)
195
236
  MiniProfiler.deauthorize_request if @config.authorization_mode == :whitelist
196
- if env["QUERY_STRING"] =~ /pp=no-backtrace/
237
+ if query_string =~ /pp=no-backtrace/
197
238
  current.skip_backtrace = true
198
- elsif env["QUERY_STRING"] =~ /pp=full-backtrace/
239
+ elsif query_string =~ /pp=full-backtrace/
199
240
  current.full_backtrace = true
200
241
  end
201
242
 
@@ -203,7 +244,7 @@ module Rack
203
244
  quit_sampler = false
204
245
  backtraces = nil
205
246
  missing_stacktrace = false
206
- if env["QUERY_STRING"] =~ /pp=sample/
247
+ if query_string =~ /pp=sample/
207
248
  backtraces = []
208
249
  t = Thread.current
209
250
  Thread.new {
@@ -231,6 +272,9 @@ module Rack
231
272
  start = Time.now
232
273
  begin
233
274
  status,headers,body = @app.call(env)
275
+ if has_disable_cookie
276
+ MiniProfiler.remove_disable_profiling_cookie(headers)
277
+ end
234
278
  ensure
235
279
  if backtraces
236
280
  done_sampling = true
@@ -245,14 +289,14 @@ module Rack
245
289
  end
246
290
 
247
291
  return [status,headers,body] if skip_it
248
-
292
+
249
293
  # we must do this here, otherwise current[:discard] is not being properly treated
250
- if env["QUERY_STRING"] =~ /pp=env/
294
+ if query_string =~ /pp=env/
251
295
  body.close if body.respond_to? :close
252
296
  return dump_env env
253
297
  end
254
298
 
255
- if env["QUERY_STRING"] =~ /pp=help/
299
+ if query_string =~ /pp=help/
256
300
  body.close if body.respond_to? :close
257
301
  return help
258
302
  end
@@ -274,6 +318,12 @@ module Rack
274
318
  # inject headers, script
275
319
  if status == 200
276
320
 
321
+ # mini profiler is meddling with stuff, we can not cache cause we will get incorrect data
322
+ # Rack::ETag has already inserted some nonesense in the chain
323
+ headers.delete('ETag')
324
+ headers.delete('Date')
325
+ headers['Cache-Control'] = 'must-revalidate, private, max-age=0'
326
+
277
327
  # inject header
278
328
  if headers.is_a? Hash
279
329
  headers['X-MiniProfiler-Ids'] = ids_json(env)
@@ -283,21 +333,37 @@ module Rack
283
333
  if current.inject_js \
284
334
  && headers.has_key?('Content-Type') \
285
335
  && !headers['Content-Type'].match(/text\/html/).nil? then
286
- body = MiniProfiler::BodyAddProxy.new(body, self.get_profile_script(env))
336
+
337
+ response = Rack::Response.new([], status, headers)
338
+ script = self.get_profile_script(env)
339
+ if String === body
340
+ response.write inject(body,script)
341
+ else
342
+ body.each { |fragment| response.write inject(fragment, script) }
343
+ end
344
+ body.close if body.respond_to? :close
345
+ return response.finish
287
346
  end
288
347
  end
289
348
 
290
- # mini profiler is meddling with stuff, we can not cache cause we will get incorrect data
291
- # Rack::ETag has already inserted some nonesense in the chain
292
- headers.delete('ETag')
293
- headers.delete('Date')
294
- headers['Cache-Control'] = 'must-revalidate, private, max-age=0'
295
349
  [status, headers, body]
296
350
  ensure
297
351
  # Make sure this always happens
298
352
  current = nil
299
353
  end
300
354
 
355
+ def inject(fragment, script)
356
+ fragment.sub(/<\/body>/i) do
357
+ # if for whatever crazy reason we dont get a utf string,
358
+ # just force the encoding, no utf in the mp scripts anyway
359
+ if script.respond_to?(:encoding) && script.respond_to?(:force_encoding)
360
+ (script + "</body>").force_encoding(fragment.encoding)
361
+ else
362
+ script + "</body>"
363
+ end
364
+ end
365
+ end
366
+
301
367
  def dump_env(env)
302
368
  headers = {'Content-Type' => 'text/plain'}
303
369
  body = ""
@@ -317,6 +383,8 @@ module Rack
317
383
  pp=no-backtrace : don't collect stack traces from all the SQL executed
318
384
  pp=full-backtrace : enable full backtrace for SQL executed
319
385
  pp=sample : sample stack traces and return a report isolating heavy usage (requires the stacktrace gem)
386
+ pp=disable : disable profiling for this session
387
+ pp=enable : enable profiling for this session (if previously disabled)
320
388
  "
321
389
  if (category == :stacktrace)
322
390
  body = "pp=stacktrace requires the stacktrace gem - add gem 'stacktrace' to your Gemfile"
@@ -380,7 +448,7 @@ module Rack
380
448
  showControls = false
381
449
  currentId = current.page_struct["Id"]
382
450
  authorized = true
383
- useExistingjQuery = false
451
+ useExistingjQuery = @config.use_existing_jquery
384
452
  # TODO : cache this snippet
385
453
  script = IO.read(::File.expand_path('../html/profile_handler.js', ::File.dirname(__FILE__)))
386
454
  # replace the variables