ruby-prof 2.0.4 → 2.0.5
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/CHANGELOG.md +6 -2
- data/lib/ruby-prof/printers/flame_graph_printer.rb +80 -78
- data/lib/ruby-prof/version.rb +1 -1
- metadata +4 -85
- data/Rakefile +0 -98
- data/docs/advanced-usage.md +0 -132
- data/docs/alternatives.md +0 -98
- data/docs/architecture.md +0 -304
- data/docs/best-practices.md +0 -27
- data/docs/getting-started.md +0 -130
- data/docs/history.md +0 -11
- data/docs/index.md +0 -45
- data/docs/profiling-rails.md +0 -64
- data/docs/public/examples/example.rb +0 -33
- data/docs/public/examples/generate_reports.rb +0 -92
- data/docs/public/examples/reports/call_info.txt +0 -27
- data/docs/public/examples/reports/call_stack.html +0 -835
- data/docs/public/examples/reports/callgrind.out +0 -150
- data/docs/public/examples/reports/flame_graph.html +0 -408
- data/docs/public/examples/reports/flat.txt +0 -45
- data/docs/public/examples/reports/graph.dot +0 -129
- data/docs/public/examples/reports/graph.html +0 -1319
- data/docs/public/examples/reports/graph.txt +0 -100
- data/docs/public/examples/reports/graphviz_viewer.html +0 -1
- 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 +0 -1
- data/docs/reports.md +0 -151
- data/docs/stylesheets/extra.css +0 -80
- data/ruby-prof.gemspec +0 -66
- data/test/abstract_printer_test.rb +0 -25
- data/test/alias_test.rb +0 -203
- data/test/call_tree_builder.rb +0 -126
- data/test/call_tree_test.rb +0 -94
- data/test/call_tree_visitor_test.rb +0 -27
- data/test/call_trees_test.rb +0 -66
- data/test/duplicate_names_test.rb +0 -32
- data/test/dynamic_method_test.rb +0 -50
- data/test/enumerable_test.rb +0 -23
- data/test/exceptions_test.rb +0 -24
- data/test/exclude_methods_test.rb +0 -363
- data/test/exclude_threads_test.rb +0 -48
- data/test/fiber_test.rb +0 -195
- data/test/gc_test.rb +0 -104
- data/test/inverse_call_tree_test.rb +0 -174
- data/test/line_number_test.rb +0 -563
- data/test/marshal_test.rb +0 -144
- data/test/measure_allocations.rb +0 -26
- data/test/measure_allocations_test.rb +0 -1511
- data/test/measure_process_time_test.rb +0 -3286
- data/test/measure_times.rb +0 -56
- data/test/measure_wall_time_test.rb +0 -774
- data/test/measurement_test.rb +0 -82
- data/test/merge_test.rb +0 -146
- data/test/method_info_test.rb +0 -100
- data/test/multi_printer_test.rb +0 -52
- data/test/no_method_class_test.rb +0 -15
- data/test/pause_resume_test.rb +0 -171
- data/test/prime.rb +0 -54
- data/test/prime_script.rb +0 -6
- data/test/printer_call_stack_test.rb +0 -28
- data/test/printer_call_tree_test.rb +0 -30
- data/test/printer_flame_graph_test.rb +0 -82
- data/test/printer_flat_test.rb +0 -110
- data/test/printer_graph_html_test.rb +0 -62
- data/test/printer_graph_test.rb +0 -42
- data/test/printers_test.rb +0 -162
- data/test/printing_recursive_graph_test.rb +0 -81
- data/test/profile_test.rb +0 -101
- data/test/rack_test.rb +0 -103
- data/test/recursive_test.rb +0 -796
- data/test/scheduler.rb +0 -367
- data/test/singleton_test.rb +0 -39
- data/test/stack_printer_test.rb +0 -61
- data/test/start_stop_test.rb +0 -106
- data/test/test_helper.rb +0 -24
- data/test/thread_test.rb +0 -229
- data/test/unique_call_path_test.rb +0 -123
- data/test/yarv_test.rb +0 -56
|
@@ -1,100 +0,0 @@
|
|
|
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
|
-
|
|
@@ -1 +0,0 @@
|
|
|
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
|
data/docs/public/images/flat.png
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
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
|
-
| `max_depth` | `nil` | Maximum call tree depth to display. When set, printers that walk the call tree stop descending beyond this depth. Applies to `FlameGraphPrinter`, `CallStackPrinter`, and `CallInfoPrinter`. |
|
|
45
|
-
|
|
46
|
-
## Report Types
|
|
47
|
-
|
|
48
|
-
### Flat
|
|
49
|
-
|
|
50
|
-
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>)
|
|
51
|
-
|
|
52
|
-

