speed_gun 2.0.0.pre.alpha.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbf0bcd59d83f3f6a6d5a0e22bcc9c1bfcf50721
4
- data.tar.gz: 1cfc3dac79eaa32340dabc49c4f272ea80c734cc
3
+ metadata.gz: 2e5e66af80e2889d45d0aa3398b73c6c336a2eeb
4
+ data.tar.gz: dd1cfd00641e7cdc5891215ab2d75d44cc3b0c0b
5
5
  SHA512:
6
- metadata.gz: b87c69db788d81c8ff20f55880cbff62e9ae947de00d2363f7dcd6c967e466745f6123cbcc309b9fdae4041a9b52ed24b474bb4fc9a567e063fe093e6eb891b4
7
- data.tar.gz: 01e9191f79ee62c35bdf194491cdf58364873f4cb4e969bcd1a364197682e4864b8eb9b2400d510dcb2c9b3107bcd1625d263dad04f71220eda08ccc18f8b640
6
+ metadata.gz: 331c8a91b7b3f443ff4e680ad5c3dd36932ddd0dafe22d68f00da6916f699a98f984fd39faf7340a16513e9c089c1a1556d63d02b916ff8e41db1f18688eb83c
7
+ data.tar.gz: b37bc4ce9b24019f2c41f21799bc9e29238858072b3d5b3cafe1aceaeea70b1a89573da6d67354bfac74b7a68e5ffafd321109de77c2f9535143eba0724132f3
@@ -4,6 +4,8 @@ class PostsController < ApplicationController
4
4
  # GET /posts
5
5
  # GET /posts.json
6
6
  def index
7
+ Net::HTTP.get(URI('https://google.com/'))
8
+
7
9
  @posts = Post.all
8
10
  end
9
11
 
@@ -16,7 +16,9 @@ class Rack::SpeedGun
16
16
 
17
17
  return call_speed_gun_app(env) if under_speed_gun?(env)
18
18
 
19
- SpeedGun.current_report = SpeedGun::Report.new
19
+ SpeedGun.current_report = SpeedGun::Report.new.tap do |report|
20
+ report.name = "#{env['REQUEST_METHOD']} #{env['PATH_INFO']}"
21
+ end
20
22
 
21
23
  SpeedGun::Profiler::RackProfiler.profile('rack', rack: rack_info(env), request: request_info(env)) do |event|
22
24
  res = SpeedGun::Profiler::LineProfiler.profile { @app.call(env) }
@@ -33,9 +35,7 @@ class Rack::SpeedGun
33
35
  SpeedGun.config.logger.debug(
34
36
  "Check out here: #{base_url(env)}/reports/#{SpeedGun.current_report.id}"
35
37
  ) if SpeedGun.config.webapp
36
- Thread.start(SpeedGun.current_report) do |report|
37
- SpeedGun.config.store.store(report)
38
- end
38
+ SpeedGun.config.store.store(SpeedGun.current_report)
39
39
  end
40
40
  SpeedGun.current_report = nil
41
41
  end
@@ -1,12 +1,19 @@
1
1
  # frozen_string_literal: true
2
+ require 'semantic'
2
3
  require 'speed_gun/version'
3
4
  require 'speed_gun/config'
4
5
  require 'speed_gun/report'
6
+ require 'speed_gun/hook'
5
7
  require 'rack/speed_gun'
6
8
  require 'speed_gun/railtie' if defined?(::Rails)
7
9
 
8
10
  module SpeedGun
9
11
  class << self
12
+ # @return [Semantic::Version] Version
13
+ def version
14
+ @version ||= Semantic::Version.new(VERSION)
15
+ end
16
+
10
17
  # @return [SpeedGun::Config]
11
18
  def config
12
19
  @config ||= SpeedGun::Config.new
@@ -34,5 +41,15 @@ module SpeedGun
34
41
  def get_report(id)
35
42
  config.store.load("SpeedGun::Report/#{id}")
36
43
  end
44
+
45
+ def get_backtrace(backtrace = caller(2))
46
+ backtrace = Rails.backtrace_cleaner.clean(backtrace) if defined?(Rails)
47
+
48
+ backtrace.map do |called|
49
+ filename, line, trace = *called.split(':', 3)
50
+ filename = File.expand_path(filename)
51
+ [filename, line.to_i, trace]
52
+ end
53
+ end
37
54
  end
38
55
  end
@@ -15,13 +15,15 @@ class SpeedGun::App < Sinatra::Base
15
15
  end
16
16
 
17
17
  helpers do
18
- def line_id(filename, line)
19
- Digest::SHA256.hexdigest("#{filename}:#{line}")
18
+ def source_line_id(filename, line)
19
+ (@source_line_ids ||= {}).fetch("#{filename}:#{line}") do |key|
20
+ Digest::MD5.hexdigest(key)
21
+ end
20
22
  end
