ruby-prof 0.11.2 → 0.13.0

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 (150) hide show
  1. data/CHANGES +31 -0
  2. data/README.rdoc +17 -17
  3. data/Rakefile +28 -5
  4. data/bin/ruby-prof +274 -265
  5. data/doc/LICENSE.html +155 -0
  6. data/doc/README_rdoc.html +640 -0
  7. data/doc/Rack/RubyProf.html +319 -0
  8. data/doc/Rack.html +167 -0
  9. data/doc/RubyProf/AbstractPrinter.html +580 -0
  10. data/doc/RubyProf/AggregateCallInfo.html +570 -0
  11. data/doc/RubyProf/CallInfo.html +512 -0
  12. data/doc/RubyProf/CallInfoPrinter.html +190 -0
  13. data/doc/RubyProf/CallInfoVisitor.html +332 -0
  14. data/doc/RubyProf/CallStackPrinter.html +1600 -0
  15. data/doc/RubyProf/CallTreePrinter.html +413 -0
  16. data/doc/RubyProf/Cmd.html +669 -0
  17. data/doc/RubyProf/DotPrinter.html +312 -0
  18. data/doc/RubyProf/FlatPrinter.html +229 -0
  19. data/doc/RubyProf/FlatPrinterWithLineNumbers.html +267 -0
  20. data/doc/RubyProf/GraphHtmlPrinter.html +631 -0
  21. data/doc/RubyProf/GraphPrinter.html +209 -0
  22. data/doc/RubyProf/MethodInfo.html +713 -0
  23. data/doc/RubyProf/MultiPrinter.html +407 -0
  24. data/doc/RubyProf/Profile.html +821 -0
  25. data/doc/RubyProf/ProfileTask.html +532 -0
  26. data/doc/RubyProf/Test.html +578 -0
  27. data/doc/RubyProf/Thread.html +262 -0
  28. data/doc/RubyProf.html +999 -0
  29. data/doc/created.rid +32 -0
  30. data/doc/examples/flat_txt.html +191 -0
  31. data/doc/examples/graph_txt.html +305 -0
  32. data/doc/images/add.png +0 -0
  33. data/doc/images/brick.png +0 -0
  34. data/doc/images/brick_link.png +0 -0
  35. data/doc/images/bug.png +0 -0
  36. data/doc/images/bullet_black.png +0 -0
  37. data/doc/images/bullet_toggle_minus.png +0 -0
  38. data/doc/images/bullet_toggle_plus.png +0 -0
  39. data/doc/images/date.png +0 -0
  40. data/doc/images/delete.png +0 -0
  41. data/doc/images/find.png +0 -0
  42. data/doc/images/loadingAnimation.gif +0 -0
  43. data/doc/images/macFFBgHack.png +0 -0
  44. data/doc/images/package.png +0 -0
  45. data/doc/images/page_green.png +0 -0
  46. data/doc/images/page_white_text.png +0 -0
  47. data/doc/images/page_white_width.png +0 -0
  48. data/doc/images/plugin.png +0 -0
  49. data/doc/images/ruby.png +0 -0
  50. data/doc/images/tag_blue.png +0 -0
  51. data/doc/images/tag_green.png +0 -0
  52. data/doc/images/transparent.png +0 -0
  53. data/doc/images/wrench.png +0 -0
  54. data/doc/images/wrench_orange.png +0 -0
  55. data/doc/images/zoom.png +0 -0
  56. data/doc/index.html +639 -0
  57. data/doc/js/darkfish.js +155 -0
  58. data/doc/js/jquery.js +18 -0
  59. data/doc/js/navigation.js +142 -0
  60. data/doc/js/search.js +94 -0
  61. data/doc/js/search_index.js +1 -0
  62. data/doc/js/searcher.js +228 -0
  63. data/doc/rdoc.css +543 -0
  64. data/doc/table_of_contents.html +462 -0
  65. data/examples/empty.png +0 -0
  66. data/examples/minus.png +0 -0
  67. data/examples/plus.png +0 -0
  68. data/ext/ruby_prof/extconf.rb +7 -1
  69. data/ext/ruby_prof/rp_call_info.c +33 -24
  70. data/ext/ruby_prof/rp_call_info.h +2 -1
  71. data/ext/ruby_prof/rp_measure.c +1 -1
  72. data/ext/ruby_prof/rp_measure.h +1 -1
  73. data/ext/ruby_prof/rp_measure_allocations.c +1 -1
  74. data/ext/ruby_prof/rp_measure_cpu_time.c +1 -1
  75. data/ext/ruby_prof/rp_measure_gc_runs.c +1 -1
  76. data/ext/ruby_prof/rp_measure_gc_time.c +7 -11
  77. data/ext/ruby_prof/rp_measure_memory.c +1 -2
  78. data/ext/ruby_prof/rp_measure_process_time.c +2 -2
  79. data/ext/ruby_prof/rp_measure_wall_time.c +2 -2
  80. data/ext/ruby_prof/rp_method.c +11 -24
  81. data/ext/ruby_prof/rp_method.h +2 -3
  82. data/ext/ruby_prof/rp_stack.c +50 -14
  83. data/ext/ruby_prof/rp_stack.h +10 -10
  84. data/ext/ruby_prof/rp_thread.c +54 -29
  85. data/ext/ruby_prof/rp_thread.h +8 -7
  86. data/ext/ruby_prof/ruby_prof.c +35 -98
  87. data/ext/ruby_prof/ruby_prof.h +1 -1
  88. data/ext/ruby_prof/vc/ruby_prof.sln +12 -6
  89. data/ext/ruby_prof/vc/{ruby_prof.vcxproj → ruby_prof_19.vcxproj} +1 -0
  90. data/ext/ruby_prof/vc/ruby_prof_20.vcxproj +110 -0
  91. data/ext/ruby_prof/version.h +4 -4
  92. data/lib/ruby-prof/call_info.rb +1 -1
  93. data/lib/ruby-prof/call_info_visitor.rb +4 -2
  94. data/lib/ruby-prof/compatibility.rb +21 -6
  95. data/lib/ruby-prof/images/empty.png +0 -0
  96. data/lib/ruby-prof/images/minus.png +0 -0
  97. data/lib/ruby-prof/images/plus.png +0 -0
  98. data/lib/ruby-prof/method_info.rb +1 -1
  99. data/lib/ruby-prof/printers/call_info_printer.rb +3 -2
  100. data/lib/ruby-prof/printers/call_stack_printer.rb +10 -7
  101. data/lib/ruby-prof/printers/dot_printer.rb +2 -2
  102. data/lib/ruby-prof/printers/flat_printer.rb +5 -4
  103. data/lib/ruby-prof/printers/flat_printer_with_line_numbers.rb +2 -2
  104. data/lib/ruby-prof/printers/graph_html_printer.rb +16 -8
  105. data/lib/ruby-prof/printers/graph_printer.rb +17 -16
  106. data/lib/ruby-prof/profile.rb +1 -1
  107. data/lib/ruby-prof/rack.rb +1 -6
  108. data/lib/ruby-prof/task.rb +0 -0
  109. data/lib/ruby-prof/thread.rb +22 -0
  110. data/lib/ruby-prof.rb +1 -0
  111. data/ruby-prof.gemspec +5 -3
  112. data/test/aggregate_test.rb +0 -0
  113. data/test/basic_test.rb +77 -45
  114. data/test/call_info_test.rb +78 -0
  115. data/test/call_info_visitor_test.rb +1 -1
  116. data/test/duplicate_names_test.rb +0 -0
  117. data/test/dynamic_method_test.rb +21 -8
  118. data/test/enumerable_test.rb +0 -0
  119. data/test/exceptions_test.rb +0 -0
  120. data/test/exclude_threads_test.rb +0 -0
  121. data/test/exec_test.rb +0 -0
  122. data/test/fiber_test.rb +65 -0
  123. data/test/line_number_test.rb +0 -0
  124. data/test/measure_cpu_time_test.rb +23 -12
  125. data/test/measure_gc_runs_test.rb +4 -1
  126. data/test/measure_gc_time_test.rb +10 -3
  127. data/test/measure_memory_test.rb +3 -8
  128. data/test/measure_process_time_test.rb +27 -170
  129. data/test/measure_wall_time_test.rb +59 -13
  130. data/test/method_elimination_test.rb +31 -21
  131. data/test/module_test.rb +0 -0
  132. data/test/multi_printer_test.rb +9 -8
  133. data/test/no_method_class_test.rb +0 -0
  134. data/test/pause_resume_test.rb +125 -20
  135. data/test/prime.rb +1 -2
  136. data/test/printers_test.rb +10 -17
  137. data/test/recursive_test.rb +6 -50
  138. data/test/singleton_test.rb +0 -0
  139. data/test/stack_printer_test.rb +9 -6
  140. data/test/stack_test.rb +0 -0
  141. data/test/start_stop_test.rb +0 -0
  142. data/test/test_helper.rb +45 -11
  143. data/test/test_suite.rb +1 -2
  144. data/test/thread_test.rb +0 -0
  145. data/test/unique_call_path_test.rb +0 -0
  146. metadata +107 -12
  147. data/test/bug_test.rb +0 -6
  148. data/test/gc_test.rb +0 -35
  149. data/test/pause_test.rb +0 -57
  150. data/test/prime_test.rb +0 -13
