ruby-prof 1.5.0-x64-mingw-ucrt → 1.6.2-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +19 -0
  3. data/bin/ruby-prof +105 -87
  4. data/ext/ruby_prof/rp_allocation.c +136 -81
  5. data/ext/ruby_prof/rp_allocation.h +8 -6
  6. data/ext/ruby_prof/rp_call_tree.c +502 -457
  7. data/ext/ruby_prof/rp_call_tree.h +47 -44
  8. data/ext/ruby_prof/rp_call_trees.c +1 -1
  9. data/ext/ruby_prof/rp_measurement.c +10 -3
  10. data/ext/ruby_prof/rp_method.c +86 -79
  11. data/ext/ruby_prof/rp_method.h +63 -62
  12. data/ext/ruby_prof/rp_profile.c +933 -948
  13. data/ext/ruby_prof/rp_profile.h +1 -0
  14. data/ext/ruby_prof/rp_thread.c +433 -410
  15. data/ext/ruby_prof/rp_thread.h +39 -39
  16. data/ext/ruby_prof/vc/ruby_prof.vcxproj +6 -3
  17. data/lib/3.1/ruby_prof.so +0 -0
  18. data/lib/3.2/ruby_prof.so +0 -0
  19. data/lib/ruby-prof/compatibility.rb +14 -0
  20. data/lib/ruby-prof/printers/abstract_printer.rb +2 -1
  21. data/lib/ruby-prof/printers/call_tree_printer.rb +1 -1
  22. data/lib/ruby-prof/printers/multi_printer.rb +17 -17
  23. data/lib/ruby-prof/profile.rb +70 -70
  24. data/lib/ruby-prof/rack.rb +31 -21
  25. data/lib/ruby-prof/version.rb +1 -1
  26. data/test/abstract_printer_test.rb +1 -0
  27. data/test/alias_test.rb +6 -11
  28. data/test/call_tree_test.rb +94 -197
  29. data/test/call_tree_visitor_test.rb +1 -6
  30. data/test/call_trees_test.rb +2 -2
  31. data/test/{basic_test.rb → compatibility_test.rb} +8 -2
  32. data/test/duplicate_names_test.rb +1 -1
  33. data/test/dynamic_method_test.rb +1 -6
  34. data/test/enumerable_test.rb +1 -1
  35. data/test/exceptions_test.rb +2 -2
  36. data/test/exclude_methods_test.rb +3 -8
  37. data/test/exclude_threads_test.rb +4 -9
  38. data/test/fiber_test.rb +2 -58
  39. data/test/gc_test.rb +2 -2
  40. data/test/inverse_call_tree_test.rb +33 -34
  41. data/test/line_number_test.rb +1 -1
  42. data/test/marshal_test.rb +3 -3
  43. data/test/measure_allocations_test.rb +8 -17
  44. data/test/measure_memory_test.rb +3 -12
  45. data/test/measure_process_time_test.rb +32 -36
  46. data/test/measure_wall_time_test.rb +176 -181
  47. data/test/merge_test.rb +146 -0
  48. data/test/multi_printer_test.rb +0 -5
  49. data/test/no_method_class_test.rb +1 -1
  50. data/test/pause_resume_test.rb +12 -16
  51. data/test/printer_call_stack_test.rb +2 -2
  52. data/test/printer_call_tree_test.rb +2 -2
  53. data/test/printer_flat_test.rb +1 -1
  54. data/test/printer_graph_html_test.rb +2 -2
  55. data/test/printer_graph_test.rb +2 -2
  56. data/test/printers_test.rb +14 -20
  57. data/test/printing_recursive_graph_test.rb +2 -2
  58. data/test/recursive_test.rb +2 -7
  59. data/test/scheduler.rb +9 -0
  60. data/test/singleton_test.rb +1 -1
  61. data/test/stack_printer_test.rb +5 -8
  62. data/test/start_stop_test.rb +11 -14
  63. data/test/test_helper.rb +7 -0
  64. data/test/thread_test.rb +84 -19
  65. data/test/unique_call_path_test.rb +4 -4
  66. data/test/yarv_test.rb +3 -3
  67. metadata +6 -5