21
23
  end
22
24
 
23
25
  get '/report.css' do
24
- content_type 'text/css', :charset => 'utf-8'
26
+ content_type 'text/css', charset: 'utf-8'
25
27
  scss :report
26
28
  end
27
29
 
@@ -29,6 +31,7 @@ class SpeedGun::App < Sinatra::Base
29
31
  @report = SpeedGun.get_report(params[:id])
30
32
  halt 404 unless @report
31
33
 
34
+ @sources = @report.sources
32
35
  @events = treeish_events(@report.events)
33
36
 
34
37
  slim :report
@@ -0,0 +1,572 @@
1
+ @charset "UTF-8";
2
+
3
+ @font-face {
4
+ font-family: "feather";
5
+ src:url("fonts/feather-webfont.eot");
6
+ src:url("fonts/feather-webfont.eot?#iefix") format("embedded-opentype"),
7
+ url("fonts/feather-webfont.woff") format("woff"),
8
+ url("fonts/feather-webfont.ttf") format("truetype"),
9
+ url("fonts/feather-webfont.svg#feather") format("svg");
10
+ font-weight: normal;
11
+ font-style: normal;
12
+ }
13
+
14
+ /* Character Mapping Method */
15
+
16
+ [data-icon]:before {
17
+ display: inline-block;
18
+ font-family: "feather";
19
+ content: attr(data-icon);
20
+ font-style: normal;
21
+ font-weight: normal;
22
+ font-variant: normal;
23
+ text-transform: none;
24
+ speak: none;
25
+ line-height: 1;
26
+ -webkit-font-smoothing: antialiased;
27
+ -moz-osx-font-smoothing: grayscale;
28
+ }
29
+
30
+ /* CSS Class Mapping Method */
31
+
32
+ [class^="icon-"],
33
+ [class*=" icon-"] {
34
+ display: inline-block;
35
+ font-family: "feather";
36
+ font-style: normal;
37
+ font-weight: normal;
38
+ font-variant: normal;
39
+ text-transform: none;
40
+ speak: none;
41
+ line-height: 1;
42
+ -webkit-font-smoothing: antialiased;
43
+ -moz-osx-font-smoothing: grayscale;
44
+ }
45
+
46
+ .icon-eye:before {
47
+ content: "\e000";
48
+ }
49
+
50
+ .icon-paper-clip:before {
51
+ content: "\e001";
52
+ }
53
+
54
+ .icon-mail:before {
55
+ content: "\e002";
56
+ }
57
+
58
+ .icon-mail:before {
59
+ content: "\e002";
60
+ }
61
+
62
+ .icon-toggle:before {
63
+ content: "\e003";
64
+ }
65
+
66
+ .icon-layout:before {
67
+ content: "\e004";
68
+ }
69
+
70
+ .icon-link:before {
71
+ content: "\e005";
72
+ }
73
+
74
+ .icon-bell:before {
75
+ content: "\e006";
76
+ }
77
+
78
+ .icon-lock:before {
79
+ content: "\e007";
80
+ }
81
+
82
+ .icon-unlock:before {
83
+ content: "\e008";
84
+ }
85
+
86
+ .icon-ribbon:before {
87
+ content: "\e009";
88
+ }
89
+
90
+ .icon-image:before {
91
+ content: "\e010";
92
+ }
93
+
94
+ .icon-signal:before {
95
+ content: "\e011";
96
+ }
97
+
98
+ .icon-target:before {
99
+ content: "\e012";
100
+ }
101
+
102
+ .icon-clipboard:before {
103
+ content: "\e013";
104
+ }
105
+
106
+ .icon-clock:before {
107
+ content: "\e014";
108
+ }
109
+
110
+ .icon-clock:before {
111
+ content: "\e014";
112
+ }
113
+
114
+ .icon-watch:before {
115
+ content: "\e015";
116
+ }
117
+
118
+ .icon-air-play:before {
119
+ content: "\e016";
120
+ }
121
+
122
+ .icon-camera:before {
123
+ content: "\e017";
124
+ }
125
+
126
+ .icon-video:before {
127
+ content: "\e018";
128
+ }
129
+
130
+ .icon-disc:before {
131
+ content: "\e019";
132
+ }
133
+
134
+ .icon-printer:before {
135
+ content: "\e020";
136
+ }
137
+
138
+ .icon-monitor:before {
139
+ content: "\e021";
140
+ }
141
+
142
+ .icon-server:before {
143
+ content: "\e022";
144
+ }
145
+
146
+ .icon-cog:before {
147
+ content: "\e023";
148
+ }
149
+
150
+ .icon-heart:before {
151
+ content: "\e024";
152
+ }
153
+
154
+ .icon-paragraph:before {
155
+ content: "\e025";
156
+ }
157
+
158
+ .icon-align-justify:before {
159
+ content: "\e026";
160
+ }
161
+
162
+ .icon-align-left:before {
163
+ content: "\e027";
164
+ }
165
+
166
+ .icon-align-center:before {
167
+ content: "\e028";
168
+ }
169
+
170
+ .icon-align-right:before {
171
+ content: "\e029";
172
+ }
173
+
174
+ .icon-book:before {
175
+ content: "\e030";
176
+ }
177
+
178
+ .icon-layers:before {
179
+ content: "\e031";
180
+ }
181
+
182
+ .icon-stack:before {
183
+ content: "\e032";
184
+ }
185
+
186
+ .icon-stack-2:before {
187
+ content: "\e033";
188
+ }
189
+
190
+ .icon-paper:before {
191
+ content: "\e034";
192
+ }
193
+
194
+ .icon-paper-stack:before {
195
+ content: "\e035";
196
+ }
197
+
198
+ .icon-search:before {
199
+ content: "\e036";
200
+ }
201
+
202
+ .icon-zoom-in:before {
203
+ content: "\e037";
204
+ }
205
+
206
+ .icon-zoom-out:before {
207
+ content: "\e038";
208
+ }
209
+
210
+ .icon-reply:before {
211
+ content: "\e039";
212
+ }
213
+
214
+ .icon-circle-plus:before {
215
+ content: "\e040";
216
+ }
217
+
218
+ .icon-circle-minus:before {
219
+ content: "\e041";
220
+ }
221
+
222
+ .icon-circle-check:before {
223
+ content: "\e042";
224
+ }
225
+
226
+ .icon-circle-cross:before {
227
+ content: "\e043";
228
+ }
229
+
230
+ .icon-square-plus:before {
231
+ content: "\e044";
232
+ }
233
+
234
+ .icon-square-minus:before {
235
+ content: "\e045";
236
+ }
237
+
238
+ .icon-square-check:before {
239
+ content: "\e046";
240
+ }
241
+
242
+ .icon-square-cross:before {
243
+ content: "\e047";
244
+ }
245
+
246
+ .icon-microphone:before {
247
+ content: "\e048";
248
+ }
249
+
250
+ .icon-record:before {
251
+ content: "\e049";
252
+ }
253
+
254
+ .icon-skip-back:before {
255
+ content: "\e050";
256
+ }
257
+
258
+ .icon-rewind:before {
259
+ content: "\e051";
260
+ }
261
+
262
+ .icon-play:before {
263
+ content: "\e052";
264
+ }
265
+
266
+ .icon-pause:before {
267
+ content: "\e053";
268
+ }
269
+
270
+ .icon-stop:before {
271
+ content: "\e054";
272
+ }
273
+
274
+ .icon-fast-forward:before {
275
+ content: "\e055";
276
+ }
277
+
278
+ .icon-skip-forward:before {
279
+ content: "\e056";
280
+ }
281
+
282
+ .icon-shuffle:before {
283
+ content: "\e057";
284
+ }
285
+
286
+ .icon-repeat:before {
287
+ content: "\e058";
288
+ }
289
+
290
+ .icon-folder:before {
291
+ content: "\e059";
292
+ }
293
+
294
+ .icon-umbrella:before {
295
+ content: "\e060";
296
+ }
297
+
298
+ .icon-moon:before {
299
+ content: "\e061";
300
+ }
301
+
302
+ .icon-thermometer:before {
303
+ content: "\e062";
304
+ }
305
+
306
+ .icon-drop:before {
307
+ content: "\e063";
308
+ }
309
+
310
+ .icon-sun:before {
311
+ content: "\e064";
312
+ }
313
+
314
+ .icon-cloud:before {
315
+ content: "\e065";
316
+ }
317
+
318
+ .icon-cloud-upload:before {
319
+ content: "\e066";
320
+ }
321
+
322
+ .icon-cloud-download:before {
323
+ content: "\e067";
324
+ }
325
+
326
+ .icon-upload:before {
327
+ content: "\e068";
328
+ }
329
+
330
+ .icon-download:before {
331
+ content: "\e069";
332
+ }
333
+
334
+ .icon-location:before {
335
+ content: "\e070";
336
+ }
337
+
338
+ .icon-location-2:before {
339
+ content: "\e071";
340
+ }
341
+
342
+ .icon-map:before {
343
+ content: "\e072";
344
+ }
345
+
346
+ .icon-battery:before {
347
+ content: "\e073";
348
+ }
349
+
350
+ .icon-head:before {
351
+ content: "\e074";
352
+ }
353
+
354
+ .icon-briefcase:before {
355
+ content: "\e075";
356
+ }
357
+
358
+ .icon-speech-bubble:before {
359
+ content: "\e076";
360
+ }
361
+
362
+ .icon-anchor:before {
363
+ content: "\e077";
364
+ }
365
+
366
+ .icon-globe:before {
367
+ content: "\e078";
368
+ }
369
+
370
+ .icon-box:before {
371
+ content: "\e079";
372
+ }
373
+
374
+ .icon-reload:before {
375
+ content: "\e080";
376
+ }
377
+
378
+ .icon-share:before {
379
+ content: "\e081";
380
+ }
381
+
382
+ .icon-marquee:before {
383
+ content: "\e082";
384
+ }
385
+
386
+ .icon-marquee-plus:before {
387
+ content: "\e083";
388
+ }
389
+
390
+ .icon-marquee-minus:before {
391
+ content: "\e084";
392
+ }
393
+
394
+ .icon-tag:before {
395
+ content: "\e085";
396
+ }
397
+
398
+ .icon-power:before {
399
+ content: "\e086";
400
+ }
401
+
402
+ .icon-command:before {
403
+ content: "\e087";
404
+ }
405
+
406
+ .icon-alt:before {
407
+ content: "\e088";
408
+ }
409
+
410
+ .icon-esc:before {
411
+ content: "\e089";
412
+ }
413
+
414
+ .icon-bar-graph:before {
415
+ content: "\e090";
416
+ }
417
+
418
+ .icon-bar-graph-2:before {
419
+ content: "\e091";
420
+ }
421
+
422
+ .icon-pie-graph:before {
423
+ content: "\e092";
424
+ }
425
+
426
+ .icon-star:before {
427
+ content: "\e093";
428
+ }
429
+
430
+ .icon-arrow-left:before {
431
+ content: "\e094";
432
+ }
433
+
434
+ .icon-arrow-right:before {
435
+ content: "\e095";
436
+ }
437
+
438
+ .icon-arrow-up:before {
439
+ content: "\e096";
440
+ }
441
+
442
+ .icon-arrow-down:before {
443
+ content: "\e097";
444
+ }
445
+
446
+ .icon-volume:before {
447
+ content: "\e098";
448
+ }
449
+
450
+ .icon-mute:before {
451
+ content: "\e099";
452
+ }
453
+
454
+ .icon-content-right:before {
455
+ content: "\e100";
456
+ }
457
+
458
+ .icon-content-left:before {
459
+ content: "\e101";
460
+ }
461
+
462
+ .icon-grid:before {
463
+ content: "\e102";
464
+ }
465
+
466
+ .icon-grid-2:before {
467
+ content: "\e103";
468
+ }
469
+
470
+ .icon-columns:before {
471
+ content: "\e104";
472
+ }
473
+
474
+ .icon-loader:before {
475
+ content: "\e105";
476
+ }
477
+
478
+ .icon-bag:before {
479
+ content: "\e106";
480
+ }
481
+
482
+ .icon-ban:before {
483
+ content: "\e107";
484
+ }
485
+
486
+ .icon-flag:before {
487
+ content: "\e108";
488
+ }
489
+
490
+ .icon-trash:before {
491
+ content: "\e109";
492
+ }
493
+
494
+ .icon-expand:before {
495
+ content: "\e110";
496
+ }
497
+
498
+ .icon-contract:before {
499
+ content: "\e111";
500
+ }
501
+
502
+ .icon-maximize:before {
503
+ content: "\e112";
504
+ }
505
+
506
+ .icon-minimize:before {
507
+ content: "\e113";
508
+ }
509
+
510
+ .icon-plus:before {
511
+ content: "\e114";
512
+ }
513
+
514
+ .icon-minus:before {
515
+ content: "\e115";
516
+ }
517
+
518
+ .icon-check:before {
519
+ content: "\e116";
520
+ }
521
+
522
+ .icon-cross:before {
523
+ content: "\e117";
524
+ }
525
+
526
+ .icon-move:before {
527
+ content: "\e118";
528
+ }
529
+
530
+ .icon-delete:before {
531
+ content: "\e119";
532
+ }
533
+
534
+ .icon-menu:before {
535
+ content: "\e120";
536
+ }
537
+
538
+ .icon-archive:before {
539
+ content: "\e121";
540
+ }
541
+
542
+ .icon-inbox:before {
543
+ content: "\e122";
544
+ }
545
+
546
+ .icon-outbox:before {
547
+ content: "\e123";
548
+ }
549
+
550
+ .icon-file:before {
551
+ content: "\e124";
552
+ }
553
+
554
+ .icon-file-add:before {
555
+ content: "\e125";
556
+ }
557
+
558
+ .icon-file-subtract:before {
559
+ content: "\e126";
560
+ }
561
+
562
+ .icon-help:before {
563
+ content: "\e127";
564
+ }
565
+
566
+ .icon-open:before {
567
+ content: "\e128";
568
+ }
569
+
570
+ .icon-ellipsis:before {
571
+ content: "\e129";
572
+ }