data/CHANGES CHANGED
@@ -1,3 +1,34 @@
1
+ 0.12.2 (2013-02-13)
2
+ ======================
3
+ * Fixed segfault when using falcon or railsexpress patches for 1.9.3
4
+
5
+ 0.12.1 (2013-01-07)
6
+ ======================
7
+ * Add back in pause/resume support since Rails uses it
8
+
9
+ 0.12.0 (2013-01-06)
10
+ ======================
11
+ * Ruby 2.0.0 support (Charlie Savage)
12
+ * Fix issue where profiling results could exceed 100% if profile code had multiple top level methods (Charlie Savage)
13
+ * Replaced RubyProf::Thread#top_method with RubyProf::Thread#top_methods (Charlie Savage)
14
+ * Added RubyProf::Thread#total_time (Charlie Savage)
15
+ * Remove the -r and -e command line options. If you need specific libraries or code profiled then add them
16
+ to your code (Charlie Savage).
17
+ * Rewrite ruby-prof script to be more self-contained (Gary Weaver)
18
+ * Fix list formatting in readme (Thilo Rusche)
19
+ * Remove pause/resume support since its buggy and complicates the code
20
+
21
+ 0.11.3 (2012-12-27)
22
+ ======================
23
+ * Prefix c functions with prof_ to avoid name conflicts (Kenta Murata)
24
+ * Update ruby-prof script to avoid seg faults (Gary Weaver)
25
+ * Rakefile updates (Roger Pack)
26
+ * Fix regexp file reading (Gilbert Roulot)
27
+ * Update documentation (Timo Schilling)
28
+ * Fix up ruby warnings (Mike Gehard)
29
+ * Remove duplicate code (Chas Lemley)
30
+
31
+
1
32
  0.11.2 (2012-05-06)
