ruby-prof 1.7.0 → 2.0.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 (134) hide show
  1. checksums.yaml +4 -4
  2. data/{CHANGES → CHANGELOG.md} +120 -174
  3. data/README.md +5 -5
  4. data/bin/ruby-prof +1 -4
  5. data/docs/advanced-usage.md +132 -0
  6. data/docs/alternatives.md +98 -0
  7. data/docs/architecture.md +122 -0
  8. data/docs/best-practices.md +27 -0
  9. data/docs/getting-started.md +130 -0
  10. data/docs/history.md +11 -0
  11. data/docs/index.md +45 -0
  12. data/docs/profiling-rails.md +64 -0
  13. data/docs/public/examples/example.rb +33 -0
  14. data/docs/public/examples/generate_reports.rb +92 -0
  15. data/docs/public/examples/reports/call_info.txt +27 -0
  16. data/docs/public/examples/reports/call_stack.html +835 -0
  17. data/docs/public/examples/reports/callgrind.out +150 -0
  18. data/docs/public/examples/reports/flame_graph.html +408 -0
  19. data/docs/public/examples/reports/flat.txt +45 -0
  20. data/docs/public/examples/reports/graph.dot +129 -0
  21. data/docs/public/examples/reports/graph.html +1319 -0
  22. data/docs/public/examples/reports/graph.txt +100 -0
  23. data/docs/public/examples/reports/graphviz_viewer.html +1 -0
  24. data/docs/public/images/call_stack.png +0 -0
  25. data/docs/public/images/class_diagram.png +0 -0
  26. data/docs/public/images/dot_printer.png +0 -0
  27. data/docs/public/images/flame_graph.png +0 -0
  28. data/docs/public/images/flat.png +0 -0
  29. data/docs/public/images/graph.png +0 -0
  30. data/docs/public/images/graph_html.png +0 -0
  31. data/docs/public/images/ruby-prof-logo.svg +1 -0
  32. data/docs/reports.md +150 -0
  33. data/docs/stylesheets/extra.css +80 -0
  34. data/ext/ruby_prof/extconf.rb +23 -22
  35. data/ext/ruby_prof/rp_allocation.c +0 -15
  36. data/ext/ruby_prof/rp_allocation.h +29 -33
  37. data/ext/ruby_prof/rp_call_tree.c +3 -0
  38. data/ext/ruby_prof/rp_call_tree.h +1 -4
  39. data/ext/ruby_prof/rp_call_trees.c +296 -296
  40. data/ext/ruby_prof/rp_call_trees.h +25 -28
  41. data/ext/ruby_prof/rp_measure_allocations.c +47 -47
  42. data/ext/ruby_prof/rp_measure_process_time.c +64 -66
  43. data/ext/ruby_prof/rp_measure_wall_time.c +52 -64
  44. data/ext/ruby_prof/rp_measurement.c +0 -5
  45. data/ext/ruby_prof/rp_measurement.h +49 -53
  46. data/ext/ruby_prof/rp_method.c +554 -562
  47. data/ext/ruby_prof/rp_method.h +1 -4
  48. data/ext/ruby_prof/rp_profile.c +1 -1
  49. data/ext/ruby_prof/rp_profile.h +1 -5
  50. data/ext/ruby_prof/rp_stack.c +212 -212
  51. data/ext/ruby_prof/rp_stack.h +50 -53
  52. data/ext/ruby_prof/rp_thread.h +1 -4
  53. data/ext/ruby_prof/ruby_prof.c +50 -50
  54. data/ext/ruby_prof/ruby_prof.h +4 -6
  55. data/ext/ruby_prof/vc/ruby_prof.vcxproj +7 -8
  56. data/lib/ruby-prof/assets/call_stack_printer.html.erb +746 -711
  57. data/lib/ruby-prof/assets/flame_graph_printer.html.erb +412 -0
  58. data/lib/ruby-prof/assets/graph_printer.html.erb +355 -355
  59. data/lib/ruby-prof/call_tree.rb +57 -57
  60. data/lib/ruby-prof/call_tree_visitor.rb +36 -36
  61. data/lib/ruby-prof/exclude_common_methods.rb +204 -204
  62. data/lib/ruby-prof/measurement.rb +17 -17
  63. data/lib/ruby-prof/printers/abstract_printer.rb +142 -138
  64. data/lib/ruby-prof/printers/call_info_printer.rb +53 -53
  65. data/lib/ruby-prof/printers/call_stack_printer.rb +168 -180
  66. data/lib/ruby-prof/printers/call_tree_printer.rb +132 -145
  67. data/lib/ruby-prof/printers/dot_printer.rb +177 -132
  68. data/lib/ruby-prof/printers/flame_graph_printer.rb +79 -0
  69. data/lib/ruby-prof/printers/flat_printer.rb +52 -52
  70. data/lib/ruby-prof/printers/graph_html_printer.rb +62 -63
  71. data/lib/ruby-prof/printers/graph_printer.rb +112 -113
  72. data/lib/ruby-prof/printers/multi_printer.rb +134 -127
  73. data/lib/ruby-prof/profile.rb +13 -0
  74. data/lib/ruby-prof/rack.rb +114 -105
  75. data/lib/ruby-prof/task.rb +147 -147
  76. data/lib/ruby-prof/thread.rb +20 -20
  77. data/lib/ruby-prof/version.rb +3 -3
  78. data/lib/ruby-prof.rb +50 -52
  79. data/lib/unprof.rb +10 -10
  80. data/ruby-prof.gemspec +66 -64
  81. data/test/abstract_printer_test.rb +25 -27
  82. data/test/alias_test.rb +203 -117
  83. data/test/call_tree_builder.rb +126 -126
  84. data/test/call_tree_visitor_test.rb +27 -27
  85. data/test/call_trees_test.rb +66 -66
  86. data/test/duplicate_names_test.rb +32 -32
  87. data/test/dynamic_method_test.rb +50 -62
  88. data/test/enumerable_test.rb +23 -21
  89. data/test/exceptions_test.rb +24 -24
  90. data/test/exclude_methods_test.rb +363 -257
  91. data/test/exclude_threads_test.rb +48 -48
  92. data/test/fiber_test.rb +195 -195
  93. data/test/gc_test.rb +104 -102
  94. data/test/inverse_call_tree_test.rb +174 -174
  95. data/test/line_number_test.rb +563 -289
  96. data/test/marshal_test.rb +144 -145
  97. data/test/measure_allocations.rb +26 -26
  98. data/test/measure_allocations_test.rb +1511 -1081
  99. data/test/measure_process_time_test.rb +3286 -2477
  100. data/test/measure_times.rb +56 -56
  101. data/test/measure_wall_time_test.rb +773 -568
  102. data/test/measurement_test.rb +82 -82
  103. data/test/merge_test.rb +146 -146
  104. data/test/method_info_test.rb +100 -95
  105. data/test/multi_printer_test.rb +52 -66
  106. data/test/no_method_class_test.rb +15 -15
  107. data/test/pause_resume_test.rb +171 -171
  108. data/test/prime.rb +54 -54
  109. data/test/prime_script.rb +5 -5
  110. data/test/printer_call_stack_test.rb +28 -27
  111. data/test/printer_call_tree_test.rb +30 -30
  112. data/test/printer_flame_graph_test.rb +82 -0
  113. data/test/printer_flat_test.rb +99 -99
  114. data/test/printer_graph_html_test.rb +62 -59
  115. data/test/printer_graph_test.rb +42 -40
  116. data/test/printers_test.rb +162 -135
  117. data/test/printing_recursive_graph_test.rb +81 -81
  118. data/test/profile_test.rb +101 -101
  119. data/test/rack_test.rb +103 -93
  120. data/test/recursive_test.rb +796 -622
  121. data/test/scheduler.rb +4 -0
  122. data/test/singleton_test.rb +39 -38
  123. data/test/stack_printer_test.rb +61 -61
  124. data/test/start_stop_test.rb +106 -106
  125. data/test/test_helper.rb +24 -20
  126. data/test/thread_test.rb +229 -231
  127. data/test/unique_call_path_test.rb +123 -136
  128. data/test/yarv_test.rb +56 -60
  129. metadata +81 -15
  130. data/ext/ruby_prof/rp_measure_memory.c +0 -46
  131. data/lib/ruby-prof/compatibility.rb +0 -113
  132. data/test/compatibility_test.rb +0 -49
  133. data/test/crash2.rb +0 -144
  134. data/test/measure_memory_test.rb +0 -1456
