mini-mini-profiler 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/Ruby/CHANGELOG +135 -0
  2. data/Ruby/README.md +161 -0
  3. data/Ruby/lib/html/flamegraph.html +325 -0
  4. data/Ruby/lib/html/includes.css +451 -0
  5. data/Ruby/lib/html/includes.js +945 -0
  6. data/Ruby/lib/html/includes.less +471 -0
  7. data/Ruby/lib/html/includes.tmpl +108 -0
  8. data/Ruby/lib/html/jquery.1.7.1.js +4 -0
  9. data/Ruby/lib/html/jquery.tmpl.js +486 -0
  10. data/Ruby/lib/html/list.css +9 -0
  11. data/Ruby/lib/html/list.js +38 -0
  12. data/Ruby/lib/html/list.tmpl +34 -0
  13. data/Ruby/lib/html/profile_handler.js +1 -0
  14. data/Ruby/lib/html/share.html +11 -0
  15. data/Ruby/lib/mini_profiler/client_settings.rb +65 -0
  16. data/Ruby/lib/mini_profiler/client_timer_struct.rb +78 -0
  17. data/Ruby/lib/mini_profiler/config.rb +57 -0
  18. data/Ruby/lib/mini_profiler/context.rb +11 -0
  19. data/Ruby/lib/mini_profiler/custom_timer_struct.rb +22 -0
  20. data/Ruby/lib/mini_profiler/flame_graph.rb +54 -0
  21. data/Ruby/lib/mini_profiler/gc_profiler.rb +107 -0
  22. data/Ruby/lib/mini_profiler/page_timer_struct.rb +58 -0
  23. data/Ruby/lib/mini_profiler/profiler.rb +544 -0
  24. data/Ruby/lib/mini_profiler/profiling_methods.rb +133 -0
  25. data/Ruby/lib/mini_profiler/request_timer_struct.rb +115 -0
  26. data/Ruby/lib/mini_profiler/sql_timer_struct.rb +58 -0
  27. data/Ruby/lib/mini_profiler/storage/abstract_store.rb +31 -0
  28. data/Ruby/lib/mini_profiler/storage/file_store.rb +111 -0
  29. data/Ruby/lib/mini_profiler/storage/memcache_store.rb +53 -0
  30. data/Ruby/lib/mini_profiler/storage/memory_store.rb +65 -0
  31. data/Ruby/lib/mini_profiler/storage/redis_store.rb +54 -0
  32. data/Ruby/lib/mini_profiler/timer_struct.rb +33 -0
  33. data/Ruby/lib/mini_profiler/version.rb +5 -0
  34. data/Ruby/lib/mini_profiler_rails/railtie.rb +107 -0
  35. data/Ruby/lib/patches/net_patches.rb +14 -0
  36. data/Ruby/lib/patches/sql_patches.rb +272 -0
  37. data/Ruby/lib/rack-mini-profiler.rb +7 -0
  38. data/mini-mini-profiler.gemspec +26 -0
  39. metadata +154 -0
