ruby-prof 1.7.2 → 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.
- checksums.yaml +4 -4
- data/{CHANGES → CHANGELOG.md} +112 -178
- data/README.md +5 -5
- data/bin/ruby-prof +1 -4
- data/docs/advanced-usage.md +132 -0
- data/docs/alternatives.md +98 -0
- data/docs/architecture.md +122 -0
- data/docs/best-practices.md +27 -0
- data/docs/getting-started.md +130 -0
- data/docs/history.md +11 -0
- data/docs/index.md +45 -0
- data/docs/profiling-rails.md +64 -0
- data/docs/public/examples/example.rb +33 -0
- data/docs/public/examples/generate_reports.rb +92 -0
- data/docs/public/examples/reports/call_info.txt +27 -0
- data/docs/public/examples/reports/call_stack.html +835 -0
- data/docs/public/examples/reports/callgrind.out +150 -0
- data/docs/public/examples/reports/flame_graph.html +408 -0
- data/docs/public/examples/reports/flat.txt +45 -0
- data/docs/public/examples/reports/graph.dot +129 -0
- data/docs/public/examples/reports/graph.html +1319 -0
- data/docs/public/examples/reports/graph.txt +100 -0
- data/docs/public/examples/reports/graphviz_viewer.html +1 -0
- data/docs/public/images/call_stack.png +0 -0
- data/docs/public/images/class_diagram.png +0 -0
- data/docs/public/images/dot_printer.png +0 -0
- data/docs/public/images/flame_graph.png +0 -0
- data/docs/public/images/flat.png +0 -0
- data/docs/public/images/graph.png +0 -0
- data/docs/public/images/graph_html.png +0 -0
- data/docs/public/images/ruby-prof-logo.svg +1 -0
- data/docs/reports.md +150 -0
- data/docs/stylesheets/extra.css +80 -0
- data/ext/ruby_prof/rp_allocation.c +0 -15
- data/ext/ruby_prof/rp_allocation.h +29 -33
- data/ext/ruby_prof/rp_call_tree.c +3 -0
- data/ext/ruby_prof/rp_call_tree.h +1 -4
- data/ext/ruby_prof/rp_call_trees.h +1 -4
- data/ext/ruby_prof/rp_measurement.c +0 -5
- data/ext/ruby_prof/rp_measurement.h +49 -53
- data/ext/ruby_prof/rp_method.c +3 -0
- data/ext/ruby_prof/rp_method.h +1 -4
- data/ext/ruby_prof/rp_profile.c +1 -1
- data/ext/ruby_prof/rp_profile.h +1 -5
- data/ext/ruby_prof/rp_stack.h +50 -53
- data/ext/ruby_prof/rp_thread.h +1 -4
- data/ext/ruby_prof/ruby_prof.h +1 -4
- data/ext/ruby_prof/vc/ruby_prof.vcxproj +7 -8
- data/lib/ruby-prof/assets/call_stack_printer.html.erb +746 -711
- data/lib/ruby-prof/assets/flame_graph_printer.html.erb +412 -0
- data/lib/ruby-prof/assets/graph_printer.html.erb +355 -355
- data/lib/ruby-prof/call_tree.rb +57 -57
- data/lib/ruby-prof/call_tree_visitor.rb +36 -36
- data/lib/ruby-prof/measurement.rb +17 -17
- data/lib/ruby-prof/printers/abstract_printer.rb +19 -33
- data/lib/ruby-prof/printers/call_info_printer.rb +53 -53
- data/lib/ruby-prof/printers/call_stack_printer.rb +168 -180
- data/lib/ruby-prof/printers/call_tree_printer.rb +132 -145
- data/lib/ruby-prof/printers/dot_printer.rb +177 -132
- data/lib/ruby-prof/printers/flame_graph_printer.rb +79 -0
- data/lib/ruby-prof/printers/flat_printer.rb +52 -52
- data/lib/ruby-prof/printers/graph_html_printer.rb +62 -63
- data/lib/ruby-prof/printers/graph_printer.rb +112 -113
- data/lib/ruby-prof/printers/multi_printer.rb +134 -127
- data/lib/ruby-prof/profile.rb +13 -0
- data/lib/ruby-prof/rack.rb +114 -105
- data/lib/ruby-prof/task.rb +147 -147
- data/lib/ruby-prof/thread.rb +20 -20
- data/lib/ruby-prof/version.rb +1 -1
- data/lib/ruby-prof.rb +50 -52
- data/lib/unprof.rb +10 -10
- data/ruby-prof.gemspec +5 -5
- data/test/abstract_printer_test.rb +25 -27
- data/test/alias_test.rb +203 -117
- data/test/call_tree_builder.rb +126 -126
- data/test/call_tree_visitor_test.rb +27 -27
- data/test/call_trees_test.rb +66 -66
- data/test/duplicate_names_test.rb +32 -32
- data/test/dynamic_method_test.rb +50 -50
- data/test/exceptions_test.rb +24 -24
- data/test/exclude_threads_test.rb +48 -48
- data/test/fiber_test.rb +72 -72
- data/test/inverse_call_tree_test.rb +174 -174
- data/test/line_number_test.rb +138 -1
- data/test/marshal_test.rb +144 -145
- data/test/measure_allocations.rb +26 -26
- data/test/measure_allocations_test.rb +340 -1
- data/test/measure_process_time_test.rb +3098 -3142
- data/test/measure_times.rb +56 -56
- data/test/measure_wall_time_test.rb +511 -372
- data/test/measurement_test.rb +82 -82
- data/test/merge_test.rb +48 -48
- data/test/multi_printer_test.rb +52 -66
- data/test/no_method_class_test.rb +15 -15
- data/test/pause_resume_test.rb +171 -171
- data/test/prime.rb +54 -54
- data/test/prime_script.rb +5 -5
- data/test/printer_call_stack_test.rb +28 -27
- data/test/printer_call_tree_test.rb +30 -30
- data/test/printer_flame_graph_test.rb +82 -0
- data/test/printer_flat_test.rb +99 -99
- data/test/printer_graph_html_test.rb +62 -59
- data/test/printer_graph_test.rb +42 -40
- data/test/printers_test.rb +28 -44
- data/test/printing_recursive_graph_test.rb +81 -81
- data/test/profile_test.rb +101 -101
- data/test/rack_test.rb +103 -93
- data/test/recursive_test.rb +139 -139
- data/test/scheduler.rb +4 -0
- data/test/singleton_test.rb +39 -38
- data/test/stack_printer_test.rb +61 -61
- data/test/start_stop_test.rb +106 -106
- data/test/test_helper.rb +4 -0
- data/test/thread_test.rb +29 -29
- data/test/unique_call_path_test.rb +123 -123
- data/test/yarv_test.rb +56 -56
- metadata +53 -11
- data/ext/ruby_prof/rp_measure_memory.c +0 -46
- data/lib/ruby-prof/compatibility.rb +0 -113
- data/test/compatibility_test.rb +0 -49
- data/test/measure_memory_test.rb +0 -1193
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
Measure Mode: wall_time
|
|
2
|
+
Thread ID: 464
|
|
3
|
+
Fiber ID: 456
|
|
4
|
+
Total Time: 0.007774999990942888
|
|
5
|
+
Sort by: total_time
|
|
6
|
+
|
|
7
|
+
%total %self total self wait child calls name location
|
|
8
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
9
|
+
100.00% 0.19% 0.008 0.000 0.000 0.008 1 [global]# C:/Source/ruby-prof/docs/public/examples/generate_reports.rb:24
|
|
10
|
+
0.008 0.000 0.000 0.008 1/1 Object#run_example
|
|
11
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
12
|
+
0.008 0.000 0.000 0.008 1/1 [global]#
|
|
13
|
+
99.81% 0.16% 0.008 0.000 0.000 0.008 1 Object#run_example C:/Source/ruby-prof/docs/public/examples/example.rb:22
|
|
14
|
+
0.006 0.000 0.000 0.006 1/1 Object#count_words
|
|
15
|
+
0.002 0.000 0.000 0.002 1/1 Object#tokenize
|
|
16
|
+
0.001 0.000 0.000 0.001 1/1 Object#normalize
|
|
17
|
+
0.000 0.000 0.000 0.000 1/1 Object#top_words
|
|
18
|
+
0.000 0.000 0.000 0.000 1/1 String#*
|
|
19
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
20
|
+
0.006 0.000 0.000 0.006 1/1 Object#run_example
|
|
21
|
+
71.81% 0.09% 0.006 0.000 0.000 0.006 1 Object#count_words C:/Source/ruby-prof/docs/public/examples/example.rb:12
|
|
22
|
+
0.006 0.003 0.000 0.003 1/1 Array#each
|
|
23
|
+
0.000 0.000 0.000 0.000 1/1 Hash#initialize
|
|
24
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
25
|
+
0.006 0.003 0.000 0.003 1/1 Object#count_words
|
|
26
|
+
71.68% 38.85% 0.006 0.003 0.000 0.003 1 Array#each
|
|
27
|
+
0.001 0.001 0.000 0.000 5800/5800 Hash#[]=
|
|
28
|
+
0.001 0.001 0.000 0.000 5800/5800 Hash#[]
|
|
29
|
+
0.001 0.001 0.000 0.000 5800/5800 Integer#+
|
|
30
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
31
|
+
0.002 0.000 0.000 0.002 1/1 Object#run_example
|
|
32
|
+
19.43% 0.03% 0.002 0.000 0.000 0.002 1 Object#tokenize C:/Source/ruby-prof/docs/public/examples/example.rb:8
|
|
33
|
+
0.002 0.002 0.000 0.000 1/1 String#split
|
|
34
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
35
|
+
0.002 0.002 0.000 0.000 1/1 Object#tokenize
|
|
36
|
+
19.40% 19.40% 0.002 0.002 0.000 0.000 1 String#split
|
|
37
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
38
|
+
0.001 0.001 0.000 0.000 5800/5800 Array#each
|
|
39
|
+
12.86% 12.86% 0.001 0.001 0.000 0.000 5800 Hash#[]=
|
|
40
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
41
|
+
0.001 0.001 0.000 0.000 5800/5800 Array#each
|
|
42
|
+
11.29% 11.29% 0.001 0.001 0.000 0.000 5800 Hash#[]
|
|
43
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
44
|
+
0.001 0.001 0.000 0.000 5800/5800 Array#each
|
|
45
|
+
8.68% 8.68% 0.001 0.001 0.000 0.000 5800 Integer#+
|
|
46
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
47
|
+
0.001 0.000 0.000 0.001 1/1 Object#run_example
|
|
48
|
+
7.86% 0.05% 0.001 0.000 0.000 0.001 1 Object#normalize C:/Source/ruby-prof/docs/public/examples/example.rb:4
|
|
49
|
+
0.001 0.001 0.000 0.000 1/1 String#gsub
|
|
50
|
+
0.000 0.000 0.000 0.000 1/1 String#downcase
|
|
51
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
52
|
+
0.001 0.001 0.000 0.000 1/1 Object#normalize
|
|
53
|
+
7.61% 7.61% 0.001 0.001 0.000 0.000 1 String#gsub
|
|
54
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
55
|
+
0.000 0.000 0.000 0.000 1/1 Object#run_example
|
|
56
|
+
0.49% 0.08% 0.000 0.000 0.000 0.000 1 Object#top_words C:/Source/ruby-prof/docs/public/examples/example.rb:18
|
|
57
|
+
0.000 0.000 0.000 0.000 1/1 Enumerable#sort_by
|
|
58
|
+
0.000 0.000 0.000 0.000 1/1 Array#take
|
|
59
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
60
|
+
0.000 0.000 0.000 0.000 1/1 Object#top_words
|
|
61
|
+
0.38% 0.09% 0.000 0.000 0.000 0.000 1 Enumerable#sort_by
|
|
62
|
+
0.000 0.000 0.000 0.000 1/1 Hash#each
|
|
63
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
64
|
+
0.000 0.000 0.000 0.000 1/1 Enumerable#sort_by
|
|
65
|
+
0.29% 0.22% 0.000 0.000 0.000 0.000 1 Hash#each
|
|
66
|
+
0.000 0.000 0.000 0.000 25/25 Integer#-@
|
|
67
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
68
|
+
0.000 0.000 0.000 0.000 1/1 Object#normalize
|
|
69
|
+
0.21% 0.21% 0.000 0.000 0.000 0.000 1 String#downcase
|
|
70
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
71
|
+
0.000 0.000 0.000 0.000 25/25 Hash#each
|
|
72
|
+
0.07% 0.07% 0.000 0.000 0.000 0.000 25 Integer#-@ <internal:numeric>:104
|
|
73
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
74
|
+
0.000 0.000 0.000 0.000 1/1 Object#run_example
|
|
75
|
+
0.07% 0.07% 0.000 0.000 0.000 0.000 1 String#*
|
|
76
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
77
|
+
0.000 0.000 0.000 0.000 1/1 Object#count_words
|
|
78
|
+
0.03% 0.03% 0.000 0.000 0.000 0.000 1 Hash#initialize <internal:hash>:37
|
|
79
|
+
------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
80
|
+
0.000 0.000 0.000 0.000 1/1 Object#top_words
|
|
81
|
+
0.02% 0.02% 0.000 0.000 0.000 0.000 1 Array#take
|
|
82
|
+
|
|
83
|
+
* recursively called methods
|
|
84
|
+
|
|
85
|
+
Columns are:
|
|
86
|
+
|
|
87
|
+
%self - The percentage of time spent by this method relative to the total time in the entire program.
|
|
88
|
+
total - The total time spent by this method and its children.
|
|
89
|
+
self - The time spent by this method.
|
|
90
|
+
wait - The time this method spent waiting for other threads.
|
|
91
|
+
child - The time spent by this method's children.
|
|
92
|
+
calls - The number of times this method was called.
|
|
93
|
+
name - The name of the method.
|
|
94
|
+
location - The location of the method.
|
|
95
|
+
|
|
96
|
+
The interpretation of method names is:
|
|
97
|
+
|
|
98
|
+
* MyObject#test - An instance method "test" of the class "MyObject"
|
|
99
|
+
* <Object:MyObject>#test - The <> characters indicate a method on a singleton class.
|
|
100
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<html><head><meta http-equiv="refresh" content="0;url=https://dreampuf.github.io/GraphvizOnline/?engine=dot#digraph%20%22Profile%22%20%7B%0Arankdir%3DTB%3B%0Abgcolor%3D%22%23FAFAFA%22%3B%0Anode%20%5Bfontname%3D%22Helvetica%22%20fontsize%3D11%20style%3D%22filled%2Crounded%22%20shape%3Dbox%20fillcolor%3D%22%23FFFFFF%22%20color%3D%22%23CCCCCC%22%20penwidth%3D1.2%5D%3B%0Aedge%20%5Bfontname%3D%22Helvetica%22%20fontsize%3D9%20color%3D%22%235B7DB1%22%20arrowsize%3D0.7%5D%3B%0Alabelloc%3Dt%3B%0Alabeljust%3Dl%3B%0Asubgraph%20%22Thread%20464%22%20%7B%0A624%20%5Blabel%3D%22take%5Cn%280%25%29%22%5D%3B%0A632%20%5Blabel%3D%22-%40%5Cn%280%25%29%22%5D%3B%0A640%20%5Blabel%3D%22each%5Cn%280%25%29%22%5D%3B%0A640%20-%3E%20632%20%5Blabel%3D%2225%2F25%22%20penwidth%3D0.5%5D%3B%0A648%20%5Blabel%3D%22sort_by%5Cn%280%25%29%22%5D%3B%0A648%20-%3E%20640%20%5Blabel%3D%221%2F1%22%20penwidth%3D0.5%5D%3B%0A656%20%5Blabel%3D%22top_words%5Cn%280%25%29%22%5D%3B%0A656%20-%3E%20648%20%5Blabel%3D%221%2F1%22%20penwidth%3D0.5%5D%3B%0A656%20-%3E%20624%20%5Blabel%3D%221%2F1%22%20penwidth%3D0.5%5D%3B%0A664%20%5Blabel%3D%22%5B%5D%3D%5Cn%2813%25%29%22%20fillcolor%3D%22%232E86C1%22%20fontcolor%3D%22%23FFFFFF%22%5D%3B%0A672%20%5Blabel%3D%22%2B%5Cn%289%25%29%22%20fillcolor%3D%22%23D4E6F1%22%20fontcolor%3D%22%23333333%22%5D%3B%0A680%20%5Blabel%3D%22%5B%5D%5Cn%2811%25%29%22%20fillcolor%3D%22%232E86C1%22%20fontcolor%3D%22%23FFFFFF%22%5D%3B%0A688%20%5Blabel%3D%22each%5Cn%2872%25%29%22%20fillcolor%3D%22%230D2483%22%20fontcolor%3D%22%23FFFFFF%22%5D%3B%0A688%20-%3E%20664%20%5Blabel%3D%225800%2F5800%22%20penwidth%3D1.1%5D%3B%0A688%20-%3E%20680%20%5Blabel%3D%225800%2F5800%22%20penwidth%3D1.1%5D%3B%0A688%20-%3E%20672%20%5Blabel%3D%225800%2F5800%22%20penwidth%3D0.9%5D%3B%0A696%20%5Blabel%3D%22initialize%5Cn%280%25%29%22%5D%3B%0A704%20%5Blabel%3D%22count_words%5Cn%2872%25%29%22%20fillcolor%3D%22%230D2483%22%20fontcolor%3D%22%23FFFFFF%22%5D%3B%0A704%20-%3E%20688%20%5Blabel%3D%221%2F1%22%20penwidth%3D4.0%5D%3B%0A704%20-%3E%20696%20%5Blabel%3D%221%2F1%22%20penwidth%3D0.5%5D%3B%0A712%20%5Blabel%3D%22split%5Cn%2819%25%29%22%20fillcolor%3D%22%232E86C1%22%20fontcolor%3D%22%23FFFFFF%22%5D%3B%0A720%20%5Blabel%3D%22tokenize%5Cn%2819%25%29%22%20fillcolor%3D%22%232E86C1%22%20fontcolor%3D%22%23FFFFFF%22%5D%3B%0A720%20-%3E%20712%20%5Blabel%3D%221%2F1%22%20penwidth%3D1.5%5D%3B%0A728%20%5Blabel%3D%22gsub%5Cn%288%25%29%22%20fillcolor%3D%22%23D4E6F1%22%20fontcolor%3D%22%23333333%22%5D%3B%0A736%20%5Blabel%3D%22downcase%5Cn%280%25%29%22%5D%3B%0A744%20%5Blabel%3D%22normalize%5Cn%288%25%29%22%20fillcolor%3D%22%23D4E6F1%22%20fontcolor%3D%22%23333333%22%5D%3B%0A744%20-%3E%20728%20%5Blabel%3D%221%2F1%22%20penwidth%3D0.9%5D%3B%0A744%20-%3E%20736%20%5Blabel%3D%221%2F1%22%20penwidth%3D0.5%5D%3B%0A752%20%5Blabel%3D%22*%5Cn%280%25%29%22%5D%3B%0A760%20%5Blabel%3D%22run_example%5Cn%28100%25%29%22%20fillcolor%3D%22%230D2483%22%20fontcolor%3D%22%23FFFFFF%22%5D%3B%0A760%20-%3E%20704%20%5Blabel%3D%221%2F1%22%20penwidth%3D4.0%5D%3B%0A760%20-%3E%20720%20%5Blabel%3D%221%2F1%22%20penwidth%3D1.5%5D%3B%0A760%20-%3E%20744%20%5Blabel%3D%221%2F1%22%20penwidth%3D0.9%5D%3B%0A760%20-%3E%20656%20%5Blabel%3D%221%2F1%22%20penwidth%3D0.5%5D%3B%0A760%20-%3E%20752%20%5Blabel%3D%221%2F1%22%20penwidth%3D0.5%5D%3B%0A768%20%5Blabel%3D%22%5Bglobal%5D%5Cn%28100%25%29%22%20fillcolor%3D%22%230D2483%22%20fontcolor%3D%22%23FFFFFF%22%5D%3B%0A768%20-%3E%20760%20%5Blabel%3D%221%2F1%22%20penwidth%3D4.0%5D%3B%0A%7D%0Asubgraph%20cluster_776%20%7B%0Alabel%20%3D%20%22%5Bglobal%5D%22%3B%0Afontname%20%3D%20%22Helvetica%22%3B%0Afontcolor%20%3D%20%22%231A35A6%22%3B%0Afontsize%20%3D%2014%3B%0Acolor%20%3D%20%22%231A35A6%22%3B%0Astyle%20%3D%20%22rounded%2Cdashed%22%3B%0Apenwidth%20%3D%201.5%3B%0A768%3B%0A%7D%0Asubgraph%20cluster_784%20%7B%0Alabel%20%3D%20%22Object%22%3B%0Afontname%20%3D%20%22Helvetica%22%3B%0Afontcolor%20%3D%20%22%232E86C1%22%3B%0Afontsize%20%3D%2014%3B%0Acolor%20%3D%20%22%232E86C1%22%3B%0Astyle%20%3D%20%22rounded%2Cdashed%22%3B%0Apenwidth%20%3D%201.5%3B%0A760%3B%0A744%3B%0A720%3B%0A704%3B%0A656%3B%0A%7D%0Asubgraph%20cluster_792%20%7B%0Alabel%20%3D%20%22String%22%3B%0Afontname%20%3D%20%22Helvetica%22%3B%0Afontcolor%20%3D%20%22%231ABC9C%22%3B%0Afontsize%20%3D%2014%3B%0Acolor%20%3D%20%22%231ABC9C%22%3B%0Astyle%20%3D%20%22rounded%2Cdashed%22%3B%0Apenwidth%20%3D%201.5%3B%0A752%3B%0A736%3B%0A728%3B%0A712%3B%0A%7D%0Asubgraph%20cluster_800%20%7B%0Alabel%20%3D%20%22Hash%22%3B%0Afontname%20%3D%20%22Helvetica%22%3B%0Afontcolor%20%3D%20%22%235B2C8E%22%3B%0Afontsize%20%3D%2014%3B%0Acolor%20%3D%20%22%235B2C8E%22%3B%0Astyle%20%3D%20%22rounded%2Cdashed%22%3B%0Apenwidth%20%3D%201.5%3B%0A696%3B%0A680%3B%0A664%3B%0A640%3B%0A%7D%0Asubgraph%20cluster_808%20%7B%0Alabel%20%3D%20%22Array%22%3B%0Afontname%20%3D%20%22Helvetica%22%3B%0Afontcolor%20%3D%20%22%232471A3%22%3B%0Afontsize%20%3D%2014%3B%0Acolor%20%3D%20%22%232471A3%22%3B%0Astyle%20%3D%20%22rounded%2Cdashed%22%3B%0Apenwidth%20%3D%201.5%3B%0A688%3B%0A624%3B%0A%7D%0Asubgraph%20cluster_816%20%7B%0Alabel%20%3D%20%22Integer%22%3B%0Afontname%20%3D%20%22Helvetica%22%3B%0Afontcolor%20%3D%20%22%23148F77%22%3B%0Afontsize%20%3D%2014%3B%0Acolor%20%3D%20%22%23148F77%22%3B%0Astyle%20%3D%20%22rounded%2Cdashed%22%3B%0Apenwidth%20%3D%201.5%3B%0A672%3B%0A632%3B%0A%7D%0Asubgraph%20cluster_824%20%7B%0Alabel%20%3D%20%22Enumerable%22%3B%0Afontname%20%3D%20%22Helvetica%22%3B%0Afontcolor%20%3D%20%22%231F618D%22%3B%0Afontsize%20%3D%2014%3B%0Acolor%20%3D%20%22%231F618D%22%3B%0Astyle%20%3D%20%22rounded%2Cdashed%22%3B%0Apenwidth%20%3D%201.5%3B%0A648%3B%0A%7D%0A%7D%0A"></head></html>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 190 41"><defs><style>.cls-1{fill:#fff}</style></defs><path class="cls-1" d="M63.49 16.74c0-1.37-.91-2-2.26-2h-3.38v3.93h3.58c1.24.01 2.06-.56 2.06-1.93zM110.43 14.75h-3.6v5h3.6a2.32 2.32 0 0 0 2.5-2.49 2.34 2.34 0 0 0-2.5-2.51zM128.77 14.75h-3.53v4.94h3.53a2.28 2.28 0 0 0 2.47-2.45 2.3 2.3 0 0 0-2.47-2.49zM61.81 21.83h-4v4.32h3.91c1.44 0 2.45-.62 2.45-2.14s-.99-2.18-2.36-2.18zM21 14.75h-3.57v4.94H21a2.28 2.28 0 0 0 2.47-2.45A2.3 2.3 0 0 0 21 14.75z"/><path class="cls-1" d="M184 .44H5.87A4.93 4.93 0 0 0 .94 5.37V35.5a4.94 4.94 0 0 0 4.93 4.94H184a4.94 4.94 0 0 0 4.94-4.94V5.37A4.94 4.94 0 0 0 184 .44zm-34.38 10.78c4.79 0 8.46 2.89 9.18 7.54h-3.86a5.48 5.48 0 0 0-10.68 0h-3.83c.71-4.65 4.36-7.54 9.19-7.54zM24 29.44L20.46 23h-3v6.46h-3.72v-18h7.68c3.41 0 5.78 2.07 5.78 5.76a5.34 5.34 0 0 1-2.88 5.14l3.82 7.06zm24.31-7.3c0 4.8-2.92 7.56-7.63 7.56S33 26.94 33 22.14V11.48h3.69v10.61c0 2.81 1.37 4.32 4 4.32s3.94-1.51 3.94-4.32V11.48h3.69zm13.92 7.3h-8v-18h7.52c3.24 0 5.59 1.61 5.59 5A4 4 0 0 1 65.51 20 4.22 4.22 0 0 1 68 24.21c0 3.43-2.4 5.23-5.81 5.23zm19.66-6.92v6.92h-3.7v-6.92l-6.81-11h4.29L80 18.85l4.34-7.37h4.32zm16-.5h-7.62v-3.26h7.59zm13 1h-4v6.39h-3.72v-18h7.77c3.41 0 5.79 2.09 5.79 5.79s-2.41 5.85-5.82 5.85zm20.86 6.39L128.26 23h-3v6.46h-3.72v-18h7.69c3.4 0 5.78 2.07 5.78 5.76a5.34 5.34 0 0 1-2.88 5.14l3.87 7.08zm17.85.26c-4.88 0-8.55-2.95-9.21-7.68h3.81A5.49 5.49 0 0 0 155 22h3.84c-.69 4.75-4.38 7.7-9.22 7.7zm18.4-.23h-3.72v-3.7H168zm6.36-7.54h-10.05v-3.26h10.08zm1.44-7.16h-11.49v-3.26h11.52z"/></svg>
|
data/docs/reports.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Reports
|
|
2
|
+
|
|
3
|
+
Once you have completed a profiling run, you will want to generate a report to analyze the results. One of ruby-prof's strengths is the number of ways it lets you visualize profiling results, from quick text summaries to interactive HTML views and external tooling formats. The following table shows all supported report types and when to use them:
|
|
4
|
+
|
|
5
|
+
For repeatable profiling workflow guidance, see [Best Practices](best-practices.md).
|
|
6
|
+
|
|
7
|
+
| Name | Best For |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `FlatPrinter` | Finding hottest methods fast (best quick signal by self time) |
|
|
10
|
+
| `GraphPrinter` | Understanding who called a hot method (caller/callee context in text) |
|
|
11
|
+
| `GraphHtmlPrinter` | Exploring large call graphs interactively (clickable navigation) |
|
|
12
|
+
| `FlameGraphPrinter` | Seeing hot paths visually (where time accumulates) |
|
|
13
|
+
| `CallStackPrinter` | Inspecting execution-path dominance (tree of major runtime paths) |
|
|
14
|
+
| `CallTreePrinter` | Using external profiler tooling (KCachegrind/callgrind format) |
|
|
15
|
+
| `CallInfoPrinter` | Debugging ruby-prof internals/data shape (low-level call-tree details) |
|
|
16
|
+
| `MultiPrinter` | Generating several outputs at once (one run, multiple files) |
|
|
17
|
+
|
|
18
|
+
Recommended workflow:
|
|
19
|
+
|
|
20
|
+
1. Run `FlatPrinter` to find top offenders.
|
|
21
|
+
2. Use `GraphHtmlPrinter` (or `GraphPrinter`) to understand caller/callee relationships.
|
|
22
|
+
3. Use `FlameGraphPrinter` to visually validate dominant paths.
|
|
23
|
+
|
|
24
|
+
## Creating Reports
|
|
25
|
+
|
|
26
|
+
Reports are created via the use of printers:
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
profile = RubyProf::Profile.profile do
|
|
30
|
+
...
|
|
31
|
+
end
|
|
32
|
+
printer = RubyProf::GraphPrinter.new(profile)
|
|
33
|
+
printer.print(STDOUT, min_percent: 2)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The first parameter is any writable IO object such as STDOUT or a file. All printers accept the following keyword arguments:
|
|
37
|
+
|
|
38
|
+
| Option | Default | Description |
|
|
39
|
+
|--------|---------|-------------|
|
|
40
|
+
| `min_percent` | `0` | Minimum %self time for a method to be included (0–100). |
|
|
41
|
+
| `max_percent` | `100` | Maximum %self time for a method to be included (0–100). |
|
|
42
|
+
| `filter_by` | `:self_time` | Which time metric to use when applying `min_percent` and `max_percent`. |
|
|
43
|
+
| `sort_method` | varies | How to sort methods. Values: `:total_time`, `:self_time`, `:wait_time`, `:children_time`. |
|
|
44
|
+
|
|
45
|
+
## Report Types
|
|
46
|
+
|
|
47
|
+
### Flat
|
|
48
|
+
|
|
49
|
+
The flat report shows the overall time spent in each method. It is a good way of quickly identifying which methods take the most time. Use `RubyProf::FlatPrinter` to generate this report. Default `sort_method` is `:self_time`. (<a href="../public/examples/reports/flat.txt" target="_blank">example</a>)
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
### Graph (Text)
|
|
54
|
+
|
|
55
|
+
The graph report shows the overall time spent in each method. In addition, it also shows which methods call the current method and which methods it calls. Thus they are good for understanding how methods get called and provide insight into the flow of your program. Use `RubyProf::GraphPrinter` to generate this report. Default `sort_method` is `:total_time`. (<a href="../public/examples/reports/graph.txt" target="_blank">example</a>)
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
59
|
+
### Graph (HTML)
|
|
60
|
+
|
|
61
|
+
HTML Graph profiles are the same as graph reports, except output is generated in hyper-linked HTML. Since graph reports can be quite large, the embedded links make it much easier to navigate the results. Use `RubyProf::GraphHtmlPrinter` to generate this report. Default `sort_method` is `:total_time`. (<a href="../public/examples/reports/graph.html" target="_blank">example</a>)
|
|
62
|
+
|
|
63
|
+