2
33
  ======================
3
34
  * Fix compile issue with BOOL. Should be _Bool for C99.
data/README.rdoc CHANGED
@@ -15,7 +15,7 @@ ruby-prof is a fast code profiler for Ruby. Its features include:
15
15
 
16
16
  == Requirements
17
17
 
18
- ruby-prof requires Ruby 1.8.7 or 1.9.1 and higher.
18
+ ruby-prof requires Ruby 1.8.7 or 1.9.2 and higher.
19
19
 
20
20
  If you are running Linux or Unix you'll need a C compiler so the extension
21
21
  can be compiled when it is installed.
@@ -186,29 +186,29 @@ profile.rb.
186
186
  So to profile Rails:
187
187
 
188
188
  1. Create a new profile.rb environment. Make sure to turn on cache_classes
189
- and cache_template_loading. Otherwise your profiling results will be
190
- overwhelemed by the time Rails spends loading required files. You should
191
- likely turn off caching.
189
+ and cache_template_loading. Otherwise your profiling results will be
190
+ overwhelemed by the time Rails spends loading required files. You should
191
+ likely turn off caching.
192
192
 
193
193
  2. Add the ruby-prof to your gemfile:
194
194
 
195
- group :profile do
196
- gem 'ruby-prof'
197
- end
195
+ group :profile do
196
+ gem 'ruby-prof'
197
+ end
198
198
 
199
199
  3. Add the ruby prof rack adapter to your middleware stack. One way to
200
- do this is by adding the following code to config.ru:
200
+ do this is by adding the following code to config.ru:
201
201
 