@@ -1,39 +1,39 @@
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
- #ifndef __RP_THREAD__
5
- #define __RP_THREAD__
6
-
7
- #include "ruby_prof.h"
8
- #include "rp_stack.h"
9
-
10
- /* Profiling information for a thread. */
11
- typedef struct thread_data_t
12
- {
13
- prof_owner_t owner; /* Who owns this object */
14
- VALUE object; /* Cache to wrapped object */
15
- VALUE fiber; /* Fiber */
16
- prof_stack_t* stack; /* Stack of frames */
17
- bool trace; /* Are we tracking this thread */
18
- prof_call_tree_t* call_tree; /* The root of the call tree*/
19
- VALUE thread_id; /* Thread id */
20
- VALUE fiber_id; /* Fiber id */
21
- VALUE methods; /* Array of RubyProf::MethodInfo */
22
- st_table* method_table; /* Methods called in the thread */
23
- } thread_data_t;
24
-
25
- void rp_init_thread(void);
26
- st_table* threads_table_create(void);
27
- thread_data_t* threads_table_lookup(void* profile, VALUE fiber);
28
- thread_data_t* threads_table_insert(void* profile, VALUE fiber);
29
- void threads_table_free(st_table* table);
30
-
31
- thread_data_t* prof_get_thread(VALUE self);
32
- VALUE prof_thread_wrap(thread_data_t* thread);
33
- void prof_thread_mark(void* data);
34
-
35
- void switch_thread(void* profile, thread_data_t* thread_data, double measurement);
36
- int pause_thread(st_data_t key, st_data_t value, st_data_t data);
37
- int unpause_thread(st_data_t key, st_data_t value, st_data_t data);
38
-
39
- #endif //__RP_THREAD__
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
+ #ifndef __RP_THREAD__
5
+ #define __RP_THREAD__
6
+
7
+ #include "ruby_prof.h"
8
+ #include "rp_stack.h"
9
+
10
+ /* Profiling information for a thread. */
11
+ typedef struct thread_data_t
12
+ {
13
+ prof_owner_t owner; /* Who owns this object */
14
+ VALUE object; /* Cache to wrapped object */
15
+ VALUE fiber; /* Fiber */
16
+ prof_stack_t* stack; /* Stack of frames */
17
+ bool trace; /* Are we tracking this thread */
18
+ prof_call_tree_t* call_tree; /* The root of the call tree*/
19
+ VALUE thread_id; /* Thread id */
20
+ VALUE fiber_id; /* Fiber id */
21
+ VALUE methods; /* Array of RubyProf::MethodInfo */
22
+ st_table* method_table; /* Methods called in the thread */
23
+ } thread_data_t;
24
+
25
+ void rp_init_thread(void);
26
+ st_table* threads_table_create(void);
27
+ thread_data_t* threads_table_lookup(void* profile, VALUE fiber);
28
+ thread_data_t* threads_table_insert(void* profile, VALUE fiber);
29
+ void threads_table_free(st_table* table);
30
+
31
+ thread_data_t* prof_get_thread(VALUE self);
32
+ VALUE prof_thread_wrap(thread_data_t* thread);
33
+ void prof_thread_mark(void* data);
34
+
35
+ void switch_thread(void* profile, thread_data_t* thread_data, double measurement);
36
+ int pause_thread(st_data_t key, st_data_t value, st_data_t data);
37
+ int unpause_thread(st_data_t key, st_data_t value, st_data_t data);
38
+
39
+ #endif //__RP_THREAD__
@@ -66,7 +66,7 @@
66
66
  </PropertyGroup>
67
67
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
68
68
  <TargetExt>.so</TargetExt>
69
- <OutDir>$(SolutionDir)\..\..\..\lib\</OutDir>
69
+ <OutDir>$(SolutionDir)\..</OutDir>
70
70
  </PropertyGroup>
71
71
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
72
72
  <ClCompile>
