rack-mini-profiler 0.1.21 → 0.1.22

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.

Potentially problematic release.


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

Files changed (34) hide show
  1. data/{CHANGELOG → Ruby/CHANGELOG} +8 -0
  2. data/{README.md → Ruby/README.md} +0 -0
  3. data/{lib → Ruby/lib}/html/includes.css +0 -0
  4. data/{lib → Ruby/lib}/html/includes.js +2 -1
  5. data/{lib → Ruby/lib}/html/includes.less +0 -0
  6. data/{lib → Ruby/lib}/html/includes.tmpl +0 -0
  7. data/{lib → Ruby/lib}/html/jquery.1.7.1.js +0 -0
  8. data/{lib → Ruby/lib}/html/jquery.tmpl.js +0 -0
  9. data/{lib → Ruby/lib}/html/list.css +0 -0
  10. data/{lib → Ruby/lib}/html/list.js +0 -0
  11. data/{lib → Ruby/lib}/html/list.tmpl +0 -0
  12. data/{lib → Ruby/lib}/html/profile_handler.js +0 -0
  13. data/{lib → Ruby/lib}/html/share.html +0 -0
  14. data/{lib → Ruby/lib}/mini_profiler/client_settings.rb +0 -0
  15. data/{lib → Ruby/lib}/mini_profiler/client_timer_struct.rb +0 -0
  16. data/{lib → Ruby/lib}/mini_profiler/config.rb +0 -0
  17. data/{lib → Ruby/lib}/mini_profiler/context.rb +0 -0
  18. data/{lib → Ruby/lib}/mini_profiler/gc_profiler.rb +31 -12
  19. data/{lib → Ruby/lib}/mini_profiler/page_timer_struct.rb +0 -0
  20. data/{lib → Ruby/lib}/mini_profiler/profiler.rb +16 -4
  21. data/{lib → Ruby/lib}/mini_profiler/profiling_methods.rb +0 -0
  22. data/{lib → Ruby/lib}/mini_profiler/request_timer_struct.rb +0 -0
  23. data/{lib → Ruby/lib}/mini_profiler/sql_timer_struct.rb +0 -0
  24. data/{lib → Ruby/lib}/mini_profiler/storage/abstract_store.rb +0 -0
  25. data/{lib → Ruby/lib}/mini_profiler/storage/file_store.rb +0 -0
  26. data/{lib → Ruby/lib}/mini_profiler/storage/memcache_store.rb +0 -0
  27. data/{lib → Ruby/lib}/mini_profiler/storage/memory_store.rb +0 -0
  28. data/{lib → Ruby/lib}/mini_profiler/storage/redis_store.rb +0 -0
  29. data/{lib → Ruby/lib}/mini_profiler/timer_struct.rb +0 -0
  30. data/{lib → Ruby/lib}/mini_profiler_rails/railtie.rb +0 -0
  31. data/{lib → Ruby/lib}/patches/sql_patches.rb +0 -0
  32. data/{lib → Ruby/lib}/rack-mini-profiler.rb +0 -0
  33. data/rack-mini-profiler.gemspec +6 -4
  34. metadata +39 -39
@@ -97,3 +97,11 @@
97
97
  * 1.21
98
98
  * New MemchacedStore
99
99
  * Rails 4 support