202
- if Rails.env.profile?
203
- use Rack::RubyProf, :path => '/temp/profile'
204
- end
202
+ if Rails.env.profile?
203
+ use Rack::RubyProf, :path => '/temp/profile'
204
+ end
205
205
 
206
- The path is where you want profiling results to be stored. By default the
207
- rack adapter will generate a html call graph report and flat text report.
206
+ The path is where you want profiling results to be stored. By default the
207
+ rack adapter will generate a html call graph report and flat text report.
208
208
 
209
209
  4. Now make a request to your running server. New profiling information will
210
- be generated for each request. Note that each request will overwrite
211
- the profiling reports created by the previous request!
210
+ be generated for each request. Note that each request will overwrite
211
+ the profiling reports created by the previous request!
212
212
 
213
213
  == Reports
214
214
 
@@ -276,7 +276,7 @@ Reports are created by printers. Supported printers include:
276
276
  To use a printer:
277
277
 
278
278
  ...
279
- result = RubyProf.end
279
+ result = RubyProf.stop
280
280
  printer = RubyProf::GraphPrinter.new(result)
281
281
  printer.print(STDOUT, :min_percent => 2)
282
282
 
@@ -429,4 +429,4 @@ See LICENSE for license information.
429
429
 
430
430
  Code is located at http://github.com/rdp/ruby-prof
431
431
 
432
- Google group/mailing list: http://groups.google.com/group/ruby-optimization
432
+ Google group/mailing list: http://groups.google.com/group/ruby-optimization
data/Rakefile CHANGED
@@ -5,17 +5,28 @@ require "rake/extensiontask"
5
5
  require "rake/testtask"
6
6
  require "rdoc/task"
7
7
  require "date"
8
+ require "rake/clean"
9
+ begin
10
+ require "bundler/setup"
11
+ Bundler::GemHelper.install_tasks
12
+ [:build, :install, :release].each {|t| Rake::Task[t].enhance [:rdoc] }
13
+ rescue LoadError
14
+ $stderr.puts "Install bundler to get support for simplified gem publishing"
15
+ end
8
16
 
9
17
  # To release a version of ruby-prof:
10
18
  # * Update version.h
11
19
  # * Update CHANGES
12
- # * Update rdocs
13
- # * git commit to commit files
20
+ # * git commit to commit files
14
21
  # * rake clobber to remove extra files
15
22
  # * rake compile to build windows gems
16
23
  # * rake package to create the gems
17
- # * Tag the release in git (tag 0.10.1)
24
+ # * Tag the release (git tag 0.10.1)
18
25
  # * Push to ruybgems.org (gem push pkg/<gem files>)
26
+ # For a ruby only release, just run
27
+ # * rake release
28
+ # it will push changes to github, tag the release, build the package and upload it to rubygems.org
29
+ # and in case you forgot to increment the version number or have uncommitted changes, it will refuse to work
19
30
 
20
31
  GEM_NAME = 'ruby-prof'
21
32
  SO_NAME = 'ruby_prof'
@@ -37,6 +48,10 @@ Gem::PackageTask.new(default_spec) do |pkg|
37
48
  pkg.need_tar = true
38
49
  end
39
50
 
51
+ # make sure rdoc has been built when packaging
52
+ # why do we ship rdoc as part of the gem?
53
+ Rake::Task[:package].enhance [:rdoc]
54
+
40
55
  # Setup Windows Gem
41
56
  if RUBY_PLATFORM.match(/win32|mingw32/)
42
57
  # Windows specification
@@ -76,7 +91,15 @@ RDoc::Task.new("rdoc") do |rdoc|
76
91
  'LICENSE')
77
92
  end
78
93
 
79
- task :default => :package
94
+ task :default => :test
95
+
96
+ for file in Dir['**/*.{o,so,bundle}']
97
+ CLEAN.include file
98
+ end
99
+
100
+ for file in Dir['tmp/*.{txt,dat,png,html}']
101
+ CLEAN.include file
102
+ end
80
103
 
81
104
  desc 'Run the ruby-prof test suite'
82
105
  Rake::TestTask.new do |t|
@@ -84,4 +107,4 @@ Rake::TestTask.new do |t|
84
107
  t.test_files = Dir['test/test_suite.rb']
85
108
  t.verbose = true
86
109
  t.warning = true
87
- end
110
+ end