@@ -104,17 +104,20 @@
104
104
  </ItemDefinitionGroup>
105
105
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
106
106
  <ClCompile>
107
- <AdditionalIncludeDirectories>C:\msys64\usr\local\ruby-3.2.0-vc\include\ruby-3.2.0\x64-mswin64_140;C:\msys64\usr\local\ruby-3.2.0-vc\include\ruby-3.2.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
107
+ <AdditionalIncludeDirectories>C:\msys64\usr\local\ruby-3.2.1-vc\include\ruby-3.2.0\x64-mswin64_140;C:\msys64\usr\local\ruby-3.2.1-vc\include\ruby-3.2.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
108
108
  <Optimization>Disabled</Optimization>
109
109
  <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
110
110
  <WarningLevel>Level3</WarningLevel>
111
111
  </ClCompile>
112
112
  <Link>
113
- <AdditionalLibraryDirectories>C:\msys64\usr\local\ruby-3.2.0-vc\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
113
+ <AdditionalLibraryDirectories>C:\msys64\usr\local\ruby-3.2.1-vc\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
114
114
  <AdditionalDependencies>x64-vcruntime140-ruby320.lib;%(AdditionalDependencies)</AdditionalDependencies>
115
115
  <ModuleDefinitionFile>ruby_prof.def</ModuleDefinitionFile>
116
116
  <SubSystem>Console</SubSystem>
117
117
  </Link>
118
+ <ProjectReference>
119
+ <LinkLibraryDependencies>false</LinkLibraryDependencies>
120
+ </ProjectReference>
118
121
  </ItemDefinitionGroup>
119
122
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
120
123
  <ClCompile>
data/lib/3.1/ruby_prof.so CHANGED
Binary file
data/lib/3.2/ruby_prof.so CHANGED
Binary file
@@ -96,4 +96,18 @@ module RubyProf
96
96
  def self.ensure_not_running!
97
97
  raise(RuntimeError, "RubyProf is already running") if running?
98
98
  end
99
+
100
+ class << self
101
+ extend Gem::Deprecate
102
+ deprecate :measure_mode, "Profile#measure_mode", 2023, 6
103
+ deprecate :measure_mode=, "Profile#measure_mode=", 2023, 6
104
+ deprecate :exclude_threads, "Profile#exclude_threads", 2023, 6
105
+ deprecate :exclude_threads=, "Profile#initialize", 2023, 6
106
+ deprecate :start, "Profile#start", 2023, 6
107
+ deprecate :pause, "Profile#pause", 2023, 6
108
+ deprecate :stop, "Profile#stop", 2023, 6
109
+ deprecate :resume, "Profile#resume", 2023, 6
110
+ deprecate :running?, "Profile#running?", 2023, 6
111
+ deprecate :profile, "Profile.profile", 2023, 6
112
+ end
99
113
  end
@@ -50,7 +50,7 @@ module RubyProf
50
50
  # options - Hash of print options. Note that each printer can
51
51
  # define its own set of options.
52
52
  #
53
- # :min_percent - Number 0 to 100 that specifes the minimum
53
+ # :min_percent - Number 0 to 100 that specifies the minimum
54
54
  # %self (the methods self time divided by the
55
55
  # overall total time) that a method must take
56
56
  # for it to be printed out in the report.
@@ -131,6 +131,7 @@ module RubyProf
131
131
 
132
132
  * MyObject#test - An instance method "test" of the class "MyObject"
133
133
  * <Object:MyObject>#test - The <> characters indicate a method on a singleton class.
134
+
134
135
  EOT
135
136
  end
136
137
  end
@@ -27,7 +27,7 @@ module RubyProf
27
27
 
28
28
  def determine_event_specification_and_value_scale
29
29
  @event_specification = "events: "
30
- case RubyProf.measure_mode
30
+ case @result.measure_mode
31
31
  when RubyProf::PROCESS_TIME
32
32
  @value_scale = RubyProf::CLOCKS_PER_SEC
33
33
  @event_specification << 'process_time'
