ruby-prof 0.13.1 → 0.14.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 (85) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +14 -0
  3. data/README.rdoc +1 -1
  4. data/Rakefile +2 -3
  5. data/bin/ruby-prof +4 -4
  6. data/bin/ruby-prof-check-trace +45 -0
  7. data/doc/LICENSE.html +49 -88
  8. data/doc/README_rdoc.html +92 -106
  9. data/doc/Rack.html +47 -116
  10. data/doc/Rack/RubyProf.html +119 -174
  11. data/doc/RubyProf.html +184 -216
  12. data/doc/RubyProf/AbstractPrinter.html +131 -162
  13. data/doc/RubyProf/AggregateCallInfo.html +136 -166
  14. data/doc/RubyProf/CallInfo.html +113 -154
  15. data/doc/RubyProf/CallInfoPrinter.html +56 -123
  16. data/doc/RubyProf/CallInfoVisitor.html +87 -216
  17. data/doc/RubyProf/CallStackPrinter.html +222 -215
  18. data/doc/RubyProf/CallTreePrinter.html +91 -142
  19. data/doc/RubyProf/Cmd.html +115 -157
  20. data/doc/RubyProf/DotPrinter.html +88 -140
  21. data/doc/RubyProf/FlatPrinter.html +66 -129
  22. data/doc/RubyProf/FlatPrinterWithLineNumbers.html +69 -132
  23. data/doc/RubyProf/GraphHtmlPrinter.html +115 -166
  24. data/doc/RubyProf/GraphPrinter.html +58 -125
  25. data/doc/RubyProf/MethodInfo.html +147 -172
  26. data/doc/RubyProf/MultiPrinter.html +104 -150
  27. data/doc/RubyProf/Profile.html +125 -179
  28. data/doc/RubyProf/ProfileTask.html +117 -157
  29. data/doc/RubyProf/Test.html +115 -154
  30. data/doc/RubyProf/Thread.html +87 -147
  31. data/doc/created.rid +13 -14
  32. data/doc/examples/flat_txt.html +51 -90
  33. data/doc/examples/graph_html.html +852 -0
  34. data/doc/examples/graph_txt.html +64 -92
  35. data/doc/fonts.css +167 -0
  36. data/doc/fonts/Lato-Light.ttf +0 -0
  37. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  38. data/doc/fonts/Lato-Regular.ttf +0 -0
  39. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  40. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  41. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  42. data/doc/images/add.png +0 -0
  43. data/doc/images/arrow_up.png +0 -0
  44. data/doc/images/delete.png +0 -0
  45. data/doc/images/tag_blue.png +0 -0
  46. data/doc/index.html +75 -65
  47. data/doc/js/darkfish.js +0 -15
  48. data/doc/js/search.js +20 -5
  49. data/doc/js/search_index.js +1 -1
  50. data/doc/rdoc.css +255 -218
  51. data/doc/table_of_contents.html +751 -353
  52. data/ext/ruby_prof/extconf.rb +20 -22
  53. data/ext/ruby_prof/rp_measure_allocations.c +9 -5
  54. data/ext/ruby_prof/rp_measure_gc_runs.c +8 -0
  55. data/ext/ruby_prof/rp_measure_gc_time.c +5 -2
  56. data/ext/ruby_prof/rp_measure_wall_time.c +1 -0
  57. data/ext/ruby_prof/rp_method.c +0 -9
  58. data/ext/ruby_prof/rp_method.h +1 -6
  59. data/ext/ruby_prof/ruby_prof.c +32 -112
  60. data/ext/ruby_prof/ruby_prof.h +9 -10
  61. data/lib/ruby-prof.rb +2 -1
  62. data/lib/ruby-prof/aggregate_call_info.rb +4 -6
  63. data/lib/ruby-prof/call_info_visitor.rb +42 -44
  64. data/lib/ruby-prof/printers/graph_html_printer.rb +0 -8
  65. data/lib/ruby-prof/profile.rb +4 -4
  66. data/lib/ruby-prof/rack.rb +47 -47
  67. data/lib/ruby-prof/task.rb +0 -0
  68. data/lib/ruby-prof/thread.rb +22 -22
  69. data/lib/ruby-prof/version.rb +3 -0
  70. data/ruby-prof.gemspec +7 -11
  71. data/test/call_info_test.rb +78 -78
  72. data/test/call_info_visitor_test.rb +31 -31
  73. data/test/fiber_test.rb +2 -2
  74. data/test/measure_gc_runs_test.rb +1 -1
  75. data/test/measure_process_time_test.rb +7 -6
  76. data/test/printers_test.rb +4 -8
  77. data/test/recursive_test.rb +5 -9
  78. data/test/test_helper.rb +1 -1
  79. data/test/unique_call_path_test.rb +7 -29
  80. data/test/yarv_test.rb +55 -0
  81. metadata +63 -55
  82. data/ext/ruby_prof/version.h +0 -7
  83. data/lib/ruby-prof/test.rb +0 -150
  84. data/test/exec_test.rb +0 -14
  85. data/test/test_suite.rb +0 -37