@@ -1,136 +1,123 @@
1
- #!/usr/bin/env ruby
2
- # encoding: UTF-8
3
-
4
- require File.expand_path('../test_helper', __FILE__)
5
-
6
- class UniqueCallPath
7
- def method_a(i)
8
- if i==1
9
- method_b
10
- else
11
- method_c
12
- end
13
- end
14
-
15
- def method_b
16
- method_c
17
- end
18
-
19
- def method_c
20
- end
21
-
22
- def method_k(i)
23
- method_a(i)
24
- end
25
- end
26
-
27
-
28
- # -- Tests ----
29
- class UniqueCallPathTest < TestCase
30
- def test_root
31
- unique_call_path = UniqueCallPath.new
32
-
33
- result = RubyProf::Profile.profile do
34
- unique_call_path.method_a(1)
35
- end
36
-
37
- root_call_info = result.threads.first.call_tree
38
- assert_equal("UniqueCallPathTest#test_root", root_call_info.target.full_name)
39
- end
40
-
41
- def test_root_children
42
- unique_call_path = UniqueCallPath.new
43
-
44
- result = RubyProf::Profile.profile do
45
- unique_call_path.method_a(1)
46
- unique_call_path.method_k(2)
47
- end
48
-
49
- root_call_info = result.threads.first.call_tree
50
- children = root_call_info.children.sort do |c1, c2|
51
- c1.target.full_name <=> c2.target.full_name
52
- end
53
-
54
- assert_equal(2, children.length)
55
- assert_equal("UniqueCallPath#method_a", children[0].target.full_name)
56
- assert_equal("UniqueCallPath#method_k", children[1].target.full_name)
57
- end
58
-
59
- def test_children_of
60
- unique_call_path = UniqueCallPath.new
61
-
62
- result = RubyProf::Profile.profile do
63
- unique_call_path.method_a(1)
64
- unique_call_path.method_k(2)
65
- end
66
-
67
- root_call_info = result.threads.first.call_tree
68
- assert_equal("UniqueCallPathTest#test_children_of", root_call_info.target.full_name)
69
-
70
- call_info_a = root_call_info.children.detect do |call_tree|
71
- call_tree.target.full_name == "UniqueCallPath#method_a"
72
- end
73
- refute_nil(call_info_a)
74
-
75
- _children_of_a = call_info_a.children.inject(Array.new) do |array, c|
76
- if c.parent.eql?(call_info_a)
77
- array << c
78
- end
79
- array
80
- end
81
-
82
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
83
- assert_equal(1, call_info_a.children.length)
84
- assert_equal("UniqueCallPath#method_b", call_info_a.children[0].target.full_name)
85
- else
86
- assert_equal(2, call_info_a.children.length)
87
- assert_equal("Integer#==", call_info_a.children[0].target.full_name)
88
- assert_equal("UniqueCallPath#method_b", call_info_a.children[1].target.full_name)
89
- end
90
- end
91
-
92
- def test_unique_path
93
- unique_call_path = UniqueCallPath.new
94
-
95
- result = RubyProf::Profile.profile do
96
- unique_call_path.method_a(1)
97
- unique_call_path.method_k(1)
98
- end
99
-
100
- root_call_info = result.threads.first.call_tree
101
- assert_equal("UniqueCallPathTest#test_unique_path", root_call_info.target.full_name)
102
-
103
- call_info_a = root_call_info.children.detect do |call_tree|
104
- call_tree.target.full_name == "UniqueCallPath#method_a"
105
- end
106
- refute_nil(call_info_a)
107
-
108
- children_of_a = call_info_a.children.reduce(Array.new) do |array, c|
109
- if c.parent.eql?(call_info_a)
110
- array << c
111
- end
112
- array
113
- end
114
-
115
- children_of_a = children_of_a.sort do |c1, c2|
116
- c1.target.full_name <=> c2.target.full_name
117
- end
118
-
119
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
120
- assert_equal(1, call_info_a.children.length)
121
- assert_equal(1, children_of_a.length)
122
-
123
- assert_equal(1, children_of_a[0].called)
124
- assert_equal("UniqueCallPath#method_b", children_of_a[0].target.full_name)
125
- else
126
- assert_equal(2, call_info_a.children.length)
127
- assert_equal(2, children_of_a.length)
128
-
129
- assert_equal(1, children_of_a[0].called)
130
- assert_equal("Integer#==", children_of_a[0].target.full_name)
131
-
132
- assert_equal(1, children_of_a[1].called)
133
- assert_equal("UniqueCallPath#method_b", children_of_a[1].target.full_name)
134
- end
135
- end
136
- end
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ require File.expand_path('../test_helper', __FILE__)
5
+
6
+ class UniqueCallPath
7
+ def method_a(i)
8
+ if i==1
9
+ method_b
10
+ else
11
+ method_c
12
+ end
13
+ end
14
+
15
+ def method_b
16
+ method_c
17
+ end
18
+
19
+ def method_c
20
+ end
21
+
22
+ def method_k(i)
23
+ method_a(i)
24
+ end
25
+ end
26
+
27
+
28
+ # -- Tests ----
29
+ class UniqueCallPathTest < TestCase
30
+ def test_root
31
+ unique_call_path = UniqueCallPath.new
32
+
33
+ result = RubyProf::Profile.profile do
34
+ unique_call_path.method_a(1)
35
+ end
36
+
37
+ root_call_info = result.threads.first.call_tree
38
+ assert_equal("UniqueCallPathTest#test_root", root_call_info.target.full_name)
39
+ end
40
+
41
+ def test_root_children
42
+ unique_call_path = UniqueCallPath.new
43
+
44
+ result = RubyProf::Profile.profile do
45
+ unique_call_path.method_a(1)
46
+ unique_call_path.method_k(2)
47
+ end
48
+
49
+ root_call_info = result.threads.first.call_tree
50
+ children = root_call_info.children.sort do |c1, c2|
51
+ c1.target.full_name <=> c2.target.full_name
52
+ end
53
+
54
+ assert_equal(2, children.length)
55
+ assert_equal("UniqueCallPath#method_a", children[0].target.full_name)
56
+ assert_equal("UniqueCallPath#method_k", children[1].target.full_name)
57
+ end
58
+
59
+ def test_children_of
60
+ unique_call_path = UniqueCallPath.new
61
+
62
+ result = RubyProf::Profile.profile do
63
+ unique_call_path.method_a(1)
64
+ unique_call_path.method_k(2)
65
+ end
66
+
67
+ root_call_info = result.threads.first.call_tree
68
+ assert_equal("UniqueCallPathTest#test_children_of", root_call_info.target.full_name)
69
+
70
+ call_info_a = root_call_info.children.detect do |call_tree|
71
+ call_tree.target.full_name == "UniqueCallPath#method_a"
72
+ end
73
+ refute_nil(call_info_a)
74
+
75
+ _children_of_a = call_info_a.children.inject(Array.new) do |array, c|
76
+ if c.parent.eql?(call_info_a)
77
+ array << c
78
+ end
79
+ array
80
+ end
81
+
82
+ assert_equal(2, call_info_a.children.length)
83
+ assert_equal("Integer#==", call_info_a.children[0].target.full_name)
84
+ assert_equal("UniqueCallPath#method_b", call_info_a.children[1].target.full_name)
85
+ end
86
+
87
+ def test_unique_path
88
+ unique_call_path = UniqueCallPath.new
89
+
90
+ result = RubyProf::Profile.profile do
91
+ unique_call_path.method_a(1)
92
+ unique_call_path.method_k(1)
93
+ end
94
+
95
+ root_call_info = result.threads.first.call_tree
96
+ assert_equal("UniqueCallPathTest#test_unique_path", root_call_info.target.full_name)
97
+
98
+ call_info_a = root_call_info.children.detect do |call_tree|
99
+ call_tree.target.full_name == "UniqueCallPath#method_a"
100
+ end
101
+ refute_nil(call_info_a)
102
+
103
+ children_of_a = call_info_a.children.reduce(Array.new) do |array, c|
104
+ if c.parent.eql?(call_info_a)
105
+ array << c
106
+ end
107
+ array
108
+ end
109
+
110
+ children_of_a = children_of_a.sort do |c1, c2|
111
+ c1.target.full_name <=> c2.target.full_name
112
+ end
113
+
114
+ assert_equal(2, call_info_a.children.length)
115
+ assert_equal(2, children_of_a.length)
116
+
117
+ assert_equal(1, children_of_a[0].called)
118
+ assert_equal("Integer#==", children_of_a[0].target.full_name)
119
+
120
+ assert_equal(1, children_of_a[1].called)
121
+ assert_equal("UniqueCallPath#method_b", children_of_a[1].target.full_name)
122
+ end
123
+ end
data/test/yarv_test.rb CHANGED
@@ -1,60 +1,56 @@
1
- #!/usr/bin/env ruby
2
- # encoding: UTF-8
3
-
4
- require File.expand_path('../test_helper', __FILE__)
5
-
6
- # tests for bugs reported by users
7
- class YarvTest < TestCase
8
- def setup
9
- super
10
- define_methods
11
- end
12
-
13
- def test_array_push_unoptimized
14
- a = nil
15
- result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) do
16
- a = self.array_push_unoptimized
17
- end
18
- assert_equal 2, a.length
19
- assert_equal ["YarvTest#test_array_push_unoptimized", "YarvTest#array_push_unoptimized", 'Array#<<', "Array#push"], result.threads.first.methods.map(&:full_name)
20
- end
21
-
22
- def test_array_push_optimized
23
- a = nil
24
- result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) do
25
- a = self.array_push_optimized
26
- end
27
- assert_equal(2, a.length)
28
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3.1')
29
- assert_equal(["YarvTest#test_array_push_optimized", "YarvTest#array_push_optimized", "Array#push"], result.threads.first.methods.map(&:full_name))
30
- else
31
- assert_equal(["YarvTest#test_array_push_optimized", "YarvTest#array_push_optimized", "Array#<<", "Array#push"], result.threads.first.methods.map(&:full_name))
32
- end
33
- end
34
-
35
- private
36
-
37
- def define_methods
38
- return if respond_to?(:array_push_optimized)
39
- old_compile_option = RubyVM::InstructionSequence.compile_option
40
- RubyVM::InstructionSequence.compile_option = {
41
- :trace_instruction => true,
42
- :specialized_instruction => false
43
- }
44
- self.class.class_eval <<-"EOM"
45
- def array_push_unoptimized
46
- a = []
47
- a << 1
48
- a.push 2
49
- end
50
- EOM
51
- RubyVM::InstructionSequence.compile_option = old_compile_option
52
- self.class.class_eval <<-"EOM"
53
- def array_push_optimized
54
- a = []
55
- a << 1
56
- a.push 2
57
- end
58
- EOM
59
- end
60
- end
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ require File.expand_path('../test_helper', __FILE__)
5
+
6
+ # tests for bugs reported by users
7
+ class YarvTest < TestCase
8
+ def setup
9
+ super
10
+ define_methods
11
+ end
12
+
13
+ def test_array_push_unoptimized
14
+ a = nil
15
+ result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) do
16
+ a = self.array_push_unoptimized
17
+ end
18
+ assert_equal 2, a.length
19
+ assert_equal ["YarvTest#test_array_push_unoptimized", "YarvTest#array_push_unoptimized", 'Array#<<', "Array#push"], result.threads.first.methods.map(&:full_name)
20
+ end
21
+
22
+ def test_array_push_optimized
23
+ a = nil
24
+ result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) do
25
+ a = self.array_push_optimized
26
+ end
27
+ assert_equal(2, a.length)
28
+ assert_equal(["YarvTest#test_array_push_optimized", "YarvTest#array_push_optimized", "Array#<<", "Array#push"], result.threads.first.methods.map(&:full_name))
29
+ end
30
+
31
+ private
32
+
33
+ def define_methods
34
+ return if respond_to?(:array_push_optimized)
35
+ old_compile_option = RubyVM::InstructionSequence.compile_option
36
+ RubyVM::InstructionSequence.compile_option = {
37
+ trace_instruction: true,
38
+ specialized_instruction: false
39
+ }
40
+ self.class.class_eval <<-"EOM"
41
+ def array_push_unoptimized
42
+ a = []
43
+ a << 1
44
+ a.push 2
45
+ end
46
+ EOM
47
+ RubyVM::InstructionSequence.compile_option = old_compile_option
48
+ self.class.class_eval <<-"EOM"
49
+ def array_push_optimized
50
+ a = []
51
+ a << 1
52
+ a.push 2
53
+ end
54
+ EOM
55
+ end
56
+ end
metadata CHANGED
@@ -1,15 +1,42 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-prof
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shugo Maeda, Charlie Savage, Roger Pack, Stefan Kaes
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-01-07 00:00:00.000000000 Z
10
+ date: 2026-02-13 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: base64
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: ostruct
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
13
40
  - !ruby/object:Gem::Dependency