@@ -6,16 +6,16 @@ module RubyProf
6
6
  # profile, a call stack profile and a graph profile.
7
7
  class MultiPrinter
8
8
  def initialize(result, printers = [:flat, :graph_html])
9
- @flat_printer = FlatPrinter.new(result) if printers.include?(:flat)
9
+ @flat_printer = printers.include?(:flat) ? FlatPrinter.new(result) : nil
10
10
 
11
- @graph_printer = GraphPrinter.new(result) if printers.include?(:graph)
12
- @graph_html_printer = GraphHtmlPrinter.new(result) if printers.include?(:graph_html)
11
+ @graph_printer = printers.include?(:graph) ? GraphPrinter.new(result) : nil
12
+ @graph_html_printer = printers.include?(:graph_html) ? GraphHtmlPrinter.new(result) : nil
13
13
 
14
- @tree_printer = CallTreePrinter.new(result) if printers.include?(:tree)
15
- @call_info_printer = CallInfoPrinter.new(result) if printers.include?(:call_tree)
14
+ @tree_printer = printers.include?(:tree) ? CallTreePrinter.new(result) : nil
15
+ @call_info_printer = printers.include?(:call_tree) ? CallInfoPrinter.new(result) : nil
16
16
 
17
- @stack_printer = CallStackPrinter.new(result) if printers.include?(:stack)
18
- @dot_printer = DotPrinter.new(result) if printers.include?(:dot)
17
+ @stack_printer = printers.include?(:stack) ? CallStackPrinter.new(result) : nil
18
+ @dot_printer = printers.include?(:dot) ? DotPrinter.new(result) : nil
19
19
  end
20
20
 
21
21
  def self.needs_dir?
@@ -28,7 +28,7 @@ module RubyProf
28
28
  def print(options)
29
29
  validate_print_params(options)
30
30
 
31
- @profile = options.delete(:profile) || "profile"
31
+ @file_name = options.delete(:profile) || "profile"
32
32
  @directory = options.delete(:path) || File.expand_path(".")
33
33
 
34
34
  print_to_flat(options) if @flat_printer
@@ -44,36 +44,36 @@ module RubyProf
44
44
 
45
45
  # the name of the flat profile file
46
46
  def flat_report
47
- "#{@directory}/#{@profile}.flat.txt"
47
+ "#{@directory}/#{@file_name}.flat.txt"
48
48
  end
49
49
 
50
50
  # the name of the graph profile file
51
51
  def graph_report
52
- "#{@directory}/#{@profile}.graph.txt"
52
+ "#{@directory}/#{@file_name}.graph.txt"
53
53
  end
54
54
 
55
55
  def graph_html_report
56
- "#{@directory}/#{@profile}.graph.html"
56
+ "#{@directory}/#{@file_name}.graph.html"
57
57
  end
58
58
 
59
59
  # the name of the callinfo profile file
60
60
  def call_info_report
61
- "#{@directory}/#{@profile}.call_tree.txt"
61
+ "#{@directory}/#{@file_name}.call_tree.txt"
62
62
  end
63
63
 
64
64
  # the name of the callgrind profile file
65
65
  def tree_report
66
- "#{@directory}/#{@profile}.callgrind.out.#{$$}"
66
+ "#{@directory}/#{@file_name}.callgrind.out.#{$$}"
67
67
  end
68
68
 
69
69
  # the name of the call stack profile file
70
70
  def stack_report
71
- "#{@directory}/#{@profile}.stack.html"
71
+ "#{@directory}/#{@file_name}.stack.html"
72
72
  end
73
73
 
74
74
  # the name of the call stack profile file
75
75
  def dot_report
76
- "#{@directory}/#{@profile}.dot"
76
+ "#{@directory}/#{@file_name}.dot"
77
77
  end
78
78
 
79
79
  def print_to_flat(options)
@@ -101,12 +101,12 @@ module RubyProf
101
101
  end
102
102
 
103
103
  def print_to_tree(options)
104
- @tree_printer.print(options.merge(:path => @directory, :profile => @profile))
104
+ @tree_printer.print(options.merge(:path => @directory, :profile => @file_name))
105
105
  end