@@ -1,7 +0,0 @@
1
- /* Copyright (C) 2005-2013 Shugo Maeda <shugo@ruby-lang.org> and Charlie Savage <cfis@savagexi.com>
2
- Please see the LICENSE file for copyright and distribution information */
3
-
4
- #define RUBY_PROF_VERSION "0.13.1" // as a string, for easy parsing from rake files
5
- #define RUBY_PROF_VERSION_MAJ 0
6
- #define RUBY_PROF_VERSION_MIN 13
7
- #define RUBY_PROF_VERSION_MIC 1
@@ -1,150 +0,0 @@
1
- # encoding: utf-8
2
-
3
- # Now load ruby-prof and away we go
4
- require 'fileutils'
5
- require 'ruby-prof'
6
- require 'benchmark'
7
-
8
- module RubyProf
9
- module Test
10
- PROFILE_OPTIONS = {
11
- :measure_modes => [RubyProf::PROCESS_TIME],
12
- :count => 10,
13
- :printers => [RubyProf::FlatPrinter, RubyProf::GraphHtmlPrinter],
14
- :min_percent => 0.05,
15
- :output_dir => Dir.pwd }
16
-
17
- def output_dir
18
- PROFILE_OPTIONS[:output_dir]
19
- end
20
-
21
- def run(result)
22
- return if @method_name.to_s == "default_test"
23
-
24
- yield(self.class::STARTED, name)
25
- @_result = result
26
- run_warmup
27
- PROFILE_OPTIONS[:measure_modes].each do |measure_mode|
28
- data = run_profile(measure_mode)
29
- report_profile(data, measure_mode)
30
- result.add_run
31
- end
32
- yield(self.class::FINISHED, name)
33
- end
34
-
35
- def run_test
36
- begin
37
- setup
38
- yield
39
- rescue ::Test::Unit::AssertionFailedError => e
40
- add_failure(e.message, e.backtrace)
41
- rescue StandardError, ScriptError
42
- add_error($!)
43
- ensure
44
- begin
45
- teardown
46
- rescue ::Test::Unit::AssertionFailedError => e
47
- add_failure(e.message, e.backtrace)
48
- rescue StandardError, ScriptError
49
- add_error($!)
50
- end
51
- end
52
- end
53
-
54
- def run_warmup
55
- print "\n#{self.class.name}##{method_name}"
56
-
57
- run_test do
58
- bench = Benchmark.realtime do
59
- __send__(@method_name)
60
- end
61
- puts " (%.2fs warmup)" % bench
62
- end
63
- end
64
-
65
- def run_profile(measure_mode)
66
- RubyProf.measure_mode = measure_mode
67
-
68
- print ' '
69
- PROFILE_OPTIONS[:count].times do |i|
70
- run_test do
71
- begin
72
- print '.'
73
- $stdout.flush
74
- GC.disable
75
-
76
- RubyProf.resume do
77
- __send__(@method_name)
78
- end
79
- ensure
80
- GC.enable
81
- end
82
- end
83
- end
84
-
85
- data = RubyProf.stop
86
- bench = data.threads.values.inject(0) do |total, method_infos|
87
- top = method_infos.max
88
- total += top.total_time
89
- total
90
- end
91
-
92
- puts "\n #{measure_mode_name(measure_mode)}: #{format_profile_total(bench, measure_mode)}\n"
93
-
94
- data
95
- end
96
-
97
- def format_profile_total(total, measure_mode)
98
- case measure_mode
99
- when RubyProf::PROCESS_TIME, RubyProf::WALL_TIME
100
- "%.2f seconds" % total
101
- when RubyProf::MEMORY
102
- "%.2f kilobytes" % total
103
- when RubyProf::ALLOCATIONS
104
- "%d allocations" % total
105
- else
106
- "%.2f #{measure_mode}"
107
- end
108
- end
109
-
110
- def report_profile(data, measure_mode)
111
- PROFILE_OPTIONS[:printers].each do |printer_klass|
112
- printer = printer_klass.new(data)
113
-
114
- # Makes sure the output directory exits
115
- FileUtils.mkdir_p(output_dir)
116
-
117
- # Open the file
118
- file_name = report_filename(printer, measure_mode)
119
-
120
- File.open(file_name, 'wb') do |file|
121
- printer.print(file, PROFILE_OPTIONS)
122
- end
123
- end
124
- end
125
-
126
- # The report filename is test_name + measure_mode + report_type
127
- def report_filename(printer, measure_mode)
128
- suffix =
129
- case printer
130
- when RubyProf::FlatPrinter; 'flat.txt'
131
- when RubyProf::GraphPrinter; 'graph.txt'
132
- when RubyProf::GraphHtmlPrinter; 'graph.html'
133
- when RubyProf::CallTreePrinter; 'tree.txt'
134
- else printer.to_s.downcase
135
- end
136
-
137
- "#{output_dir}/#{method_name}_#{measure_mode_name(measure_mode)}_#{suffix}"
138
- end
139
-
140
- def measure_mode_name(measure_mode)
141
- case measure_mode
142
- when RubyProf::PROCESS_TIME; 'process_time'
143
- when RubyProf::WALL_TIME; 'wall_time'
144
- when RubyProf::MEMORY; 'memory'
145
- when RubyProf::ALLOCATIONS; 'allocations'
146
- else "measure#{measure_mode}"
147
- end
148
- end
149
- end
150
- end
data/test/exec_test.rb DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: UTF-8
3
-
4
- require File.expand_path('../test_helper', __FILE__)
5
-
6
- # -- Test for bug when it loads with no frames
7
-
8
- class ExecTest < Test::Unit::TestCase
9
- def test_being_able_to_run_its_binary
10
- Dir.chdir(File.dirname(__FILE__)) do
11
- assert system(OS.ruby_bin + " ruby-prof-bin do_nothing.rb")
12
- end
13
- end
14
- end
data/test/test_suite.rb DELETED
@@ -1,37 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require File.expand_path("../test_helper", __FILE__)
4
-
5
- %w(aggregate_test
6
- basic_test
7
- call_info_visitor_test
8
- duplicate_names_test
9
- dynamic_method_test
10
- enumerable_test
11
- exceptions_test
12
- exclude_threads_test
13
- line_number_test
14
-
15
- measure_allocations_test
16
- measure_cpu_time_test
17
- measure_gc_runs_test
18
- measure_gc_time_test
19
- measure_memory_test
20
- measure_process_time_test
21
- measure_wall_time_test
22
-
23
- method_elimination_test
24
- module_test
25
- multi_printer_test
26
- no_method_class_test
27
- pause_resume_test
28
- printers_test
29
- recursive_test
30
- singleton_test
31
- stack_test
32
- stack_printer_test
33
- start_stop_test
34
- thread_test
35
- unique_call_path_test).each do |test|
36
- require File.expand_path("../#{test}", __FILE__)
37
- end