14
41
  name: minitest
15
42
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +65,20 @@ dependencies:
38
65
  - - ">="
39
66
  - !ruby/object:Gem::Version
40
67
  version: '0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: rdoc
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
41
82
  description: |
42
83
  ruby-prof is a fast code profiler for Ruby. It is a C extension and
43
84
  therefore is many times faster than the standard Ruby profiler. It
@@ -53,12 +94,41 @@ extensions:
53
94
  - ext/ruby_prof/extconf.rb
54
95
  extra_rdoc_files: []
55
96
  files:
56
- - CHANGES
97
+ - CHANGELOG.md
57
98
  - LICENSE
58
99
  - README.md
59
100
  - Rakefile
60
101
  - bin/ruby-prof
61
102
  - bin/ruby-prof-check-trace
103
+ - docs/advanced-usage.md
104
+ - docs/alternatives.md
105
+ - docs/architecture.md
106
+ - docs/best-practices.md
107
+ - docs/getting-started.md
108
+ - docs/history.md
109
+ - docs/index.md
110
+ - docs/profiling-rails.md
111
+ - docs/public/examples/example.rb
112
+ - docs/public/examples/generate_reports.rb
113
+ - docs/public/examples/reports/call_info.txt
114
+ - docs/public/examples/reports/call_stack.html
115
+ - docs/public/examples/reports/callgrind.out
116
+ - docs/public/examples/reports/flame_graph.html
117
+ - docs/public/examples/reports/flat.txt
118
+ - docs/public/examples/reports/graph.dot
119
+ - docs/public/examples/reports/graph.html
120
+ - docs/public/examples/reports/graph.txt
121
+ - docs/public/examples/reports/graphviz_viewer.html
122
+ - docs/public/images/call_stack.png
123
+ - docs/public/images/class_diagram.png
124
+ - docs/public/images/dot_printer.png
125
+ - docs/public/images/flame_graph.png
126
+ - docs/public/images/flat.png
127
+ - docs/public/images/graph.png
128
+ - docs/public/images/graph_html.png
129
+ - docs/public/images/ruby-prof-logo.svg
130
+ - docs/reports.md
131
+ - docs/stylesheets/extra.css
62
132
  - ext/ruby_prof/extconf.rb