106
106
 
107
107
  def print_to_stack(options)
108
108
  File.open(stack_report, "wb") do |file|
109
- @stack_printer.print(file, options.merge(:graph => "#{@profile}.graph.html"))
109
+ @stack_printer.print(file, options.merge(:graph => "#{@file_name}.graph.html"))
110
110
  end
111
111
  end
112
112
 
@@ -1,70 +1,70 @@
1
- # encoding: utf-8
2
-
3
- require 'ruby-prof/exclude_common_methods'
4
-
5
- module RubyProf
6
- class Profile
7
- def measure_mode_string
8
- case self.measure_mode
9
- when WALL_TIME
10
- "wall_time"
11
- when PROCESS_TIME
12
- "process_time"
13
- when ALLOCATIONS
14
- "allocations"
15
- when MEMORY
16
- "memory"
17
- end
18
- end
19
-
20
- # Hides methods that, when represented as a call graph, have
21
- # extremely large in and out degrees and make navigation impossible.
22
- def exclude_common_methods!
23
- ExcludeCommonMethods.apply!(self)
24
- end
25
-
26
- def exclude_methods!(mod, *method_or_methods)
27
- [method_or_methods].flatten.each do |name|
28
- exclude_method!(mod, name)
29
- end
30
- end
31
-
32
- def exclude_singleton_methods!(mod, *method_or_methods)
33
- exclude_methods!(mod.singleton_class, *method_or_methods)
34
- end
35
-
36
- # call-seq:
37
- # merge! -> self
38
- #
39
- # Merges RubyProf threads whose root call_trees reference the same target method. This is useful
40
- # when profiling code that uses a main thread/fiber to distribute work to multiple workers.
41
- # If there are tens or hundreds of workers, viewing results per worker thread/fiber can be
42
- # overwhelming. Using +merge!+ will combine the worker times together into one result.
43
- #
44
- # Note the reported time will be much greater than the actual wall time. For example, if there
45
- # are 10 workers that each run for 5 seconds, merged results will show one thread that
46
- # ran for 50 seconds.
47
- #
48
- def merge!
49
- # First group threads by their root call tree target (method). If the methods are
50
- # different than there is nothing to merge
51
- grouped = threads.group_by do |thread|
52
- thread.call_tree.target
53
- end
54
-
55
- # For each target, get the first thread. Then loop over the remaining threads,
56
- # and merge them into the first one and ten delete them. So we will be left with
57
- # one thread per target.
58
- grouped.each do |target, threads|
59
- thread = threads.shift
60
- threads.each do |other_thread|
61
- thread.merge!(other_thread)
62
- remove_thread(other_thread)
63
- end
64
- thread
65
- end
66
-
67
- self
68
- end
69
- end
70
- end
1
+ # encoding: utf-8
2
+
3
+ require 'ruby-prof/exclude_common_methods'
4
+
5
+ module RubyProf
6
+ class Profile
7
+ def measure_mode_string
8
+ case self.measure_mode
9
+ when WALL_TIME
10
+ "wall_time"
11
+ when PROCESS_TIME
12
+ "process_time"
13
+ when ALLOCATIONS
14
+ "allocations"
15
+ when MEMORY
16
+ "memory"
17
+ end
18
+ end
19
+
20
+ # Hides methods that, when represented as a call graph, have
21
+ # extremely large in and out degrees and make navigation impossible.
22
+ def exclude_common_methods!
23
+ ExcludeCommonMethods.apply!(self)
24
+ end
25
+
26
+ def exclude_methods!(mod, *method_names)
27
+ [method_names].flatten.each do |method_name|
28
+ exclude_method!(mod, method_name)
29
+ end
30
+ end
31
+
32
+ def exclude_singleton_methods!(mod, *method_names)
33
+ exclude_methods!(mod.singleton_class, *method_names)
34
+ end
35
+
36
+ # call-seq:
37
+ # merge! -> self
38
+ #
39
+ # Merges RubyProf threads whose root call_trees reference the same target method. This is useful
40
+ # when profiling code that uses a main thread/fiber to distribute work to multiple workers.
41
+ # If there are tens or hundreds of workers, viewing results per worker thread/fiber can be
42
+ # overwhelming. Using +merge!+ will combine the worker times together into one result.
43
+ #
44
+ # Note the reported time will be much greater than the actual wall time. For example, if there
45
+ # are 10 workers that each run for 5 seconds, merged results will show one thread that
46
+ # ran for 50 seconds.
47
+ #
48
+ def merge!
49
+ # First group threads by their root call tree target (method). If the methods are
50
+ # different than there is nothing to merge
51
+ grouped = threads.group_by do |thread|
52
+ thread.call_tree.target
53
+ end
54
+
55
+ # For each target, get the first thread. Then loop over the remaining threads,
56
+ # and merge them into the first one and ten delete them. So we will be left with
57
+ # one thread per target.
58
+ grouped.each do |target, threads|
59
+ thread = threads.shift
60
+ threads.each do |other_thread|
61
+ thread.merge!(other_thread)
62
+ remove_thread(other_thread)
63
+ end
64
+ thread
65
+ end
66
+
67
+ self
68
+ end
69
+ end
70
+ end
@@ -6,7 +6,6 @@ module Rack
6
6
  def initialize(app, options = {})