@@ -0,0 +1,471 @@
1
+ .box-shadow(@dx, @dy, @radius, @color) {
2
+ -moz-box-shadow: @dx @dy @radius @color;
3
+ -webkit-box-shadow: @dx @dy @radius @color;
4
+ box-shadow: @dx @dy @radius @color;
5
+ }
6
+
7
+ @anchorColor: #0077CC;
8
+ @buttonBorderColor: #888;
9
+ @numberColor: #111;
10
+ @textColor: #555;
11
+ @mutedColor: #aaa;
12
+ @normalFonts: Helvetica, Arial, sans-serif;
13
+ @codeFonts: Consolas, monospace, serif;
14
+ @zindex:2147483640; // near 32bit max 2147483647
15
+
16
+ // do some resets
17
+ .profiler-result, .profiler-queries {
18
+ color:#555;
19
+ line-height:1;
20
+ font-size:12px;
21
+
22
+ pre, code, label, table, tbody, thead, tfoot, tr, th, td {
23
+ margin:0;
24
+ padding:0;
25
+ border:0;
26
+ font-size:100%;
27
+ font:inherit;
28
+ vertical-align:baseline;
29
+ background-color:transparent;
30
+ overflow:visible;
31
+ max-height:none;
32
+ }
33
+ table {
34
+ border-collapse:collapse;
35
+ border-spacing:0;
36
+ }
37
+ a, a:hover {
38
+ cursor:pointer;
39
+ color:@anchorColor;
40
+ }
41
+ a {
42
+ text-decoration:none;
43
+ &:hover {
44
+ text-decoration:underline;
45
+ }
46
+ }
47
+ }
48
+
49
+ // styles shared between popup view and full view
50
+ .profiler-result
51
+ {
52
+
53
+ .profiler-toggle-duration-with-children
54
+ {
55
+ float: right;
56
+ }
57
+
58
+ table.profiler-client-timings
59
+ {
60
+ margin-top: 10px;
61
+ }
62
+
63
+ font-family:@normalFonts;
64
+
65
+ .profiler-label {
66
+ color:@textColor;
67
+ overflow:hidden;
68
+ text-overflow: ellipsis;
69
+ }
70
+
71
+ .profiler-unit {
72
+ color:@mutedColor;
73
+ }
74
+
75
+ .profiler-trivial {
76
+ display:none;
77
+ td, td * {
78
+ color:@mutedColor !important;
79
+ }
80
+ }
81
+
82
+ pre, code, .profiler-number, .profiler-unit {
83
+ font-family:@codeFonts;
84
+ }
85
+
86
+ .profiler-number {
87
+ color:@numberColor;
88
+ }
89
+
90
+ .profiler-info {
91
+ text-align:right;
92
+ .profiler-name {
93
+ float:left;
94
+ }
95
+ .profiler-server-time {
96
+ white-space:nowrap;
97
+ }
98
+ }
99
+
100
+ .profiler-timings {
101
+ th {
102
+ background-color:#fff;
103
+ color:@mutedColor;
104
+ text-align:right;
105
+ }
106
+ th, td {
107
+ white-space:nowrap;
108
+ }
109
+ .profiler-duration-with-children {
110
+ display:none;
111
+ }
112
+ .profiler-duration {
113
+ .profiler-number;
114
+ text-align:right;
115
+ }
116
+ .profiler-indent {
117
+ letter-spacing:4px;
118
+ }
119
+ .profiler-queries-show {
120
+ .profiler-number, .profiler-unit {
121
+ color:@anchorColor;
122
+ }
123
+ }
124
+ .profiler-queries-duration {
125
+ padding-left:6px;
126
+ }
127
+ .profiler-percent-in-sql {
128
+ white-space:nowrap;
129
+ text-align:right;
130
+ }
131
+
132
+ tfoot {
133
+ td {
134
+ padding-top:10px;
135
+ text-align:right;
136
+
137
+ a {
138
+ font-size:95%;
139
+ display:inline-block;
140
+ margin-left:12px;
141
+
142
+ &:first-child {
143
+ float:left;
144
+ margin-left:0px;
145
+ }
146
+ &.profiler-custom-link {
147
+ float:left;
148
+ }
149
+ }
150
+ }
151
+ }
152
+ }
153
+
154
+ .profiler-queries {
155
+ font-family:@normalFonts;
156
+
157
+ .profiler-stack-trace {
158
+ margin-bottom:15px;
159
+ }
160
+ pre {
161
+ font-family:@codeFonts;
162
+ white-space:pre-wrap;
163
+ }
164
+
165
+ th {
166
+ background-color:#fff;
167
+ border-bottom:1px solid #555;
168
+ font-weight:bold;
169
+ padding:15px;
170
+ white-space:nowrap;
171
+ }
172
+
173
+ td {
174
+ padding:15px;
175
+ text-align:left;
176
+ background-color:#fff;
177
+
178
+ &:last-child {
179
+ padding-right:25px; // compensate for scrollbars
180
+ }
181
+ }
182
+
183
+ .profiler-odd td {
184
+ background-color:#e5e5e5;
185
+ }
186
+
187
+ .profiler-since-start, .profiler-duration {
188
+ text-align:right;
189
+ }
190
+
191
+ .profiler-info div {
192
+ text-align:right;
193
+ margin-bottom:5px;
194
+ }
195
+
196
+ .profiler-gap-info, .profiler-gap-info td { background-color: #ccc;}
197
+ .profiler-gap-info {
198
+ .profiler-unit {color: #777;}
199
+ .profiler-info {text-align: right}
200
+ &.profiler-trivial-gaps {display: none}
201
+ }
202
+
203
+ .profiler-trivial-gap-container { text-align: center;}
204
+
205
+ // prettify colors
206
+ .str{color:maroon}
207
+ .kwd{color:#00008b}
208
+ .com{color:gray}
209
+ .typ{color:#2b91af}
210
+ .lit{color:maroon}
211
+ .pun{color:#000}
212
+ .pln{color:#000}
213
+ .tag{color:maroon}
214
+ .atn{color:red}
215
+ .atv{color:blue}
216
+ .dec{color:purple}
217
+ }
218
+
219
+ .profiler-warning, .profiler-warning *, .profiler-warning .profiler-queries-show, .profiler-warning .profiler-queries-show .profiler-unit { // i'm no good at css
220
+ color:#f00;
221
+ &:hover {
222
+ color:#f00;
223
+ }
224
+ }
225
+
226
+ .profiler-nuclear {
227
+ .profiler-warning;
228
+ font-weight:bold;
229
+ padding-right:2px;
230
+ }
231
+ }
232
+
233
+ // ajaxed-in results will be appended to this
234
+ .profiler-results
235
+ {
236
+ z-index:@zindex + 3;
237
+ position:fixed;
238
+ top:0px;
239
+
240
+ @radius:10px;
241
+
242
+ &.profiler-left {
243
+ left:0px;
244
+
245
+ &.profiler-no-controls .profiler-result:last-child .profiler-button, .profiler-controls {
246
+ -webkit-border-bottom-right-radius: @radius;
247
+ -moz-border-radius-bottomright: @radius;
248
+ border-bottom-right-radius: @radius;
249
+ }
250
+
251
+ .profiler-button, .profiler-controls {
252
+ border-right: 1px solid @buttonBorderColor;
253
+ }
254
+ }
255
+
256
+ &.profiler-right {
257
+ right:0px;
258
+
259
+ &.profiler-no-controls .profiler-result:last-child .profiler-button, .profiler-controls {
260
+ -webkit-border-bottom-left-radius: @radius;
261
+ -moz-border-radius-bottomleft: @radius;
262
+ border-bottom-left-radius: @radius;
263
+ }
264
+
265
+ .profiler-button, .profiler-controls {
266
+ border-left: 1px solid @buttonBorderColor;
267
+ }
268
+ }
269
+
270
+ .profiler-button, .profiler-controls {
271
+ display:none;
272
+ z-index:@zindex;
273
+ border-bottom: 1px solid @buttonBorderColor;
274
+ background-color:#fff;
275
+ padding: 4px 7px;
276
+ text-align:right;
277
+ cursor:pointer;
278
+
279
+ &.profiler-button-active {
280
+ background-color:maroon;
281
+
282
+ .profiler-number, .profiler-nuclear {
283
+ color:#fff;
284
+ font-weight:bold;
285
+ }
286
+ .profiler-unit {
287
+ color:#fff;
288
+ font-weight:normal;
289
+ }
290
+ }
291
+ }
292
+
293
+ .profiler-controls {
294
+ display: block;
295
+ font-size:12px;
296
+ font-family: @codeFonts;
297
+ cursor:default;
298
+ text-align: center;
299
+
300
+ span {
301
+ border-right: 1px solid @mutedColor;
302
+ padding-right: 5px;
303
+ margin-right: 5px;
304
+ cursor:pointer;
305
+ }
306
+
307
+ span:last-child {
308
+ border-right: none;
309
+ }
310
+ }
311
+
312
+ .profiler-popup {
313
+ display:none;
314
+ z-index:@zindex + 1;
315
+ position:absolute;
316
+ background-color:#fff;
317
+ border: 1px solid #aaa;
318
+ padding:5px 10px;
319
+ text-align:left;
320
+ line-height:18px;
321
+ overflow:auto;
322
+
323
+ .box-shadow(0px, 1px, 15px, #555);
324
+
325
+ .profiler-info {
326
+ margin-bottom:3px;
327
+ padding-bottom:2px;
328
+ border-bottom:1px solid #ddd;
329
+
330
+ .profiler-name {
331
+ font-size:110%;
332
+ font-weight:bold;
333
+ .profiler-overall-duration {
334
+ display:none;
335
+ }
336
+ }
337
+ .profiler-server-time {
338
+ font-size:95%;
339
+ }
340
+ }
341
+
342
+ .profiler-timings {
343
+
344
+ th, td {
345
+ padding-left:6px;
346
+ padding-right:6px;
347
+ }
348
+
349
+ th {
350
+ font-size:95%;
351
+ padding-bottom:3px;
352
+ }
353
+
354
+ .profiler-label {
355
+ max-width:275px;
356
+ }
357
+ }
358
+ }
359
+
360
+ .profiler-queries {
361
+ display:none;
362
+ z-index:@zindex + 3;
363
+ position:absolute;
364
+ overflow-y:auto;
365
+ overflow-x:auto;
366
+ background-color:#fff;
367
+
368
+ th {
369
+ font-size:17px;
370
+ }
371
+ }
372
+
373
+ &.profiler-min .profiler-result {
374
+ display: none;
375
+ }
376
+
377
+ &.profiler-min .profiler-controls span {
378
+ display: none;
379
+ }
380
+
381
+ &.profiler-min .profiler-controls .profiler-min-max {
382
+ border-right: none;
383
+ padding: 0px;
384
+ margin: 0px;
385
+ }
386
+ }
387
+
388
+ // popup results' queries will be displayed in front of this
389
+ .profiler-queries-bg {
390
+ z-index:@zindex + 2;
391
+ display:none;
392
+ background:#000;
393
+ opacity:0.7;
394
+ position:absolute;
395
+ top:0px;
396
+ left:0px;
397
+ min-width:100%;
398
+ }
399
+
400
+ // used when viewing a shared, full page result
401
+ .profiler-result-full {
402
+ .profiler-result {
403
+
404
+ width:950px;
405
+ margin:30px auto;
406
+
407
+ .profiler-button {
408
+ display:none;
409
+ }
410
+
411
+ .profiler-popup {
412
+
413
+ .profiler-info {
414
+ font-size: 25px;
415
+ border-bottom:1px solid @mutedColor;
416
+ padding-bottom:3px;
417
+ margin-bottom:25px;
418
+
419
+ .profiler-overall-duration {
420
+ padding-right:20px;
421
+ font-size:80%;
422
+ color:#888;
423
+ }
424
+ }
425
+
426
+ .profiler-timings {
427
+ td, th {
428
+ padding-left:8px;
429
+ padding-right:8px;
430
+ }
431
+ th {
432
+ padding-bottom:7px;
433
+ }
434
+ td {
435
+ font-size:14px;
436
+ padding-bottom:4px;
437
+
438
+ &:first-child {
439
+ padding-left:10px;
440
+ }
441
+ }
442
+
443
+ .profiler-label {
444
+ max-width:550px;
445
+ }
446
+ }
447
+ }
448
+
449
+ .profiler-queries {
450
+ margin:25px 0;
451
+ table {
452
+ width:100%;
453
+ }
454
+ th {
455
+ font-size:16px;
456
+ color:#555;
457
+ line-height:20px;
458
+ }
459
+
460
+ td {
461
+ padding:15px 10px;
462
+ text-align:left;
463
+ }
464
+
465
+ .profiler-info div {
466
+ text-align:right;
467
+ margin-bottom:5px;
468
+ }
469
+ }
470
+ }
471
+ }