63
133
  - ext/ruby_prof/rp_allocation.c
64
134
  - ext/ruby_prof/rp_allocation.h
@@ -67,7 +137,6 @@ files:
67
137
  - ext/ruby_prof/rp_call_trees.c
68
138
  - ext/ruby_prof/rp_call_trees.h
69
139
  - ext/ruby_prof/rp_measure_allocations.c
70
- - ext/ruby_prof/rp_measure_memory.c
71
140
  - ext/ruby_prof/rp_measure_process_time.c
72
141
  - ext/ruby_prof/rp_measure_wall_time.c
73
142
  - ext/ruby_prof/rp_measurement.c
@@ -87,10 +156,10 @@ files:
87
156
  - lib/ruby-prof.rb
88
157
  - lib/ruby-prof/assets/call_stack_printer.html.erb
89
158
  - lib/ruby-prof/assets/call_stack_printer.png
159
+ - lib/ruby-prof/assets/flame_graph_printer.html.erb
90
160
  - lib/ruby-prof/assets/graph_printer.html.erb
91
161
  - lib/ruby-prof/call_tree.rb
92
162
  - lib/ruby-prof/call_tree_visitor.rb
93
- - lib/ruby-prof/compatibility.rb
94
163
  - lib/ruby-prof/exclude_common_methods.rb