|
|
53
|
-
|
|
54
|
-
### Graph (Text)
|
|
55
|
-
|
|
56
|
-
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>)
|
|
57
|
-
|
|
58
|
-

|
|
59
|
-
|
|
60
|
-
### Graph (HTML)
|
|
61
|
-
|
|
62
|
-
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>)
|
|
63
|
-
|
|
64
|
-

|
|
65
|
-
|
|
66
|
-
Additional options:
|
|
67
|
-
|
|
68
|
-
| Option | Default | Description |
|
|
69
|
-
|--------|---------|-------------|
|
|
70
|
-
| `min_time` | `nil` | Minimum total time (in seconds) for a method to be shown. |
|
|
71
|
-
| `nonzero` | `false` | When `true`, sets `min_time` to 0.005 if `min_time` is not specified. |
|
|
72
|
-
|
|
73
|
-
### Flame Graph
|
|
74
|
-
|
|
75
|
-
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>)
|
|
76
|
-
|
|
77
|
-

|
|
78
|
-
|
|
79
|
-
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.
|
|
80
|
-
|
|
81
|
-
```ruby
|
|
82
|
-
printer = RubyProf::FlameGraphPrinter.new(result)
|
|
83
|
-
printer.print(File.open("flame_graph.html", "w"))
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
Additional options:
|
|
87
|
-
|
|
88
|
-
| Option | Default | Description |
|
|
89
|
-
|--------|---------|-------------|
|
|
90
|
-
| `title` | `"ruby-prof flame graph"` | Title displayed in the HTML report. |
|
|
91
|
-
|
|
92
|
-
### Call Stack
|
|
93
|
-
|
|
94
|
-
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>)
|
|
95
|
-
|
|
96
|
-

|
|
97
|
-
|
|
98
|
-
Additional options:
|
|
99
|
-
|
|
100
|
-
| Option | Default | Description |
|
|
101
|
-
|--------|---------|-------------|
|
|
102
|
-
| `title` | `"ruby-prof call stack"` | Title displayed in the HTML report. |
|
|
103
|
-
| `threshold` | `1.0` | Minimum %total for a node to be visible (0–100). |
|
|
104
|
-
| `expansion` | `10.0` | Minimum %total for a node to be expanded by default (0–100). |
|
|
105
|
-
| `application` | `$PROGRAM_NAME` | Application name displayed in the report. |
|
|
106
|
-
|
|
107
|
-
### Graphviz
|
|
108
|
-
|
|
109
|
-
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>)
|
|
110
|
-
|
|
111
|
-

|
|
112
|
-
|
|
113
|
-
### Cachegrind
|
|
114
|
-
|
|
115
|
-
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>)
|
|
116
|
-
|
|
117
|
-
Additional options:
|
|
118
|
-
|
|
119
|
-
| Option | Default | Description |
|
|
120
|
-
|--------|---------|-------------|
|
|
121
|
-
| `path` | `"."` | Directory where callgrind output files are written. |
|
|
122
|
-
|
|
123
|
-
### Call Info Report
|
|
124
|
-
|
|
125
|
-
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>)
|
|
126
|
-
|
|
127
|
-
### Multiple Reports
|
|
128
|
-
|
|
129
|
-
`RubyProf::MultiPrinter` can generate several reports in one profiling run. It requires a directory path and a profile basename for the files it produces:
|
|
130
|
-
|
|
131
|
-
```ruby
|
|
132
|
-
printer = RubyProf::MultiPrinter.new(result)
|
|
133
|
-
printer.print(path: ".", profile: "profile")
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
| Option | Default | Description |
|
|
137
|
-
|--------|---------|-------------|
|
|
138
|
-
| `path` | `"."` | Directory where report files are written. |
|
|
139
|
-
| `profile` | `"profile"` | Base filename for the generated reports. |
|
|
140
|
-
|
|
141
|
-
All other keyword arguments are forwarded to the individual printers.
|
|
142
|
-
|
|
143
|
-
## Generating Examples
|
|
144
|
-
|
|
145
|
-
To regenerate the example reports:
|
|
146
|
-
|
|
147
|
-
```
|
|
148
|
-
ruby docs/public/examples/generate_reports.rb
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
This profiles a small word-frequency workload and writes reports to `docs/public/examples/reports/`.
|
data/docs/stylesheets/extra.css
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
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
|
-
}
|
data/ruby-prof.gemspec
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
$:.push File.expand_path("../lib", __FILE__)
|
|
4
|
-
require "ruby-prof/version"
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name = "ruby-prof"
|
|
8
|
-
|
|
9
|
-
spec.homepage = "https://github.com/ruby-prof/ruby-prof/"
|
|
10
|
-
spec.summary = "Fast Ruby profiler"
|
|
11
|
-
spec.description = <<-EOF
|
|
12
|
-
ruby-prof is a fast code profiler for Ruby. It is a C extension and
|
|
13
|
-
therefore is many times faster than the standard Ruby profiler. It
|
|
14
|
-
supports both flat and graph profiles. For each method, graph profiles
|
|
15
|
-
show how long the method ran, which methods called it and which
|
|
16
|
-
methods it called. RubyProf generate both text and html and can output
|
|
17
|
-
it to standard out or to a file.
|
|
18
|
-
EOF
|
|
19
|
-
spec.license = 'BSD-2-Clause'
|
|
20
|
-
spec.version = RubyProf::VERSION
|
|
21
|
-
|
|
22
|
-
spec.metadata = {
|
|
23
|
-
"bug_tracker_uri" => "https://github.com/ruby-prof/ruby-prof/issues",
|
|
24
|
-
"changelog_uri" => "https://github.com/ruby-prof/ruby-prof/blob/master/CHANGELOG.md",
|
|
25
|
-
"documentation_uri" => "https://ruby-prof.github.io/",
|
|
26
|
-
"source_code_uri" => "https://github.com/ruby-prof/ruby-prof/tree/#{spec.version}",
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
spec.author = "Shugo Maeda, Charlie Savage, Roger Pack, Stefan Kaes"
|
|
30
|
-
spec.email = "shugo@ruby-lang.org, cfis@savagexi.com, rogerdpack@gmail.com, skaes@railsexpress.de"
|
|
31
|
-
spec.platform = Gem::Platform::RUBY
|
|
32
|
-
spec.require_path = "lib"
|
|
33
|
-
spec.bindir = "bin"
|
|
34
|
-
spec.executables = ["ruby-prof", "ruby-prof-check-trace"]
|
|
35
|
-
spec.extensions = ["ext/ruby_prof/extconf.rb"]
|
|
36
|
-
spec.files = Dir['CHANGELOG.md',
|
|
37
|
-
'LICENSE',
|
|
38
|
-
'Rakefile',
|
|
39
|
-
'README.md',
|
|
40
|
-
'ruby-prof.gemspec',
|
|
41
|
-
'bin/ruby-prof',
|
|
42
|
-
'bin/ruby-prof-check-trace',
|
|
43
|
-
'docs/**/*',
|
|
44
|
-
'ext/ruby_prof/extconf.rb',
|
|
45
|
-
'ext/ruby_prof/*.c',
|
|
46
|
-
'ext/ruby_prof/*.h',
|
|
47
|
-
'ext/ruby_prof/vc/*.sln',
|
|
48
|
-
'ext/ruby_prof/vc/*.vcxproj',
|
|
49
|
-
'lib/ruby-prof.rb',
|
|
50
|
-
'lib/unprof.rb',
|
|
51
|
-
'lib/ruby-prof/*.rb',
|
|
52
|
-
'lib/ruby-prof/assets/*',
|
|
53
|
-
'lib/ruby-prof/profile/*.rb',
|
|
54
|
-
'lib/ruby-prof/printers/*.rb',
|
|
55
|
-
'test/*.rb']
|
|
56
|
-
|
|
57
|
-
spec.test_files = Dir["test/test_*.rb"]
|
|
58
|
-
spec.required_ruby_version = '>= 3.2.0'
|
|
59
|
-
spec.date = Time.now.strftime('%Y-%m-%d')
|
|
60
|
-
spec.homepage = 'https://github.com/ruby-prof/ruby-prof'
|
|
61
|
-
spec.add_dependency('base64')
|
|
62
|
-
spec.add_dependency('ostruct')
|
|
63
|
-
spec.add_development_dependency('minitest')
|
|
64
|
-
spec.add_development_dependency('rake-compiler')
|
|
65
|
-
spec.add_development_dependency('rdoc')
|
|
66
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# encoding: UTF-8
|
|
3
|
-
|
|
4
|
-
require File.expand_path('../test_helper', __FILE__)
|
|
5
|
-
|
|
6
|
-
class AbstractPrinterTest < TestCase
|
|
7
|
-
def setup
|
|
8
|
-
super
|
|
9
|
-
@result = {}
|
|
10
|
-
@printer = RubyProf::AbstractPrinter.new(@result)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
private
|
|
14
|
-
|
|
15
|
-
def with_const_stubbed(name, value)
|
|
16
|
-
old_verbose, $VERBOSE = $VERBOSE, nil
|
|
17
|
-
old_value = Object.const_get(name)
|
|
18
|
-
|
|
19
|
-
Object.const_set(name, value)
|
|
20
|
-
yield
|
|
21
|
-
Object.const_set(name, old_value)
|
|
22
|
-
|
|
23
|
-
$VERBOSE = old_verbose
|
|
24
|
-
end
|
|
25
|
-
end
|
data/test/alias_test.rb
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# encoding: UTF-8
|
|
3
|
-
|
|
4
|
-
require File.expand_path("../test_helper", __FILE__)
|
|
5
|
-
|
|
6
|
-
class AliasTest < TestCase
|
|
7
|
-
class TestMe
|
|
8
|
-
def some_method
|
|
9
|
-
sleep(0.1)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
alias :some_method_original :some_method
|
|
13
|
-
def some_method
|
|
14
|
-
some_method_original
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('4.0')
|
|
19
|
-
def test_alias
|
|
20
|
-
result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) do
|
|
21
|
-
TestMe.new.some_method
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
methods = result.threads.first.methods
|
|
25
|
-
assert_equal(6, methods.count)
|
|
26
|
-
|
|
27
|
-
# Method 0
|
|
28
|
-
method = methods[0]
|
|
29
|
-
assert_equal('AliasTest#test_alias', method.full_name)
|
|
30
|
-
assert_equal(21, method.line)
|
|
31
|
-
refute(method.recursive?)
|
|
32
|
-
|
|
33
|
-
assert_equal(0, method.call_trees.callers.count)
|
|
34
|
-
|
|
35
|
-
assert_equal(2, method.call_trees.callees.count)
|
|
36
|
-
call_tree = method.call_trees.callees[0]
|
|
37
|
-
assert_equal('Class#new', call_tree.target.full_name)
|
|
38
|
-
assert_equal(21, call_tree.line)
|
|
39
|
-
|
|
40
|
-
call_tree = method.call_trees.callees[1]
|
|
41
|
-
assert_equal('AliasTest::TestMe#some_method', call_tree.target.full_name)
|
|
42
|
-
assert_equal(21, call_tree.line)
|
|
43
|
-
|
|
44
|
-
# Method 1
|
|
45
|
-
method = methods[1]
|
|
46
|
-
assert_equal('Class#new', method.full_name)
|
|
47
|
-
assert_equal(0, method.line)
|
|
48
|
-
refute(method.recursive?)
|
|
49
|
-
|
|
50
|
-
assert_equal(1, method.call_trees.callers.count)
|
|
51
|
-
call_tree = method.call_trees.callers[0]
|
|
52
|
-
assert_equal('AliasTest#test_alias', call_tree.parent.target.full_name)
|
|
53
|
-
assert_equal(21, call_tree.line)
|
|
54
|
-
|
|
55
|
-
assert_equal(1, method.call_trees.callees.count)
|
|
56
|
-
call_tree = method.call_trees.callees[0]
|
|
57
|
-
assert_equal('BasicObject#initialize', call_tree.target.full_name)
|
|
58
|
-
assert_equal(0, call_tree.line)
|
|
59
|
-
|
|
60
|
-
# Method 2
|
|
61
|
-
method = methods[2]
|
|
62
|
-
assert_equal('BasicObject#initialize', method.full_name)
|
|
63
|
-
assert_equal(0, method.line)
|
|
64
|
-
refute(method.recursive?)
|
|
65
|
-
|
|
66
|
-
assert_equal(1, method.call_trees.callers.count)
|
|
67
|
-
call_tree = method.call_trees.callers[0]
|
|
68
|
-
assert_equal('Class#new', call_tree.parent.target.full_name)
|
|
69
|
-
assert_equal(0, call_tree.line)
|
|
70
|
-
|
|
71
|
-
assert_equal(0, method.call_trees.callees.count)
|
|
72
|
-
|
|
73
|
-
# Method 3
|
|
74
|
-
method = methods[3]
|
|
75
|
-
assert_equal('AliasTest::TestMe#some_method', method.full_name)
|
|
76
|
-
assert_equal(13, method.line)
|
|
77
|
-
refute(method.recursive?)
|
|
78
|
-
|
|
79
|
-
assert_equal(1, method.call_trees.callers.count)
|
|
80
|
-
call_tree = method.call_trees.callers[0]
|
|
81
|
-
assert_equal('AliasTest#test_alias', call_tree.parent.target.full_name)
|
|
82
|
-
assert_equal(21, call_tree.line)
|
|
83
|
-
|
|
84
|
-
assert_equal(1, method.call_trees.callees.count)
|
|
85
|
-
call_tree = method.call_trees.callees[0]
|
|
86
|
-
assert_equal('AliasTest::TestMe#some_method_original', call_tree.target.full_name)
|
|
87
|
-
assert_equal(14, call_tree.line)
|
|
88
|
-
|
|
89
|
-
# Method 4
|
|
90
|
-
method = methods[4]
|
|
91
|
-
assert_equal('AliasTest::TestMe#some_method_original', method.full_name)
|
|
92
|
-
assert_equal(8, method.line)
|
|
93
|
-
refute(method.recursive?)
|
|
94
|
-
|
|
95
|
-
assert_equal(1, method.call_trees.callers.count)
|
|
96
|
-
call_tree = method.call_trees.callers[0]
|
|
97
|
-
assert_equal('AliasTest::TestMe#some_method', call_tree.parent.target.full_name)
|
|
98
|
-
assert_equal(14, call_tree.line)
|
|
99
|
-
|
|
100
|
-
assert_equal(1, method.call_trees.callees.count)
|
|
101
|
-
call_tree = method.call_trees.callees[0]
|
|
102
|
-
assert_equal('Kernel#sleep', call_tree.target.full_name)
|
|
103
|
-
assert_equal(9, call_tree.line)
|
|
104
|
-
|
|
105
|
-
# Method 5
|
|
106
|
-
method = methods[5]
|
|
107
|
-
assert_equal('Kernel#sleep', method.full_name)
|
|
108
|
-
assert_equal(0, method.line)
|
|
109
|
-
refute(method.recursive?)
|
|
110
|
-
|
|
111
|
-
assert_equal(1, method.call_trees.callers.count)
|
|
112
|
-
call_tree = method.call_trees.callers[0]
|
|
113
|
-
assert_equal('AliasTest::TestMe#some_method_original', call_tree.parent.target.full_name)
|
|
114
|
-
assert_equal(9, call_tree.line)
|
|
115
|
-
|
|
116
|
-
assert_equal(0, method.call_trees.callees.count)
|
|
117
|
-
end
|
|
118
|
-
else
|
|
119
|
-
def test_alias
|
|
120
|
-
result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) do
|
|
121
|
-
TestMe.new.some_method
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
methods = result.threads.first.methods
|
|
125
|
-
assert_equal(5, methods.count)
|
|
126
|
-
|
|
127
|
-
# Method 0
|
|
128
|
-
method = methods[0]
|
|
129
|
-
assert_equal('AliasTest#test_alias', method.full_name)
|
|
130
|
-
assert_equal(121, method.line)
|
|
131
|
-
refute(method.recursive?)
|
|
132
|
-
|
|
133
|
-
assert_equal(0, method.call_trees.callers.count)
|
|
134
|
-
|
|
135
|
-
assert_equal(2, method.call_trees.callees.count)
|
|
136
|
-
call_tree = method.call_trees.callees[0]
|
|
137
|
-
assert_equal('BasicObject#initialize', call_tree.target.full_name)
|
|
138
|
-
assert_equal(121, call_tree.line)
|
|
139
|
-
|
|
140
|
-
call_tree = method.call_trees.callees[1]
|
|
141
|
-
assert_equal('AliasTest::TestMe#some_method', call_tree.target.full_name)
|
|
142
|
-
assert_equal(121, call_tree.line)
|
|
143
|
-
|
|
144
|
-
# Method 1
|
|
145
|
-
method = methods[1]
|
|
146
|
-
assert_equal('BasicObject#initialize', method.full_name)
|
|
147
|
-
assert_equal(0, method.line)
|
|
148
|
-
refute(method.recursive?)
|
|
149
|
-
|
|
150
|
-
assert_equal(1, method.call_trees.callers.count)
|
|
151
|
-
call_tree = method.call_trees.callers[0]
|
|
152
|
-
assert_equal('AliasTest#test_alias', call_tree.parent.target.full_name)
|
|
153
|
-
assert_equal(121, call_tree.line)
|
|
154
|
-
|
|
155
|
-
assert_equal(0, method.call_trees.callees.count)
|
|
156
|
-
|
|
157
|
-
# Method 2
|
|
158
|
-
method = methods[2]
|
|
159
|
-
assert_equal('AliasTest::TestMe#some_method', method.full_name)
|
|
160
|
-
assert_equal(13, method.line)
|
|
161
|
-
refute(method.recursive?)
|
|
162
|
-
|
|
163
|
-
assert_equal(1, method.call_trees.callers.count)
|
|
164
|
-
call_tree = method.call_trees.callers[0]
|
|
165
|
-
assert_equal('AliasTest#test_alias', call_tree.parent.target.full_name)
|
|
166
|
-
assert_equal(121, call_tree.line)
|
|
167
|
-
|
|
168
|
-
assert_equal(1, method.call_trees.callees.count)
|
|
169
|
-
call_tree = method.call_trees.callees[0]
|
|
170
|
-
assert_equal('AliasTest::TestMe#some_method_original', call_tree.target.full_name)
|
|
171
|
-
assert_equal(14, call_tree.line)
|
|
172
|
-
|
|
173
|
-
# Method 3
|
|
174
|
-
method = methods[3]
|
|
175
|
-
assert_equal('AliasTest::TestMe#some_method_original', method.full_name)
|
|
176
|
-
assert_equal(8, method.line)
|
|
177
|
-
refute(method.recursive?)
|
|
178
|
-
|
|
179
|
-
assert_equal(1, method.call_trees.callers.count)
|
|
180
|
-
call_tree = method.call_trees.callers[0]
|
|
181
|
-
assert_equal('AliasTest::TestMe#some_method', call_tree.parent.target.full_name)
|
|
182
|
-
assert_equal(14, call_tree.line)
|
|
183
|
-
|
|
184
|
-
assert_equal(1, method.call_trees.callees.count)
|
|
185
|
-
call_tree = method.call_trees.callees[0]
|
|
186
|
-
assert_equal('Kernel#sleep', call_tree.target.full_name)
|
|
187
|
-
assert_equal(9, call_tree.line)
|
|
188
|
-
|
|
189
|
-
# Method 4
|
|
190
|
-
method = methods[4]
|
|
191
|
-
assert_equal('Kernel#sleep', method.full_name)
|
|
192
|
-
assert_equal(0, method.line)
|
|
193
|
-
refute(method.recursive?)
|
|
194
|
-
|
|
195
|
-
assert_equal(1, method.call_trees.callers.count)
|
|
196
|
-
call_tree = method.call_trees.callers[0]
|
|
197
|
-
assert_equal('AliasTest::TestMe#some_method_original', call_tree.parent.target.full_name)
|
|
198
|
-
assert_equal(9, call_tree.line)
|
|
199
|
-
|
|
200
|
-
assert_equal(0, method.call_trees.callees.count)
|
|
201
|
-
end
|
|
202
|
-
end
|
|
203
|
-
end
|