100
+
101
+ 17-September-2012
102
+ * Allow rack-mini-profiler to be sourced from github
103
+ * Extracted the pp=profile-gc-time out, the object space profiler needs to disable gc
104
+
105
+ 20-September-2010
106
+ * 1.22
107
+ * Fix permission issue in the gem
File without changes
File without changes
@@ -449,11 +449,12 @@ var MiniProfiler = (function ($) {
449
449
  };
450
450
 
451
451
  // fetch profile results for any ajax calls
452
+ // note, this does not use $ cause we want to hook into the main jQuery
452
453
  if (jQuery && jQuery(document) && jQuery(document).ajaxComplete) {
453
454
  jQuery(document).ajaxComplete(jQueryAjaxComplete);
454
455
  }
455
456
 
456
- if (jQuery(document).ajaxStart)
457
+ if (jQuery && jQuery(document).ajaxStart)
457
458
  jQuery(document).ajaxStart(function () { ajaxStartTime = new Date(); });
458
459
 
459
460
  // fetch results after ASP Ajax calls
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -3,10 +3,12 @@ class Rack::MiniProfiler::GCProfiler
3
3
  def object_space_stats
4
4
  stats = {}
5
5
  ids = Set.new
6
+ i=0
6
7
  ObjectSpace.each_object { |o|
7
- stats[o.class] ||= 1
8
- stats[o.class] += 1
9
- ids << o.object_id
8
+ i = stats[o.class] || 0
9
+ i += 1
10
+ stats[o.class] = i
11
+ ids << o.object_id if Integer === o.object_id
10
12
  }
11
13
  {:stats => stats, :ids => ids}
12
14
  end
@@ -35,24 +37,42 @@ class Rack::MiniProfiler::GCProfiler
35
37
  result
36
38
  end
37
39
 
38
- def profile_gc(app,env)
39
-
40
- body = [];
40
+ def profile_gc_time(app,env)
41
+ body = []
41
42
 
42
- stat_after = nil
43
- stat_before = object_space_stats
44
43
  begin
45
44
  GC::Profiler.clear
46
45
  GC::Profiler.enable
47
46
  b = app.call(env)[2]
48
47
  b.close if b.respond_to? :close
49
- stat_after = object_space_stats
48
+ body << "GC Profiler ran during this request, if it fired you will see the cost below:\n\n"
50
49
  body << GC::Profiler.result
51
50
  ensure
51
+ GC.enable
52
52
  GC::Profiler.disable
53
53
  end
54
54
 
55
- diff = diff_object_stats(stat_before[:stats],stat_after[:stats])
55
+ return [200, {'Content-Type' => 'text/plain'}, body]
56
+ end
57
+
58
+ def profile_gc(app,env)
59
+
60
+ body = [];
61
+
62
+ stat_before,stat_after,diff,string_analysis = nil
63
+ begin
64
+ GC.disable
65
+ stat_before = object_space_stats
66
+ b = app.call(env)[2]
67
+ b.close if b.respond_to? :close
68
+ stat_after = object_space_stats
69
+
70
+ diff = diff_object_stats(stat_before[:stats],stat_after[:stats])
71
+ string_analysis = analyze_strings(stat_before[:ids], stat_after[:ids])
72
+ ensure
73
+ GC.enable
74
+ end
75
+
56
76
 
57
77
  body << "
58
78
  ObjectSpace delta caused by request:
@@ -69,13 +89,12 @@ ObjectSpace stats:
69
89
  body << "#{k} : #{v}\n"
70
90
  end
71
91
 
72
- r = analyze_strings(stat_before[:ids], stat_after[:ids])
73
92
 
74
93
  body << "\n
75
94
  String stats:
76
95
  ------------\n"
77
96
 
78
- r.to_a.sort{|x,y| y[1] <=> x[1] }.take(1000).each do |string,count|
97
+ string_analysis.to_a.sort{|x,y| y[1] <=> x[1] }.take(1000).each do |string,count|
79
98
  body << "#{count} : #{string}\n"
80
99
  end
81
100
 
@@ -21,7 +21,8 @@ module Rack
21
21
 
22
22
  class MiniProfiler
23
23
 
24
- VERSION = '107'.freeze
24
+ # we really should add a cleaner way to version JS and includes
25
+ VERSION = '108'.freeze
25
26
 
26
27
  class << self
27
28
 
@@ -211,9 +212,19 @@ module Rack
211
212
  end
212
213
 
213
214
  if query_string =~ /pp=profile-gc/
214
- return Rack::MiniProfiler::GCProfiler.new.profile_gc(@app, env)
215
+ # begin
216
+ if query_string =~ /pp=profile-gc-time/
217
+ return Rack::MiniProfiler::GCProfiler.new.profile_gc_time(@app, env)
218
+ else
219
+ return Rack::MiniProfiler::GCProfiler.new.profile_gc(@app, env)
220
+ end
221
+ # rescue => e
222
+ # p e
223
+ # e.backtrace.each do |s|
224
+ # puts s
225
+ # end
226
+ # end
215
227
  end
216
-
217
228
  MiniProfiler.create_current(env, @config)
218
229
  MiniProfiler.deauthorize_request if @config.authorization_mode == :whitelist
219
230
  if query_string =~ /pp=normal-backtrace/
@@ -391,7 +402,8 @@ module Rack
391
402
  pp=sample : sample stack traces and return a report isolating heavy usage (experimental works best with the stacktrace gem)
392
403
  pp=disable : disable profiling for this session
393
404
  pp=enable : enable profiling for this session (if previously disabled)
394
- pp=profile-gc: perform gc profiling on this request (ruby 1.9.3 only)
405
+ pp=profile-gc: perform gc profiling on this request, analyzes ObjectSpace generated by request (ruby 1.9.3 only)
406
+ pp=profile-gc-time: perform built-in gc profiling on this request (ruby 1.9.3 only)
395
407
  "
396
408
 
397
409
  client_settings.write!(headers)
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "rack-mini-profiler"
3
- s.version = "0.1.21"
3
+ s.version = "0.1.22"
4
4
  s.summary = "Profiles loading speed for rack applications."
5
5
  s.authors = ["Sam Saffron", "Robin Ward","Aleks Totic"]
6
6
  s.description = "Profiling toolkit for Rack applications with Rails integration. Client Side profiling, DB profiling and Server profiling."
@@ -8,10 +8,10 @@ Gem::Specification.new do |s|
8
8
  s.homepage = "http://miniprofiler.com"
9
9
  s.files = [
10
10
  'rack-mini-profiler.gemspec',
11
- ].concat( Dir.glob('lib/**/*').reject {|f| File.directory?(f) || f =~ /~$/ } )
11
+ ].concat( Dir.glob('Ruby/lib/**/*').reject {|f| File.directory?(f) || f =~ /~$/ } )
12
12
  s.extra_rdoc_files = [
13
- "README.md",
14
- "CHANGELOG"
13
+ "Ruby/README.md",
14
+ "Ruby/CHANGELOG"
15
15
  ]