95
164
  - lib/ruby-prof/measurement.rb
96
165
  - lib/ruby-prof/method_info.rb
@@ -99,6 +168,7 @@ files:
99
168
  - lib/ruby-prof/printers/call_stack_printer.rb
100
169
  - lib/ruby-prof/printers/call_tree_printer.rb
101
170
  - lib/ruby-prof/printers/dot_printer.rb
171
+ - lib/ruby-prof/printers/flame_graph_printer.rb
102
172
  - lib/ruby-prof/printers/flat_printer.rb
103
173
  - lib/ruby-prof/printers/graph_html_printer.rb
104
174
  - lib/ruby-prof/printers/graph_printer.rb
@@ -116,8 +186,6 @@ files:
116
186
  - test/call_tree_test.rb
117
187
  - test/call_tree_visitor_test.rb
118
188
  - test/call_trees_test.rb
119
- - test/compatibility_test.rb
120
- - test/crash2.rb
121
189
  - test/duplicate_names_test.rb
122
190
  - test/dynamic_method_test.rb
123
191
  - test/enumerable_test.rb
@@ -131,7 +199,6 @@ files:
131
199
  - test/marshal_test.rb
132
200
  - test/measure_allocations.rb
133
201
  - test/measure_allocations_test.rb
134
- - test/measure_memory_test.rb
135
202
  - test/measure_process_time_test.rb
