rack-mini-profiler 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +10 -0
  3. data/README.md +2 -1
  4. data/lib/html/includes.css +5 -5
  5. data/lib/html/includes.js +38 -3
  6. data/lib/html/includes.scss +1 -1
  7. data/lib/html/includes.tmpl +5 -0
  8. data/lib/html/profile_handler.js +1 -1
  9. data/lib/mini_profiler/asset_version.rb +1 -1
  10. data/lib/mini_profiler/client_settings.rb +11 -12
  11. data/lib/mini_profiler/config.rb +17 -17
  12. data/lib/mini_profiler/context.rb +3 -3
  13. data/lib/mini_profiler/gc_profiler.rb +15 -16
  14. data/lib/mini_profiler/profiler.rb +50 -54
  15. data/lib/mini_profiler/profiling_methods.rb +4 -4
  16. data/lib/mini_profiler/storage/file_store.rb +10 -7
  17. data/lib/mini_profiler/storage/memcache_store.rb +4 -5
  18. data/lib/mini_profiler/storage/memory_store.rb +2 -3
  19. data/lib/mini_profiler/storage/redis_store.rb +2 -2
  20. data/lib/mini_profiler/timer_struct/base.rb +2 -2
  21. data/lib/mini_profiler/timer_struct/client.rb +6 -7
  22. data/lib/mini_profiler/timer_struct/custom.rb +4 -4
  23. data/lib/mini_profiler/timer_struct/page.rb +26 -25
  24. data/lib/mini_profiler/timer_struct/request.rb +25 -24
  25. data/lib/mini_profiler/timer_struct/sql.rb +20 -20
  26. data/lib/mini_profiler/version.rb +1 -1
  27. data/lib/mini_profiler_rails/railtie.rb +3 -3
  28. data/lib/patches/db/activerecord.rb +2 -2
  29. data/lib/patches/db/moped.rb +2 -2
  30. data/lib/patches/db/mysql2.rb +5 -5
  31. data/lib/patches/db/nobrainer.rb +1 -1
  32. data/lib/patches/db/pg.rb +34 -16
  33. data/lib/patches/db/riak.rb +11 -11
  34. data/lib/patches/db/rsolr.rb +2 -2
  35. data/rack-mini-profiler.gemspec +5 -4
  36. metadata +18 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3ece809a3861e0508dd92e06d0fa272bf483de9d
4
- data.tar.gz: 2edb42b798d5aa568008c715a56b5f521c8dac4f
2
+ SHA256:
3
+ metadata.gz: e7c0f5a071d07b17ed627b9c25ca3fa6a60f9670178e990fa8d84e7f826c05ff
4
+ data.tar.gz: 94c852d1876cf526cf1f771bb609d6f6993f5d1827da16861128351b59ee0f83
5
5
  SHA512:
6
- metadata.gz: 6f6f0f8477e82af1183ccf3cc38236b2cdc39c3e32801ae276bc1657649b3641fafd336b2b7ac683bf1cab74426f4cf409eaa6bac4b7be39650f53e8a3d3d5d7
7
- data.tar.gz: 50eec3c2f3599412395699db1f850b6633b604022e059dfbe30c753d2b4fc782611c63a274b2a1e61e6c00a2a4cb01f4ed460ac4340bac1d2b8e0d6e640fb77f
6
+ metadata.gz: f53c37831ae521bfc0f79dc375595f76165499b76ca60191f5ba88cf811f68abe2c787e548010c68fd209b0b156e06ba6f54b40d10dd24b1297622aefeb80c58
7
+ data.tar.gz: 471f7506b95eefc6e9f182a88baa8ef9bd8f613557619d3c34ce7f4d1831026f48ba61da7160dcb3ae7adca4dbf5d33766bbba48880a84633ee7692a2ae9ad1f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.0.1 2018-12-10
4
+
5
+ - [FIX] add support for exec_params instrumentation in PG, this method as of PG 1.1.0 no longer
6
+ routes calls to exec / async_exec
7
+ - [FIX] add missing started_at on requests
8
+ - [UX] amend colors so we pass lighthouse
9
+ - [FEATURE] fetch API support
10
+ - [FIX] getEntriesByName is missing in iOS, workaround
11
+ - [FEATURE] drop support for Ruby 2.2.0 we require 2.3.0 and up (EOL Ruby no longer supported)
12
+
3
13
  ## 1.0.0 2017-03-29
4
14
 
5
15
  - [BREAKING CHANGE] Ruby version 2.2.0 or later is required