16
16
  s.add_runtime_dependency 'rack', '>= 1.1.3'
17
17
  if RUBY_VERSION < "1.9"
@@ -21,4 +21,6 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency 'rake'
22
22
  s.add_development_dependency 'rack-test'
23
23
  s.add_development_dependency 'activerecord', '~> 3.0'
24
+
25
+ s.require_paths = ["Ruby/lib"]
24
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-mini-profiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.21
4
+ version: 0.1.22
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-09-16 00:00:00.000000000 Z
14
+ date: 2012-09-20 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rack
@@ -83,48 +83,48 @@ email: sam.saffron@gmail.com
83
83
  executables: []
84
84
  extensions: []
85
85
  extra_rdoc_files:
86
- - README.md
87
- - CHANGELOG
86
+ - Ruby/README.md
87
+ - Ruby/CHANGELOG
88
88
  files:
89
89
  - rack-mini-profiler.gemspec
90
- - lib/mini_profiler/sql_timer_struct.rb
91
- - lib/mini_profiler/request_timer_struct.rb
92
- - lib/mini_profiler/timer_struct.rb
93
- - lib/mini_profiler/page_timer_struct.rb
94
- - lib/mini_profiler/client_settings.rb
95
- - lib/mini_profiler/context.rb
96
- - lib/mini_profiler/config.rb
97
- - lib/mini_profiler/profiling_methods.rb
98
- - lib/mini_profiler/gc_profiler.rb
99
- - lib/mini_profiler/client_timer_struct.rb
100
- - lib/mini_profiler/profiler.rb
101
- - lib/mini_profiler/storage/memory_store.rb
102
- - lib/mini_profiler/storage/file_store.rb
103
- - lib/mini_profiler/storage/redis_store.rb
104
- - lib/mini_profiler/storage/abstract_store.rb
105
- - lib/mini_profiler/storage/memcache_store.rb
106
- - lib/rack-mini-profiler.rb
107
- - lib/html/jquery.1.7.1.js
108
- - lib/html/includes.tmpl
109
- - lib/html/share.html
110
- - lib/html/includes.less
111
- - lib/html/list.css
112
- - lib/html/includes.js
113
- - lib/html/jquery.tmpl.js
114
- - lib/html/list.tmpl
115
- - lib/html/profile_handler.js
116
- - lib/html/includes.css
117
- - lib/html/list.js
118
- - lib/mini_profiler_rails/railtie.rb
119
- - lib/patches/sql_patches.rb
120
- - README.md
121
- - CHANGELOG
90
+ - Ruby/lib/mini_profiler/sql_timer_struct.rb
91
+ - Ruby/lib/mini_profiler/request_timer_struct.rb
92
+ - Ruby/lib/mini_profiler/timer_struct.rb
93
+ - Ruby/lib/mini_profiler/page_timer_struct.rb
94
+ - Ruby/lib/mini_profiler/client_settings.rb
95
+ - Ruby/lib/mini_profiler/context.rb
96
+ - Ruby/lib/mini_profiler/config.rb
97
+ - Ruby/lib/mini_profiler/profiling_methods.rb
98
+ - Ruby/lib/mini_profiler/gc_profiler.rb
99
+ - Ruby/lib/mini_profiler/client_timer_struct.rb
100
+ - Ruby/lib/mini_profiler/profiler.rb
101
+ - Ruby/lib/mini_profiler/storage/memory_store.rb
102
+ - Ruby/lib/mini_profiler/storage/file_store.rb
103
+ - Ruby/lib/mini_profiler/storage/redis_store.rb
104
+ - Ruby/lib/mini_profiler/storage/abstract_store.rb
105
+ - Ruby/lib/mini_profiler/storage/memcache_store.rb
106
+ - Ruby/lib/rack-mini-profiler.rb
107
+ - Ruby/lib/html/jquery.1.7.1.js
108
+ - Ruby/lib/html/includes.tmpl
109
+ - Ruby/lib/html/share.html
110
+ - Ruby/lib/html/includes.less
111
+ - Ruby/lib/html/list.css
112
+ - Ruby/lib/html/includes.js
113
+ - Ruby/lib/html/jquery.tmpl.js
114
+ - Ruby/lib/html/list.tmpl
115
+ - Ruby/lib/html/profile_handler.js
116
+ - Ruby/lib/html/includes.css
117
+ - Ruby/lib/html/list.js
118
+ - Ruby/lib/mini_profiler_rails/railtie.rb
119
+ - Ruby/lib/patches/sql_patches.rb
120
+ - Ruby/README.md
121
+ - Ruby/CHANGELOG
122
122
  homepage: http://miniprofiler.com
123
123
  licenses: []
124
124
  post_install_message:
125
125
  rdoc_options: []
126
126
  require_paths:
127
- - lib
127
+ - Ruby/lib
128
128
  required_ruby_version: !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
@@ -133,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  segments:
135
135
  - 0
136
- hash: -668836557
136
+ hash: -138209491
137
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  segments:
144
144
  - 0
145
- hash: -668836557
145
+ hash: -138209491
146
146
  requirements: []
147
147
  rubyforge_project:
148
148
  rubygems_version: 1.8.24