|
|
64
|
+
|
|
65
|
+
Additional options:
|
|
66
|
+
|
|
67
|
+
| Option | Default | Description |
|
|
68
|
+
|--------|---------|-------------|
|
|
69
|
+
| `min_time` | `nil` | Minimum total time (in seconds) for a method to be shown. |
|
|
70
|
+
| `nonzero` | `false` | When `true`, sets `min_time` to 0.005 if `min_time` is not specified. |
|
|
71
|
+
|
|
72
|
+
### Flame Graph
|
|
73
|
+
|
|
74
|
+
Flame graph reports produce a self-contained HTML visualization of the profiled code. Each method is represented as a horizontal bar whose width is proportional to its total time. Bars are stacked vertically by call depth, making it easy to identify hot code paths at a glance. A toggle switches between flame (bottom-up) and icicle (top-down) views. Use `RubyProf::FlameGraphPrinter` to generate this report. (<a href="../public/examples/reports/flame_graph.html" target="_blank">example</a>)
|
|
75
|
+
|
|
76
|
+

|
|
77
|
+
|
|
78
|
+
Interactive features include hover tooltips (showing method name, self time, total time, percentage, and call count), click-to-zoom into a subtree, a reset zoom button, a search box to highlight matching methods, and a thread selector when multiple threads are profiled.
|
|
79
|
+
|
|
80
|
+
```ruby
|
|
81
|
+
printer = RubyProf::FlameGraphPrinter.new(result)
|
|
82
|
+
printer.print(File.open("flame_graph.html", "w"))
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Additional options:
|
|
86
|
+
|
|
87
|
+
| Option | Default | Description |
|
|
88
|
+
|--------|---------|-------------|
|
|
89
|
+
| `title` | `"ruby-prof flame graph"` | Title displayed in the HTML report. |
|
|
90
|
+
|
|
91
|
+
### Call Stack
|
|
92
|
+
|
|
93
|
+
Call stack reports produce a HTML visualization of the time spent in each execution path of the profiled code. Use `RubyProf::CallStackPrinter` to generate this report. (<a href="../public/examples/reports/call_stack.html" target="_blank">example</a>)
|
|
94
|
+
|
|
95
|
+

|
|
96
|
+
|
|
97
|
+
Additional options:
|
|
98
|
+
|
|
99
|
+
| Option | Default | Description |
|
|
100
|
+
|--------|---------|-------------|
|
|
101
|
+
| `title` | `"ruby-prof call stack"` | Title displayed in the HTML report. |
|
|
102
|
+
| `threshold` | `1.0` | Minimum %total for a node to be visible (0–100). |
|
|
103
|
+
| `expansion` | `10.0` | Minimum %total for a node to be expanded by default (0–100). |
|
|
104
|
+
| `application` | `$PROGRAM_NAME` | Application name displayed in the report. |
|
|
105
|
+
|
|
106
|
+
### Graphviz
|
|
107
|
+
|
|
108
|
+
The graphviz report is designed to be opened by [Graphviz](https://www.graphviz.org/) to create visualization of profile results. The output can be visualized using the [Graphviz Online](https://dreampuf.github.io/GraphvizOnline/) viewer. Use `RubyProf::DotPrinter` to generate this report. (<a href="../public/examples/reports/graph.dot" target="_blank">example</a>, <a href="../public/examples/reports/graphviz_viewer.html" target="_blank">view online</a>)
|
|
109
|
+
|
|
110
|
+

|
|
111
|
+
|
|
112
|
+
### Cachegrind
|
|
113
|
+
|
|
114
|
+
Cachegrind output results in the calltree profile format which is used by [KCachegrind](https://kcachegrind.github.io/html/Home.html). More information about the format can be found at the KCachegrind site. Use `RubyProf::CallTreePrinter` to generate this report. (<a href="../public/examples/reports/callgrind.out" target="_blank">example</a>)
|
|
115
|
+
|
|
116
|
+
Additional options:
|
|
117
|
+
|
|
118
|
+
| Option | Default | Description |
|
|
119
|
+
|--------|---------|-------------|
|
|
120
|
+
| `path` | `"."` | Directory where callgrind output files are written. |
|
|
121
|
+
|
|
122
|
+
### Call Info Report
|
|
123
|
+
|
|
124
|
+
Call info reports print the call tree with timing information for each node. This is mainly useful for debugging purposes as it provides access into ruby-prof's internals. Use `RubyProf::CallInfoPrinter` to generate this report. (<a href="../public/examples/reports/call_info.txt" target="_blank">example</a>)
|
|
125
|
+
|
|
126
|
+
### Multiple Reports
|
|
127
|
+
|
|
128
|
+
`RubyProf::MultiPrinter` can generate several reports in one profiling run. It requires a directory path and a profile basename for the files it produces:
|
|
129
|
+
|
|
130
|
+
```ruby
|
|
131
|
+
printer = RubyProf::MultiPrinter.new(result)
|
|
132
|
+
printer.print(path: ".", profile: "profile")
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
| Option | Default | Description |
|
|
136
|
+
|--------|---------|-------------|
|
|
137
|
+
| `path` | `"."` | Directory where report files are written. |
|
|
138
|
+
| `profile` | `"profile"` | Base filename for the generated reports. |
|
|
139
|
+
|
|
140
|
+
All other keyword arguments are forwarded to the individual printers.
|
|
141
|
+
|
|
142
|
+
## Generating Examples
|
|
143
|
+
|
|
144
|
+
To regenerate the example reports:
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
ruby docs/public/examples/generate_reports.rb
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
This profiles a small word-frequency workload and writes reports to `docs/public/examples/reports/`.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* ruby-prof blue branding */
|
|
2
|
+
:root,
|
|
3
|
+
[data-md-color-scheme="default"] {
|
|
4
|
+
--md-primary-fg-color: #0D2483;
|
|
5
|
+
--md-primary-fg-color--light: #1A35A6;
|
|
6
|
+
--md-primary-fg-color--dark: #091A5E;
|
|
7
|
+
--md-accent-fg-color: #1A35A6;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
[data-md-color-scheme="slate"] {
|
|
11
|
+
--md-primary-fg-color: #0D2483;
|
|
12
|
+
--md-primary-fg-color--light: #1A35A6;
|
|
13
|
+
--md-primary-fg-color--dark: #091A5E;
|
|
14
|
+
--md-accent-fg-color: #1A35A6;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Header - force blue bg with white foreground in both modes */
|
|
18
|
+
.md-header {
|
|
19
|
+
background-color: #0D2483 !important;
|
|
20
|
+
color: white !important;
|
|
21
|
+
--md-primary-bg-color: white;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Logo in header - match graph.html report style */
|
|
25
|
+
.md-header__button.md-logo img,
|
|
26
|
+
.md-header__button.md-logo svg {
|
|
27
|
+
height: 24px;
|
|
28
|
+
width: auto;
|
|
29
|
+
opacity: 0.5;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Hide site name text next to logo but keep spacing */
|
|
33
|
+
.md-header__title {
|
|
34
|
+
visibility: hidden;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Header text and icons white on blue */
|
|
38
|
+
.md-header .md-header__button,
|
|
39
|
+
.md-header .md-icon,
|
|
40
|
+
.md-header .md-header__option .md-icon {
|
|
41
|
+
color: white !important;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.md-header .md-icon svg {
|
|
45
|
+
stroke: white !important;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Search button - visible on blue header */
|
|
49
|
+
.md-header .md-search__button {
|
|
50
|
+
background-color: rgba(255, 255, 255, 0.15) !important;
|
|
51
|
+
color: white !important;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.md-header .md-search__button:before {
|
|
55
|
+
background-color: white !important;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.md-header .md-search__button:after {
|
|
59
|
+
background: rgba(255, 255, 255, 0.2) !important;
|
|
60
|
+
color: white !important;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* GitHub repo link in header */
|
|
64
|
+
.md-header .md-source {
|
|
65
|
+
color: white;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.md-header .md-source__icon svg {
|
|
69
|
+
fill: white;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.md-header .md-source__repository,
|
|
73
|
+
.md-header .md-source__fact {
|
|
74
|
+
color: rgba(255, 255, 255, 0.75);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Tabs bar */
|
|
78
|
+
.md-tabs {
|
|
79
|
+
background-color: #091A5E;
|
|
80
|
+
}
|
|
@@ -14,7 +14,6 @@ prof_allocation_t* prof_allocation_create(void)
|
|
|
14
14
|
result->klass = Qnil;
|
|
15
15
|
result->klass_name = Qnil;
|
|
16
16
|
result->object = Qnil;
|
|
17
|
-
result->memory = 0;
|
|
18
17
|
result->source_line = 0;
|
|
19
18
|
result->source_file = Qnil;
|
|
20
19
|
result->key = 0;
|
|
@@ -194,7 +193,6 @@ prof_allocation_t* prof_allocate_increment(st_table* allocations_table, rb_trace
|
|
|
194
193
|
}
|
|
195
194
|
|
|
196
195
|
allocation->count++;
|
|
197
|
-
allocation->memory += rb_obj_memsize_of(object);
|
|
198
196
|
|
|
199
197
|
return allocation;
|
|
200
198
|
}
|
|
@@ -280,16 +278,6 @@ static VALUE prof_allocation_count(VALUE self)
|
|
|
280
278
|
return INT2FIX(allocation->count);
|
|
281
279
|
}
|
|
282
280
|
|
|
283
|
-
/* call-seq:
|
|
284
|
-
memory -> number
|
|
285
|
-
|
|
286
|
-
Returns the amount of memory allocated. */
|
|
287
|
-
static VALUE prof_allocation_memory(VALUE self)
|
|
288
|
-
{
|
|
289
|
-
prof_allocation_t* allocation = prof_allocation_get(self);
|
|
290
|
-
return ULL2NUM(allocation->memory);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
281
|
/* :nodoc: */
|
|
294
282
|
static VALUE prof_allocation_dump(VALUE self)
|
|
295
283
|
{
|
|
@@ -303,7 +291,6 @@ static VALUE prof_allocation_dump(VALUE self)
|
|
|
303
291
|
rb_hash_aset(result, ID2SYM(rb_intern("source_file")), allocation->source_file);
|
|
304
292
|
rb_hash_aset(result, ID2SYM(rb_intern("source_line")), INT2FIX(allocation->source_line));
|
|
305
293
|
rb_hash_aset(result, ID2SYM(rb_intern("count")), INT2FIX(allocation->count));
|
|
306
|
-
rb_hash_aset(result, ID2SYM(rb_intern("memory")), ULL2NUM(allocation->memory));
|
|
307
294
|
|
|
308
295
|
return result;
|
|
309
296
|
}
|
|
@@ -320,7 +307,6 @@ static VALUE prof_allocation_load(VALUE self, VALUE data)
|
|
|
320
307
|
allocation->source_file = rb_hash_aref(data, ID2SYM(rb_intern("source_file")));
|
|
321
308
|
allocation->source_line = FIX2INT(rb_hash_aref(data, ID2SYM(rb_intern("source_line"))));
|
|
322
309
|
allocation->count = FIX2INT(rb_hash_aref(data, ID2SYM(rb_intern("count"))));
|
|
323
|
-
allocation->memory = NUM2ULONG(rb_hash_aref(data, ID2SYM(rb_intern("memory"))));
|
|
324
310
|
|
|
325
311
|
return data;
|
|
326
312
|
}
|
|
@@ -336,7 +322,6 @@ void rp_init_allocation(void)
|
|
|
336
322
|
rb_define_method(cRpAllocation, "source_file", prof_allocation_source_file, 0);
|
|
337
323
|
rb_define_method(cRpAllocation, "line", prof_allocation_source_line, 0);
|
|
338
324
|
rb_define_method(cRpAllocation, "count", prof_allocation_count, 0);
|
|
339
|
-
rb_define_method(cRpAllocation, "memory", prof_allocation_memory, 0);
|
|
340
325
|
rb_define_method(cRpAllocation, "_dump_data", prof_allocation_dump, 0);
|
|
341
326
|
rb_define_method(cRpAllocation, "_load_data", prof_allocation_load, 1);
|
|
342
327
|
}
|
|
@@ -1,33 +1,29 @@
|
|
|
1
|
-
/* Copyright (C) 2005-2019 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
|
-
#
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
VALUE
|
|
14
|
-
VALUE
|
|
15
|
-
|
|
16
|
-
int
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
st_table*
|
|
28
|
-
|
|
29
|
-
void
|
|
30
|
-
void prof_allocations_mark(st_table* allocations_table);
|
|
31
|
-
void prof_allocations_free(st_table* table);
|
|
32
|
-
|
|
33
|
-
#endif //_RP_ALLOCATION_
|
|
1
|
+
/* Copyright (C) 2005-2019 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
|
+
#pragma once
|
|
5
|
+
|
|
6
|
+
#include "ruby_prof.h"
|
|
7
|
+
|
|
8
|
+
typedef struct prof_allocation_t
|
|
9
|
+
{
|
|
10
|
+
st_data_t key; /* Key in hash table */
|
|
11
|
+
unsigned int klass_flags; /* Information about the type of class */
|
|
12
|
+
VALUE klass; /* Klass that was created */
|
|
13
|
+
VALUE klass_name; /* Name of the class that was created */
|
|
14
|
+
VALUE source_file; /* Line number where allocation happens */
|
|
15
|
+
int source_line; /* Line number where allocation happens */
|
|
16
|
+
int count; /* Number of allocations */
|
|
17
|
+
VALUE object; /* Cache to wrapped object */
|
|
18
|
+
} prof_allocation_t;
|
|
19
|
+
|
|
20
|
+
// Allocation (prof_allocation_t*)
|
|
21
|
+
void rp_init_allocation(void);
|
|
22
|
+
prof_allocation_t* prof_allocate_increment(st_table* allocations_table, rb_trace_arg_t* trace_arg);
|
|
23
|
+
|
|
24
|
+
// Allocations (st_table*)
|
|
25
|
+
st_table* prof_allocations_create(void);
|
|
26
|
+
VALUE prof_allocations_wrap(st_table* allocations_table);
|
|
27
|
+
void prof_allocations_unwrap(st_table* allocations_table, VALUE allocations);
|
|
28
|
+
void prof_allocations_mark(st_table* allocations_table);
|
|
29
|
+
void prof_allocations_free(st_table* table);
|
|
@@ -27,6 +27,9 @@ prof_call_tree_t* prof_call_tree_create(prof_method_t* method, prof_call_tree_t*
|
|
|
27
27
|
prof_call_tree_t* prof_call_tree_copy(prof_call_tree_t* other)
|
|
28
28
|
{
|
|
29
29
|
prof_call_tree_t* result = prof_call_tree_create(other->method, other->parent, other->source_file, other->source_line);
|
|
30
|
+
|
|
31
|
+
// Free the measurement created by prof_call_tree_create before replacing it with the copy
|
|
32
|
+
prof_measurement_free(result->measurement);
|
|
30
33
|
result->measurement = prof_measurement_copy(other->measurement);
|
|
31
34
|
|
|
32
35
|
return result;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/* Copyright (C) 2005-2019 Shugo Maeda <shugo@ruby-lang.org> and Charlie Savage <cfis@savagexi.com>
|
|
2
2
|
Please see the LICENSE file for copyright and distribution information */
|
|
3
3
|
|
|
4
|
-
#
|
|
5
|
-
#define __RP_CALL_TREE_H__
|
|
4
|
+
#pragma once
|
|
6
5
|
|
|
7
6
|
#include "ruby_prof.h"
|
|
8
7
|
#include "rp_measurement.h"
|
|
@@ -43,5 +42,3 @@ VALUE prof_call_tree_wrap(prof_call_tree_t* call_tree);
|
|
|
43
42
|
void prof_call_tree_free(prof_call_tree_t* call_tree);
|
|
44
43
|
|
|
45
44
|
void rp_init_call_tree(void);
|
|
46
|
-
|
|
47
|
-
#endif //__RP_CALL_TREE_H__
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/* Copyright (C) 2005-2013 Shugo Maeda <shugo@ruby-lang.org> and Charlie Savage <cfis@savagexi.com>
|
|
2
2
|
Please see the LICENSE file for copyright and distribution information */
|
|
3
3
|
|
|
4
|
-
#
|
|
5
|
-
#define __RP_CALL_TREES_H__
|
|
4
|
+
#pragma once
|
|
6
5
|
|
|
7
6
|
#include "ruby_prof.h"
|
|
8
7
|
#include "rp_call_tree.h"
|
|
@@ -24,5 +23,3 @@ void prof_call_trees_free(prof_call_trees_t* call_trees);
|
|
|
24
23
|
prof_call_trees_t* prof_get_call_trees(VALUE self);
|
|
25
24
|
void prof_add_call_tree(prof_call_trees_t* call_trees, prof_call_tree_t* call_tree);
|
|
26
25
|
VALUE prof_call_trees_wrap(prof_call_trees_t* call_trees);
|
|
27
|
-
|
|
28
|
-
#endif //__RP_CALL_TREES_H__
|
|
@@ -7,12 +7,10 @@ VALUE mMeasure;
|
|
|
7
7
|
VALUE cRpMeasurement;
|
|
8
8
|
|
|
9
9
|
prof_measurer_t* prof_measurer_allocations(bool track_allocations);
|
|
10
|
-
prof_measurer_t* prof_measurer_memory(bool track_allocations);
|
|
11
10
|
prof_measurer_t* prof_measurer_process_time(bool track_allocations);
|
|
12
11
|
prof_measurer_t* prof_measurer_wall_time(bool track_allocations);
|
|
13
12
|
|
|
14
13
|
void rp_init_measure_allocations(void);
|
|
15
|
-
void rp_init_measure_memory(void);
|
|
16
14
|
void rp_init_measure_process_time(void);
|
|
17
15
|
void rp_init_measure_wall_time(void);
|
|
18
16
|
|
|
@@ -26,8 +24,6 @@ prof_measurer_t* prof_measurer_create(prof_measure_mode_t measure, bool track_al
|
|
|
26
24
|
return prof_measurer_process_time(track_allocations);
|
|
27
25
|
case MEASURE_ALLOCATIONS:
|
|
28
26
|
return prof_measurer_allocations(track_allocations);
|
|
29
|
-
case MEASURE_MEMORY:
|
|
30
|
-
return prof_measurer_memory(track_allocations);
|
|
31
27
|
default:
|
|
32
28
|
rb_raise(rb_eArgError, "Unknown measure mode: %d", measure);
|
|
33
29
|
}
|
|
@@ -342,7 +338,6 @@ void rp_init_measure(void)
|
|
|
342
338
|
rp_init_measure_wall_time();
|
|
343
339
|
rp_init_measure_process_time();
|
|
344
340
|
rp_init_measure_allocations();
|
|
345
|
-
rp_init_measure_memory();
|
|
346
341
|
|
|
347
342
|
cRpMeasurement = rb_define_class_under(mProf, "Measurement", rb_cObject);
|
|
348
343
|
rb_define_alloc_func(cRpMeasurement, prof_measurement_allocate);
|