data/README.md CHANGED
@@ -30,7 +30,7 @@ If you feel like taking on any of this start an issue and update us on your prog
30
30
 
31
31
  ## Installation
32
32
 
33
- Install/add to Gemfile in Ruby 2.2+
33
+ Install/add to Gemfile in Ruby 2.3+
34
34
 
35
35
  ```ruby
36
36
  gem 'rack-mini-profiler'
@@ -321,6 +321,7 @@ base_url_path|`'/mini-profiler-resources/'`|Path for assets; added as a prefix w
321
321
  collapse_results|`true`|If multiple timing results exist in a single page, collapse them till clicked.
322
322
  max_traces_to_show|20|Maximum number of mini profiler timing blocks to show on one page
323
323
  html_container|`body`|The HTML container (as a jQuery selector) to inject the mini_profiler UI into
324
+ show_total_sql_count|`false`|Displays the total number of SQL executions.
324
325
 
325
326
  ### Custom middleware ordering (required if using `Rack::Deflate` with Rails)
326
327
 
@@ -35,11 +35,11 @@
35
35
  overflow: hidden;
36
36
  text-overflow: ellipsis; }
37
37
  .profiler-result .profiler-unit {
38
- color: #aaa; }
38
+ color: #767676; }
39
39
  .profiler-result .profiler-trivial {
40
40
  display: none; }
41
41
  .profiler-result .profiler-trivial td, .profiler-result .profiler-trivial td * {
42
- color: #aaa !important; }
42
+ color: #767676 !important; }
43
43
  .profiler-result pre, .profiler-result code, .profiler-result .profiler-number, .profiler-result .profiler-unit {
44
44
  font-family: Consolas, monospace, serif; }
45
45
  .profiler-result .profiler-number {
@@ -52,7 +52,7 @@
52
52
  white-space: nowrap; }
53
53
  .profiler-result .profiler-timings th {
54
54
  background-color: #fff;
55
- color: #aaa;
55
+ color: #767676;
56
56
  text-align: right; }
57
57
  .profiler-result .profiler-timings th, .profiler-result .profiler-timings td {
58
58
  white-space: nowrap; }
@@ -228,7 +228,7 @@
228
228
  cursor: default;
229
229
  text-align: center; }
230
230
  .profiler-results .profiler-controls span {
231
- border-right: 1px solid #aaa;
231
+ border-right: 1px solid #767676;
232
232
  padding-right: 5px;
233
233
  margin-right: 5px;
234
234
  cursor: pointer; }
@@ -306,7 +306,7 @@
306
306
  display: none; }
307
307
  .profiler-result-full .profiler-result .profiler-popup .profiler-info {
308
308
  font-size: 25px;
309
- border-bottom: 1px solid #aaa;
309
+ border-bottom: 1px solid #767676;
310
310
  padding-bottom: 3px;
311
311
  margin-bottom: 25px; }
312
312
  .profiler-result-full .profiler-result .profiler-popup .profiler-info .profiler-overall-duration {
data/lib/html/includes.js CHANGED
@@ -11,7 +11,8 @@ var MiniProfiler = (function () {
11
11
  totalsControl,
12
12
  reqs = 0,
13
13
  expandedResults = false,
14
- totalTime = 0;
14
+ totalTime = 0,
15
+ totalSqlCount = 0
15
16
  ;
16
17
 
17
18
  var hasLocalStorage = function (keyPrefix) {
@@ -146,6 +147,7 @@ var MiniProfiler = (function () {
146
147
  var result = renderTemplate(json);
147
148
 
148
149
  totalTime += parseFloat(json.duration_milliseconds, 10);
150
+ totalSqlCount += parseInt(json.sql_count);
149
151
  reqs++;
150
152
 
151
153
  if (!controls && reqs > 1 && options.collapseResults && !expandedResults) {
@@ -164,8 +166,10 @@ var MiniProfiler = (function () {
164
166
  }
165
167
 
166
168
  var reqsHtml = reqs > 1 ? ("<span class='profiler-reqs'>" + reqs + "</span>") : "";
169
+ var sqlHtml = options.showTotalSqlCount && totalSqlCount > 0 ? (" / <span class='profiler-number'>" + totalSqlCount + "</span> <span class='profiler-unit'>sql</span>") : "";
167
170
  totalsControl.find('.profiler-button').html("<span class='profiler-number'>" +
168
171
  totalTime.toFixed(1) + "</span> <span class='profiler-unit'>ms</span>" +
172
+ sqlHtml +
169
173
  reqsHtml);
170
174
 
171
175
  result.hide();
@@ -592,6 +596,31 @@ var MiniProfiler = (function () {
592
596
  };
593
597
  }
594
598
 
599
+ // https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
600
+ if(typeof(window.fetch) === 'function' && window.fetch.__patchedByMiniProfiler === undefined) {
601
+ var __originalFetch = window.fetch;
602
+
603
+ window.fetch = function(input,init) {
604
+ return new Promise(function(resolve,reject) {
605
+ __originalFetch(input,init).then(function(response) {
606
+ // look for x-mini-profile-ids
607
+ var entries = response.headers.entries();
608
+ for (var i = 0; i < entries.length; i++) {
609
+ var pair = entries[i];
610
+ if(pair[0] && (pair[0].toLowerCase() == 'x-miniprofiler-ids')) {
611
+ var ids = JSON.parse(pair[1]);
612
+ fetchResults(ids);
613
+ }
614
+ }
615
+ resolve(response);
616
+ }).catch(function(error) {
617
+ reject(error);
618
+ });
619
+ });
620
+ }
621
+ window.fetch.__patchedByMiniProfiler = true;
622
+ }
623
+
595
624
  // some elements want to be hidden on certain doc events
596
625
  bindDocumentEvents();
597
626
  };
@@ -624,6 +653,7 @@ var MiniProfiler = (function () {
624
653
  var trivial = script.getAttribute('data-trivial') === 'true';
625
654
  var children = script.getAttribute('data-children') === 'true';
626
655
  var controls = script.getAttribute('data-controls') === 'true';
656
+ var totalSqlCount = script.getAttribute('data-total-sql-count') === 'true';
627
657
  var authorized = script.getAttribute('data-authorized') === 'true';
628
658
  var startHidden = script.getAttribute('data-start-hidden') === 'true' || sessionStorage['rack-mini-profiler-start-hidden'] === 'true';
629
659
  var htmlContainer = script.getAttribute('data-html-container');
@@ -638,6 +668,7 @@ var MiniProfiler = (function () {
638
668
  showChildrenTime: children,
639
669
  maxTracesToShow: maxTraces,
640
670
  showControls: controls,
671
+ showTotalSqlCount: totalSqlCount,
641
672
  currentId: currentId,
642
673
  authorized: authorized,
643
674
  toggleShortcut: toggleShortcut,
@@ -817,9 +848,9 @@ var MiniProfiler = (function () {
817
848
 
818
849
 
819
850
  // Use the Paint Timing API for render performance.
820
- if (window.performance) {
851
+ if (window.performance && window.performance.getEntriesByName) {
821
852
  var firstPaint = window.performance.getEntriesByName("first-paint");
822
-
853
+
823
854
  if(firstPaint !== undefined && firstPaint.length >= 1){
824
855
  list.push(
825
856
  {
@@ -1011,6 +1042,10 @@ var MiniProfiler = (function () {
1011
1042
 
1012
1043
  formatDuration: function (duration) {
1013
1044
  return (duration || 0).toFixed(1);
1045
+ },
1046
+
1047
+ showTotalSqlCount: function () {
1048
+ return options.showTotalSqlCount
1014
1049
  }
1015
1050
  };
1016
1051
  })();
@@ -8,7 +8,7 @@ $anchorColor: #0077CC;
8
8
  $buttonBorderColor: #888;
9
9
  $numberColor: #111;
10
10
  $textColor: #555;
11
- $mutedColor: #aaa;
11
+ $mutedColor: #767676;
12
12
  $normalFonts: Helvetica, Arial, sans-serif;
13
13
  $codeFonts: Consolas, monospace, serif;
14
14
  $zindex:2147483640; // near 32bit max 2147483647
@@ -7,6 +7,11 @@
7
7
  <span class="profiler-number">
8
8
  ${MiniProfiler.formatDuration(duration_milliseconds)} <span class="profiler-unit">ms</span>
9
9
  </span>
10
+ {{if MiniProfiler.showTotalSqlCount()}}
11
+ <span class="profiler-number">
12
+ ${sql_count} <span class="profiler-unit">sql</span>
13
+ </span>
14
+ {{/if}}
10
15
  </div>
11
16
 
12
17
  <div class="profiler-popup">
@@ -1 +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-horizontal-position="{horizontalPosition}" data-vertical-position="{verticalPosition}" data-trivial="{showTrivial}" data-children="{showChildren}" data-max-traces="{maxTracesToShow}" data-controls="{showControls}" data-authorized="{authorized}" data-toggle-shortcut="{toggleShortcut}" data-start-hidden="{startHidden}" data-collapse-results="{collapseResults}" data-html-container="{htmlContainer}"></script>
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-horizontal-position="{horizontalPosition}" data-vertical-position="{verticalPosition}" data-trivial="{showTrivial}" data-children="{showChildren}" data-max-traces="{maxTracesToShow}" data-controls="{showControls}" data-total-sql-count="{showTotalSqlCount}" data-authorized="{authorized}" data-toggle-shortcut="{toggleShortcut}" data-start-hidden="{startHidden}" data-collapse-results="{collapseResults}" data-html-container="{htmlContainer}"></script>
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class MiniProfiler
3
- ASSET_VERSION = '251162ee7dc30da30d5370581c664510'.freeze
3
+ ASSET_VERSION = '355f78011d9b95de14a5b1014b088681'.freeze
4
4
  end
5
5
  end
@@ -13,10 +13,9 @@ module Rack
13
13
  attr_accessor :disable_profiling
14
14
  attr_accessor :backtrace_level
15
15
 
16
-
17
16
  def initialize(env, store, start)
18
- request = ::Rack::Request.new(env)
19
- @cookie = request.cookies[COOKIE_NAME]
17
+ @request = ::Rack::Request.new(env)
18
+ @cookie = @request.cookies[COOKIE_NAME]
20
19
  @store = store
21
20
  @start = start
22
21
  @backtrace_level = nil
@@ -25,8 +24,8 @@ module Rack
25
24
  @allowed_tokens, @orig_auth_tokens = nil
26
25
 
27
26
  if @cookie
28
- @cookie.split(",").map{|pair| pair.split("=")}.each do |k,v|
29
- @orig_disable_profiling = @disable_profiling = (v=='t') if k == "dp"
27
+ @cookie.split(",").map { |pair| pair.split("=") }.each do |k, v|
28
+ @orig_disable_profiling = @disable_profiling = (v == 't') if k == "dp"
30
29
  @backtrace_level = v.to_i if k == "bt"
31
30
  @orig_auth_tokens = v.to_s.split("|") if k == "a"
32
31
  end
@@ -41,7 +40,7 @@ module Rack
41
40
  end
42
41
 
43
42
  def handle_cookie(result)
44
- status,headers,_body = result
43
+ status, headers, _body = result
45
44
 
46
45
  if (MiniProfiler.config.authorization_mode == :whitelist && !MiniProfiler.request_authorized?)
47
46
  # this is non-obvious, don't kill the profiling cookie on errors or short requests
@@ -70,19 +69,20 @@ module Rack
70
69
  @cookie.nil? ||
71
70
  tokens_changed
72
71
 
73
- settings = {"p" => "t" }
72
+ settings = { "p" => "t" }
74
73
  settings["dp"] = "t" if @disable_profiling
75
74
  settings["bt"] = @backtrace_level if @backtrace_level
76
75
  settings["a"] = @allowed_tokens.join("|") if @allowed_tokens && MiniProfiler.request_authorized?
77
-
78
- settings_string = settings.map{|k,v| "#{k}=#{v}"}.join(",")
79
- Rack::Utils.set_cookie_header!(headers, COOKIE_NAME, :value => settings_string, :path => '/')
76
+ settings_string = settings.map { |k, v| "#{k}=#{v}" }.join(",")
77
+ cookie = { value: settings_string, path: '/', httponly: true }
78
+ cookie[:secure] = true if @request.ssl?
79
+ Rack::Utils.set_cookie_header!(headers, COOKIE_NAME, cookie)
80
80
  end
81
81
  end
82
82
 
83
83
  def discard_cookie!(headers)
84
84
  if @cookie
85
- Rack::Utils.delete_cookie_header!(headers, COOKIE_NAME, :path => '/')
85
+ Rack::Utils.delete_cookie_header!(headers, COOKIE_NAME, path: '/')
86
86
  end
87
87
  end
88
88
 
@@ -99,7 +99,6 @@ module Rack
99
99
  valid_cookie
100
100
  end
101
101
 
102
-
103
102
  def disable_profiling?
104
103
  @disable_profiling
105
104
  end
@@ -19,12 +19,12 @@ module Rack
19
19
  @base_url_path = "/mini-profiler-resources/".dup
20
20
  @disable_caching = true
21
21
  # called prior to rack chain, to ensure we are allowed to profile
22
- @pre_authorize_cb = lambda {|env| true}
22
+ @pre_authorize_cb = lambda { |env| true }
23
23
 
24
24
  # called after rack chain, to ensure we are REALLY allowed to profile
25
25
  @skip_schema_queries = false
26
26
  @storage = MiniProfiler::MemoryStore
27
- @user_provider = Proc.new{|env| Rack::Request.new(env).ip}
27
+ @user_provider = Proc.new { |env| Rack::Request.new(env).ip }
28
28
  @authorization_mode = :allow_all
29
29
  @backtrace_threshold_ms = 0
30
30
  @flamegraph_sample_rate = 0.5
@@ -39,16 +39,17 @@ module Rack
39
39
  @skip_sql_param_names = /password/ # skips parameters with the name password by default
40
40
 
41
41
  # ui parameters
42
- @autorized = true
43
- @collapse_results = true
44
- @max_traces_to_show = 20
45
- @show_children = false
46
- @show_controls = false
47
- @show_trivial = false
48
- @start_hidden = false
49
- @toggle_shortcut = 'Alt+P'
50
- @html_container = 'body'
51
- @position = "top-left"
42
+ @autorized = true
43
+ @collapse_results = true
44
+ @max_traces_to_show = 20
45
+ @show_children = false
46
+ @show_controls = false
47
+ @show_trivial = false
48
+ @show_total_sql_count = false
49
+ @start_hidden = false
50
+ @toggle_shortcut = 'Alt+P'
51
+ @html_container = 'body'
52
+ @position = "top-left"
52
53
 
53
54
  self
54
55
  }
@@ -64,8 +65,8 @@ module Rack
64
65
 
65
66
  # ui accessors
66
67
  attr_accessor :collapse_results, :max_traces_to_show, :position,
67
- :show_children, :show_controls, :show_trivial, :start_hidden,
68
- :toggle_shortcut, :html_container
68
+ :show_children, :show_controls, :show_trivial, :show_total_sql_count,
69
+ :start_hidden, :toggle_shortcut, :html_container
69
70
 
70
71
  # Deprecated options
71
72
  attr_accessor :use_existing_jquery
@@ -78,13 +79,12 @@ module Rack
78
79
  position.include?('right') ? 'right' : 'left'
79
80
  end
80
81
 
81
-
82
82
  def merge!(config)
83
83
  if config
84
84
  if Hash === config
85
- config.each{|k,v| instance_variable_set "@#{k}",v}
85
+ config.each { |k, v| instance_variable_set "@#{k}", v }
86
86
  else
87
- self.class.attributes.each{ |k|
87
+ self.class.attributes.each { |k|
88
88
  v = config.send k
89
89
  instance_variable_set "@#{k}", v if v
90
90
  }
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Rack::MiniProfiler::Context
4
- attr_accessor :inject_js,:current_timer,:page_struct,:skip_backtrace,
5
- :full_backtrace,:discard, :mpt_init, :measure
4
+ attr_accessor :inject_js, :current_timer, :page_struct, :skip_backtrace,
5
+ :full_backtrace, :discard, :mpt_init, :measure
6
6
 
7
7
  def initialize(opts = {})
8
8
  opts["measure"] = true unless opts.key? "measure"
9
- opts.each do |k,v|
9
+ opts.each do |k, v|
10
10
  self.instance_variable_set('@' + k, v)
11
11
  end
12
12
  end
@@ -30,7 +30,7 @@ class Rack::MiniProfiler::GCProfiler
30
30
  end
31
31
  end
32
32
 
33
- result = {:stats => stats, :ids => ids}
33
+ result = { stats: stats, ids: ids }
34
34
  @ignore << result.__id__
35
35
 
36
36
  result
@@ -38,10 +38,10 @@ class Rack::MiniProfiler::GCProfiler
38
38
 
39
39
  def diff_object_stats(before, after)
40
40
  diff = {}.compare_by_identity
41
- after.each do |k,v|
41
+ after.each do |k, v|
42
42
  diff[k] = v - before[k]
43
43
  end
44
- before.each do |k,v|
44
+ before.each do |k, v|
45
45
  diff[k] = 0 - v unless after.has_key?(k)
46
46
  end
47
47
 
@@ -50,7 +50,7 @@ class Rack::MiniProfiler::GCProfiler
50
50
 
51
51
  def analyze_strings(ids_before, ids_after)
52
52
  result = {}
53
- ids_after.each do |id,_|
53
+ ids_after.each do |id, _|
54
54
  obj = ObjectSpace._id2ref(id)
55
55
  if String === obj && !ids_before.include?(obj.object_id)
56
56
  result[obj] ||= 0
@@ -64,8 +64,8 @@ class Rack::MiniProfiler::GCProfiler
64
64
  new_objects = 0
65
65
  memory_allocated = 0
66
66
 
67
- ids_after.each do |id,_|
68
- if !ids_before.include?(id) && obj=ObjectSpace._id2ref(id)
67
+ ids_after.each do |id, _|
68
+ if !ids_before.include?(id) && obj = ObjectSpace._id2ref(id)
69
69
  # this is going to be version specific (may change in 2.1)
70
70
  size = ObjectSpace.memsize_of(obj)
71
71
  memory_allocated += size
@@ -80,15 +80,15 @@ class Rack::MiniProfiler::GCProfiler
80
80
  memory_allocated = 0
81
81
  objects = 0
82
82
 
83
- ids_before.each do |id,_|
84
- if obj=ObjectSpace._id2ref(id)
83
+ ids_before.each do |id, _|
84
+ if obj = ObjectSpace._id2ref(id)
85
85
  # this is going to be version specific (may change in 2.1)
86
86
  memory_allocated += ObjectSpace.memsize_of(obj)
87
87
  objects += 1
88
88
  end
89
89
  end
90
90
 
91
- [objects,memory_allocated]
91
+ [objects, memory_allocated]
92
92
  end
93
93
 
94
94
  def profile_gc(app, env)
@@ -107,7 +107,7 @@ class Rack::MiniProfiler::GCProfiler
107
107
  # so we don't blow out on memory
108
108
  prev_gc_state ? GC.disable : GC.enable
109
109
 
110
- diff = diff_object_stats(stat_before[:stats],stat_after[:stats])
110
+ diff = diff_object_stats(stat_before[:stats], stat_after[:stats])
111
111
  string_analysis = analyze_strings(stat_before[:ids], stat_after[:ids])
112
112
  new_objects, memory_allocated = analyze_growth(stat_before[:ids], stat_after[:ids])
113
113
  objects_before, memory_before = analyze_initial_state(stat_before[:ids])
@@ -122,7 +122,7 @@ Memory allocated outside heap (bytes): #{memory_before}
122
122
 
123
123
  GC Stats:
124
124
  --------
125
- #{stat.map{|k,v| "#{k} : #{v}" }.sort!.join("\n")}
125
+ #{stat.map { |k, v| "#{k} : #{v}" }.sort!.join("\n")}
126
126
 
127
127
  New bytes allocated outside of Ruby heaps: #{memory_allocated}
128
128
  New objects: #{new_objects}
@@ -131,7 +131,7 @@ New objects: #{new_objects}
131
131
  body << "
132
132
  ObjectSpace delta caused by request:
133
133
  -----------------------------------\n"
134
- diff.to_a.delete_if{|_k, v| v == 0}.sort_by! { |_k, v| v }.reverse_each do |k,v|
134
+ diff.to_a.delete_if { |_k, v| v == 0 }.sort_by! { |_k, v| v }.reverse_each do |k, v|
135
135
  body << "#{k} : #{v}\n"
136
136
  end
137
137
 
@@ -139,20 +139,19 @@ ObjectSpace delta caused by request:
139
139
  ObjectSpace stats:
140
140
  -----------------\n"
141
141
 
142
- stat_after[:stats].to_a.sort_by!{ |_k, v| v }.reverse_each do |k,v|
142
+ stat_after[:stats].to_a.sort_by! { |_k, v| v }.reverse_each do |k, v|
143
143
  body << "#{k} : #{v}\n"
144
144
  end
145
145
 
146
-
147
146
  body << "\n
148
147
  String stats:
149
148
  ------------\n"
150
149
 
151
- string_analysis.to_a.sort_by!{ |_k, v| -v }.take(1000).each do |string,count|
150
+ string_analysis.to_a.sort_by! { |_k, v| -v }.take(1000).each do |string, count|
152
151
  body << "#{count} : #{string}\n"
153
152
  end
154
153
 
155
- return [200, {'Content-Type' => 'text/plain'}, body]
154
+ return [200, { 'Content-Type' => 'text/plain' }, body]
156
155
  ensure
157
156
  prev_gc_state ? GC.disable : GC.enable
158
157
  end