7
7
  @app = app
8
8
  @options = options
9
- @options[:min_percent] ||= 1
10
9
 
11
10
  @tmpdir = options[:path] || Dir.tmpdir
12
11
  FileUtils.mkdir_p(@tmpdir)
@@ -26,14 +25,19 @@ module Rack
26
25
  if should_profile?(request.path)
27
26
  begin
28
27
  result = nil
29
- data = ::RubyProf::Profile.profile(profiling_options) do
28
+ profile = ::RubyProf::Profile.profile(profiling_options) do
30
29
  result = @app.call(env)
31
30
  end
32
31
 
32
+ if @options[:merge_fibers]
33
+ profile.merge!
34
+ end
35
+
36
+
33
37
  path = request.path.gsub('/', '-')
34
38
  path.slice!(0)
35
39
 
36
- print(data, path)
40
+ print(profile, path)
37
41
  result
38
42
  end
39
43
  else
@@ -54,39 +58,45 @@ module Rack
54
58
  end
55
59
 
56
60
  def profiling_options
57
- options = {}
58
- options[:measure_mode] = ::RubyProf.measure_mode
59
- options[:exclude_threads] =
60
- if @options[:ignore_existing_threads]
61
- Thread.list.select{|t| t != Thread.current}
62
- else
63
- ::RubyProf.exclude_threads
64
- end
65
- if @options[:request_thread_only]
66
- options[:include_threads] = [Thread.current]
61
+ result = {}
62
+ result[:measure_mode] = @options[:measure_mode] || ::RubyProf::WALL_TIME
63
+ result[:track_allocations] = @options[:track_allocations] || false
64
+ result[:exclude_common] = @options[:exclude_common] || false
65
+
66
+ if @options[:ignore_existing_threads]
67
+ result[:exclude_threads] = Thread.list.select {|thread| thread != Thread.current}
67
68
  end
68
- if @options[:merge_fibers]
69
- options[:merge_fibers] = true
69
+
70
+ if @options[:request_thread_only]
71
+ result[:include_threads] = [Thread.current]
70
72
  end
71
- options
73
+
74
+ result
75
+ end
76
+
77
+ def print_options
78
+ result = {}
79
+ result[:min_percent] = @options[:min_percent] || 1
80
+ result[:sort_method] = @options[:sort_method] || :total_time
81
+ result
72
82
  end
73
83
 
74
- def print(data, path)
84
+ def print(profile, path)
75
85
  @printer_klasses.each do |printer_klass, base_name|
76
- printer = printer_klass.new(data)
86
+ printer = printer_klass.new(profile)
77
87
 
78
88
  if base_name.respond_to?(:call)
79
89
  base_name = base_name.call
80
90
  end
81
91
 