136
203
  - test/measure_times.rb
137
204
  - test/measure_wall_time_test.rb
@@ -145,6 +212,7 @@ files:
145
212
  - test/prime_script.rb
146
213
  - test/printer_call_stack_test.rb
147
214
  - test/printer_call_tree_test.rb
215
+ - test/printer_flame_graph_test.rb
148
216
  - test/printer_flat_test.rb
149
217
  - test/printer_graph_html_test.rb
150
218
  - test/printer_graph_test.rb
@@ -166,10 +234,9 @@ licenses:
166
234
  - BSD-2-Clause
167
235
  metadata:
168
236
  bug_tracker_uri: https://github.com/ruby-prof/ruby-prof/issues
169
- changelog_uri: https://github.com/ruby-prof/ruby-prof/blob/master/CHANGES
237
+ changelog_uri: https://github.com/ruby-prof/ruby-prof/blob/master/CHANGELOG.md
170
238
  documentation_uri: https://ruby-prof.github.io/
171
- source_code_uri: https://github.com/ruby-prof/ruby-prof/tree/v1.7.0
172
- post_install_message:
239
+ source_code_uri: https://github.com/ruby-prof/ruby-prof/tree/v2.0.0
173
240
  rdoc_options: []
174
241
  require_paths:
175
242
  - lib