82
92
  if printer_klass == ::RubyProf::MultiPrinter
83
- printer.print(@options.merge(:profile => "#{path}-#{base_name}"))
93
+ printer.print(print_options.merge(:profile => "#{path}-#{base_name}"))
84
94
  elsif printer_klass == ::RubyProf::CallTreePrinter
85
- printer.print(@options.merge(:profile => "#{path}-#{base_name}"))
95
+ printer.print(print_options.merge(:profile => "#{path}-#{base_name}"))
86
96
  else
87
97
  file_name = ::File.join(@tmpdir, "#{path}-#{base_name}")
88
98
  ::File.open(file_name, 'wb') do |file|
89
- printer.print(file, @options)
99
+ printer.print(file, print_options)
90
100
  end
91
101
  end
92
102
  end
@@ -1,3 +1,3 @@
1
1
  module RubyProf
2
- VERSION = "1.5.0"
2
+ VERSION = "1.6.2"
3
3
  end
@@ -5,6 +5,7 @@ require File.expand_path('../test_helper', __FILE__)
5
5
 
6
6
  class AbstractPrinterTest < TestCase
7
7
  def setup
8
+ super
8
9
  @result = {}
9
10
  @printer = RubyProf::AbstractPrinter.new(@result)
10
11
  @options = {}
data/test/alias_test.rb CHANGED
@@ -15,13 +15,8 @@ class AliasTest < TestCase
15
15
  end
16
16
  end
17
17
 
18
- def setup
19
- # Need to use wall time for this test due to the sleep calls
20
- RubyProf::measure_mode = RubyProf::WALL_TIME
21
- end
22
-
23
18
  def test_alias
24
- result = RubyProf.profile do
19
+ result = RubyProf::Profile.profile(measure_mode: RubyProf::WALL_TIME) do
25
20
  TestMe.new.some_method
26
21
  end
27
22
 
@@ -31,7 +26,7 @@ class AliasTest < TestCase
31
26
  # Method 0
32
27
  method = methods[0]
33
28
  assert_equal('AliasTest#test_alias', method.full_name)
34
- assert_equal(25, method.line)
29
+ assert_equal(20, method.line)
35
30
  refute(method.recursive?)
36
31
 
37
32
  assert_equal(0, method.call_trees.callers.count)
@@ -39,11 +34,11 @@ class AliasTest < TestCase
39
34
  assert_equal(2, method.call_trees.callees.count)
40
35
  call_tree = method.call_trees.callees[0]
41
36
  assert_equal('Class#new', call_tree.target.full_name)
42
- assert_equal(25, call_tree.line)
37
+ assert_equal(20, call_tree.line)
43
38
 
44
39
  call_tree = method.call_trees.callees[1]
45
40
  assert_equal('AliasTest::TestMe#some_method', call_tree.target.full_name)
46
- assert_equal(25, call_tree.line)
41
+ assert_equal(20, call_tree.line)
47
42
 
48
43
  # Method 1
49
44
  method = methods[1]
@@ -54,7 +49,7 @@ class AliasTest < TestCase
54
49
  assert_equal(1, method.call_trees.callers.count)
55
50
  call_tree = method.call_trees.callers[0]
56
51
  assert_equal('AliasTest#test_alias', call_tree.parent.target.full_name)
57
- assert_equal(25, call_tree.line)
52
+ assert_equal(20, call_tree.line)
58
53
 
59
54
  assert_equal(1, method.call_trees.callees.count)
60
55
  call_tree = method.call_trees.callees[0]
@@ -83,7 +78,7 @@ class AliasTest < TestCase
83
78
  assert_equal(1, method.call_trees.callers.count)
84
79
  call_tree = method.call_trees.callers[0]
85
80
  assert_equal('AliasTest#test_alias', call_tree.parent.target.full_name)
86
- assert_equal(25, call_tree.line)
81
+ assert_equal(20, call_tree.line)
87
82
 
88
83
  assert_equal(1, method.call_trees.callees.count)
89
84
  call_tree = method.call_trees.callees[0]