@@ -177,15 +244,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
244
  requirements:
178
245
  - - ">="
179
246
  - !ruby/object:Gem::Version
180
- version: 3.0.0
247
+ version: 3.2.0
181
248
  required_rubygems_version: !ruby/object:Gem::Requirement
182
249
  requirements:
183
250
  - - ">="
184
251
  - !ruby/object:Gem::Version
185
252
  version: '0'
186
253
  requirements: []
187
- rubygems_version: 3.5.3
188
- signing_key:
254
+ rubygems_version: 4.0.6
189
255
  specification_version: 4
190
256
  summary: Fast Ruby profiler
191
257
  test_files:
@@ -1,46 +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
- /* :nodoc: */
5
-
6
- #include "rp_measurement.h"
7
-
8
- static VALUE cMeasureMemory;
9
-
10
- static double measure_memory(rb_trace_arg_t* trace_arg)
11
- {
12
- static double result = 0;
13
-
14
- if (trace_arg)
15
- {
16
- // Only process creation of new objects
17
- rb_event_flag_t event = rb_tracearg_event_flag(trace_arg);
18
- if (event == RUBY_INTERNAL_EVENT_NEWOBJ)
19
- {
20
- // Don't count allocations of internal IMemo objects
21
- VALUE object = rb_tracearg_object(trace_arg);
22
- if (BUILTIN_TYPE(object) != T_IMEMO)
23
- result += rb_obj_memsize_of(object);
24
- }
25
- }
26
-
27
- return result;
28
- }
29
-
30
- prof_measurer_t* prof_measurer_memory(bool track_allocations)
31
- {
32
- prof_measurer_t* measure = ALLOC(prof_measurer_t);
33
- measure->mode = MEASURE_MEMORY;
34
- measure->measure = measure_memory;
35
- measure->multiplier = 1;
36
- // Need to track allocations to get RUBY_INTERNAL_EVENT_NEWOBJ event
37
- measure->track_allocations = true;
38
- return measure;
39
- }
40
-
41
- void rp_init_measure_memory(void)
42
- {
43
- rb_define_const(mProf, "MEMORY", INT2NUM(MEASURE_MEMORY));
44
-
45
- cMeasureMemory = rb_define_class_under(mMeasure, "Allocations", rb_cObject);
46
- }