ruby-prof 0.6.0-x86-mswin32-60 → 0.7.0-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/CHANGES +54 -1
  2. data/README +134 -7
  3. data/Rakefile +40 -58
  4. data/bin/ruby-prof +21 -6
  5. data/ext/extconf.rb +13 -0
  6. data/ext/measure_allocations.h +16 -1
  7. data/ext/measure_cpu_time.h +15 -3
  8. data/ext/measure_gc_runs.h +76 -0
  9. data/ext/measure_gc_time.h +57 -0
  10. data/ext/measure_memory.h +61 -2
  11. data/ext/measure_process_time.h +13 -2
  12. data/ext/measure_wall_time.h +12 -1
  13. data/ext/mingw/Rakefile +23 -0
  14. data/ext/mingw/build.rake +38 -0
  15. data/ext/mingw/ruby_prof.so +0 -0
  16. data/ext/ruby_prof.c +685 -633
  17. data/ext/ruby_prof.h +188 -0
  18. data/ext/vc/ruby_prof.sln +20 -0
  19. data/ext/vc/ruby_prof.vcproj +241 -0
  20. data/ext/version.h +4 -0
  21. data/lib/ruby-prof.rb +4 -0
  22. data/lib/ruby-prof/call_info.rb +47 -0
  23. data/lib/ruby-prof/call_tree_printer.rb +9 -1
  24. data/lib/ruby-prof/graph_html_printer.rb +6 -5
  25. data/lib/ruby-prof/graph_printer.rb +3 -2
  26. data/lib/ruby-prof/method_info.rb +85 -0
  27. data/lib/ruby-prof/task.rb +1 -2
  28. data/lib/ruby-prof/test.rb +148 -0
  29. data/rails/environment/profile.rb +24 -0
  30. data/rails/example/example_test.rb +9 -0
  31. data/rails/profile_test_helper.rb +21 -0
  32. data/test/basic_test.rb +173 -80
  33. data/test/duplicate_names_test.rb +2 -3
  34. data/test/exceptions_test.rb +15 -0
  35. data/test/exclude_threads_test.rb +54 -0
  36. data/test/line_number_test.rb +18 -14
  37. data/test/measurement_test.rb +121 -0
  38. data/test/module_test.rb +5 -8
  39. data/test/no_method_class_test.rb +4 -5
  40. data/test/prime.rb +3 -5
  41. data/test/prime_test.rb +1 -12
  42. data/test/printers_test.rb +10 -13
  43. data/test/profile_unit_test.rb +10 -12
  44. data/test/recursive_test.rb +202 -92
  45. data/test/singleton_test.rb +1 -2
  46. data/test/stack_test.rb +138 -0
  47. data/test/start_stop_test.rb +95 -0
  48. data/test/test_suite.rb +7 -3
  49. data/test/thread_test.rb +111 -87
  50. data/test/unique_call_path_test.rb +206 -0
  51. metadata +42 -44
  52. data/ext/extconf.rb.rej +0 -13
  53. data/lib/ruby-prof/call_tree_printer.rb.rej +0 -27
  54. data/lib/ruby-prof/profile_test_case.rb +0 -80
  55. data/lib/ruby_prof.so +0 -0
  56. data/rails_plugin/ruby-prof/init.rb +0 -8
  57. data/rails_plugin/ruby-prof/lib/profiling.rb +0 -57
  58. data/test/measure_mode_test.rb +0 -79
  59. data/test/prime1.rb +0 -17
  60. data/test/prime2.rb +0 -26
  61. data/test/prime3.rb +0 -17
  62. data/test/start_test.rb +0 -24
  63. data/test/test_helper.rb +0 -55
  64. data/test/timing_test.rb +0 -133
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-prof
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: x86-mswin32-60
6
6
  authors:
7
7
  - Shugo Maeda and Charlie Savage
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-02-03 00:00:00 -07:00
12
+ date: 2008-11-11 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -17,79 +17,78 @@ description: ruby-prof is a fast code profiler for Ruby. It is a C extension and
17
17
  email: shugo@ruby-lang.org and cfis@savagexi.com
18
18
  executables:
19
19
  - ruby-prof
20
- extensions: []
20
+ extensions:
21
+ - ext/mingw/Rakefile
22
+ extra_rdoc_files: []
21
23
 
22
- extra_rdoc_files:
23
- - bin/ruby-prof
24
- - ext/ruby_prof.c
25
- - examples/flat.txt
26
- - examples/graph.txt
27
- - examples/graph.html
28
- - README
29
- - LICENSE
30
24
  files:
31
25
  - Rakefile
32
26
  - README
33
27
  - LICENSE
34
28
  - CHANGES
35
29
  - bin/ruby-prof
36
- - lib/ruby-prof
37
- - lib/ruby-prof.rb
38
- - lib/unprof.rb
39
- - lib/ruby-prof/abstract_printer.rb
40
- - lib/ruby-prof/call_tree_printer.rb
41
- - lib/ruby-prof/call_tree_printer.rb.rej
42
- - lib/ruby-prof/flat_printer.rb
43
- - lib/ruby-prof/graph_html_printer.rb
44
- - lib/ruby-prof/graph_printer.rb
45
- - lib/ruby-prof/profile_test_case.rb
46
- - lib/ruby-prof/task.rb
47
- - rails_plugin/ruby-prof
48
- - rails_plugin/ruby-prof/init.rb
49
- - rails_plugin/ruby-prof/lib
50
- - rails_plugin/ruby-prof/lib/profiling.rb
51
30
  - examples/flat.txt
52
31
  - examples/graph.html
53
32
  - examples/graph.txt
54
33
  - ext/extconf.rb
55
- - ext/extconf.rb.rej
56
34
  - ext/measure_allocations.h
57
35
  - ext/measure_cpu_time.h
36
+ - ext/measure_gc_runs.h
37
+ - ext/measure_gc_time.h
58
38
  - ext/measure_memory.h
59
39
  - ext/measure_process_time.h
60
40
  - ext/measure_wall_time.h
41
+ - ext/mingw
61
42
  - ext/ruby_prof.c
43
+ - ext/ruby_prof.h
44
+ - ext/vc
45
+ - ext/version.h
46
+ - ext/mingw/Rakefile
47
+ - ext/mingw/build.rake
48
+ - ext/vc/ruby_prof.sln
49
+ - ext/vc/ruby_prof.vcproj
50
+ - lib/ruby-prof
51
+ - lib/ruby-prof/abstract_printer.rb
52
+ - lib/ruby-prof/call_info.rb
53
+ - lib/ruby-prof/call_tree_printer.rb
54
+ - lib/ruby-prof/flat_printer.rb
55
+ - lib/ruby-prof/graph_html_printer.rb
56
+ - lib/ruby-prof/graph_printer.rb
57
+ - lib/ruby-prof/method_info.rb
58
+ - lib/ruby-prof/task.rb
59
+ - lib/ruby-prof/test.rb
60
+ - lib/ruby-prof.rb
61
+ - lib/unprof.rb
62
+ - rails/environment
63
+ - rails/environment/profile.rb
64
+ - rails/example
65
+ - rails/example/example_test.rb
66
+ - rails/profile_test_helper.rb
62
67
  - test/basic_test.rb
63
68
  - test/duplicate_names_test.rb
69
+ - test/exceptions_test.rb
70
+ - test/exclude_threads_test.rb
64
71
  - test/line_number_test.rb
65
- - test/measure_mode_test.rb
72
+ - test/measurement_test.rb
66
73
  - test/module_test.rb
67
74
  - test/no_method_class_test.rb
68
75
  - test/prime.rb
69
- - test/prime1.rb
70
- - test/prime2.rb
71
- - test/prime3.rb
72
76
  - test/prime_test.rb
73
77
  - test/printers_test.rb
74
78
  - test/profile_unit_test.rb
75
79
  - test/recursive_test.rb
76
80
  - test/singleton_test.rb
77
- - test/start_test.rb
78
- - test/test_helper.rb
81
+ - test/stack_test.rb
82
+ - test/start_stop_test.rb
79
83
  - test/test_suite.rb
80
84
  - test/thread_test.rb
81
- - test/timing_test.rb
82
- - lib/ruby_prof.so
85
+ - test/unique_call_path_test.rb
86
+ - ext/mingw/ruby_prof.so
83
87
  has_rdoc: true
84
88
  homepage: http://rubyforge.org/projects/ruby-prof/
85
89
  post_install_message:
86
- rdoc_options:
87
- - --title
88
- - ruby-prof
89
- - --inline-source
90
- - --line-numbers
91
- - --main
92
- - README
90
+ rdoc_options: []
91
+
93
92
  require_paths:
94
93
  - lib
95
94
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -107,10 +106,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
106
  requirements: []
108
107
 
109
108
  rubyforge_project: ruby-prof
110
- rubygems_version: 1.0.1
109
+ rubygems_version: 1.2.0
111
110
  signing_key:
112
111
  specification_version: 2
113
112
  summary: Fast Ruby profiler
114
113
  test_files:
115
- - test/test_helper.rb
116
114
  - test/test_suite.rb
@@ -1,13 +0,0 @@
1
- ***************
2
- *** 16,20 ****
3
- end
4
-
5
- have_header("sys/times.h")
6
- - create_makefile("ruby_prof")
7
- - have_func("rb_os_allocated_objects")--- 16,21 ----
8
- end
9
-
10
- have_header("sys/times.h")
11
- + have_func("rb_os_allocated_objects")
12
- + have_func("rb_gc_allocated_size")
13
- + create_makefile("ruby_prof")
@@ -1,27 +0,0 @@
1
- ***************
2
- *** 28,39 ****
3
-
4
- def print_threads
5
- @result.threads.each do |thread_id, methods|
6
- - print_methods(thread_id ,methods)
7
- end
8
- end
9
-
10
- def convert(value)
11
- - (value * 1000).round
12
- end
13
-
14
- def file(method)
15
- --- 32,43 ----
16
-
17
- def print_threads
18
- @result.threads.each do |thread_id, methods|
19
- + print_methods(thread_id ,methods)
20
- end
21
- end
22
-
23
- def convert(value)
24
- + (value * @value_scale).round
25
- end
26
-
27
- def file(method)
@@ -1,80 +0,0 @@
1
- # Make sure to first load the libraries we will override
2
- require 'test/unit'
3
- require 'ruby-prof'
4
-
5
- module Test
6
- module Unit
7
- class TestCase
8
-
9
- alias :run__profile__ :run
10
-
11
- def run(result, &block)
12
- test_name = @method_name.to_sym
13
- alias_test_name = (@method_name + '__profile__').to_sym
14
-
15
- self.class.class_eval("alias :#{alias_test_name} :#{test_name}")
16
-
17
- self.class.send(:define_method, test_name) do
18
- # Run the profiler
19
- RubyProf.start
20
- __send__(alias_test_name)
21
- result = RubyProf.stop
22
-
23
- create_output_directory
24
-
25
- # Get the result file name
26
- file_name = name.gsub(/\(/, '_').gsub(/\)/, '')
27
- file_name = self.underscore(file_name)
28
- file_path = File.join(output_directory, file_name)
29
- file_path += file_extension
30
-
31
- # Create a printer
32
- printer = self.printer.new(result)
33
-
34
- # Write the results
35
- File.open(file_path, 'w') do |file|
36
- printer.print(file, min_percent)
37
- end
38
- end
39
-
40
- self.run__profile__(result, &block)
41
- end
42
-
43
- # Taken from rails
44
- def underscore(camel_cased_word)
45
- camel_cased_word.to_s.gsub(/::/, '/').
46
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
47
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
48
- tr("-", "_").downcase
49
- end
50
-
51
- # Add some additional methods
52
- def min_percent
53
- 1
54
- end
55
-
56
- def output_directory
57
- # Put results in subdirectory called profile
58
- File.join(Dir.getwd, 'profile')
59
- end
60
-
61
- def create_output_directory
62
- if not File.exist?(output_directory)
63
- Dir.mkdir(output_directory)
64
- end
65
- end
66
-
67
- def file_extension
68
- if printer == RubyProf::FlatPrinter
69
- '.html'
70
- else
71
- '.txt'
72
- end
73
- end
74
-
75
- def printer
76
- RubyProf::GraphHtmlPrinter
77
- end
78
- end
79
- end
80
- end
Binary file
@@ -1,8 +0,0 @@
1
- require 'profiling'
2
-
3
- # Grab log path from current rails configuration
4
- ActionController::Profiling::LOG_PATH = File.expand_path(File.dirname(config.log_path))
5
-
6
- ActionController::Base.class_eval do
7
- include ActionController::Profiling
8
- end
@@ -1,57 +0,0 @@
1
- require 'ruby-prof'
2
-
3
- module ActionController #:nodoc:
4
- # The ruby-prof module times the performance of actions and reports to the logger. If the Active Record
5
- # package has been included, a separate timing section for database calls will be added as well.
6
- module Profiling #:nodoc:
7
- LOG_PATH = nil
8
-
9
- def self.included(base)
10
- base.class_eval do
11
- alias_method_chain :perform_action, :profiling
12
- end
13
- end
14
-
15
- def perform_action_with_profiling
16
- # Profling could be running if this
17
- # is a render_component call.
18
- if RubyProf.running? or not logger
19
- perform_action_without_profiling
20
- else
21
- result = RubyProf.profile do
22
- perform_action_without_profiling
23
- end
24
-
25
- output = StringIO.new
26
- output << " [#{complete_request_uri rescue "unknown"}]"
27
- output << "\n\n"
28
-
29
- # Create a flat printer
30
- printer = RubyProf::FlatPrinter.new(result)
31
-
32
- # Skip anything less than 1% - which is a lot of
33
- # stuff in Rails. Don't print the source file
34
- # its too noisy.
35
- printer.print(output, {:min_percent => 1,
36
- :print_file => false})
37
- logger.info(output.string)
38
-
39
- ## Example for Graph html printer
40
- #printer = RubyProf::GraphHtmlPrinter.new(result)
41
- #path = File.join(LOG_PATH, 'call_graph.html')
42
- #File.open(path, 'w') do |file|
43
- #printer.print(file, {:min_percent => 1,
44
- #:print_file => true})
45
- #end
46
-
47
- ## Used for KCacheGrind visualizations
48
- #printer = RubyProf::CallTreePrinter.new(result)
49
- #path = File.join(LOG_PATH, 'callgrind.out')
50
- #File.open(path, 'w') do |file|
51
- #printer.print(file, {:min_percent => 1,
52
- #:print_file => true})
53
- #end
54
- end
55
- end
56
- end
57
- end
@@ -1,79 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'test/unit'
4
- require 'ruby-prof'
5
- require 'test_helper'
6
- require 'prime'
7
-
8
-
9
- # -- Tests ----
10
- class MeasureModeTest < Test::Unit::TestCase
11
-
12
- def test_process_time
13
- RubyProf::measure_mode = RubyProf::PROCESS_TIME
14
- assert_equal(RubyProf::PROCESS_TIME, RubyProf::measure_mode)
15
- result = RubyProf.profile do
16
- run_primes
17
- end
18
-
19
- result.threads.each do |thread_id, methods|
20
- methods.each do |method|
21
- check_parent_times(method)
22
- check_parent_calls(method)
23
- check_child_times(method)
24
- end
25
- end
26
- end
27
-
28
- def test_wall_time
29
- RubyProf::measure_mode = RubyProf::WALL_TIME
30
- assert_equal(RubyProf::WALL_TIME, RubyProf::measure_mode)
31
- result = RubyProf.profile do
32
- run_primes
33
- end
34
-
35
- result.threads.values.each do |methods|
36
- methods.each do |method|
37
- check_parent_times(method)
38
- check_parent_calls(method)
39
- check_child_times(method)
40
- end
41
- end
42
- end
43
-
44
- def test_cpu
45
- return unless RubyProf.constants.include?('CPU_TIME')
46
-
47
- RubyProf::measure_mode = RubyProf::CPU_TIME
48
- assert_equal(RubyProf::CPU_TIME, RubyProf::measure_mode)
49
- result = RubyProf.profile do
50
- run_primes
51
- end
52
-
53
- result.threads.values.each do |methods|
54
- methods.each do |method|
55
- check_parent_times(method)
56
- check_parent_calls(method)
57
- check_child_times(method)
58
- end
59
- end
60
- end
61
-
62
- def test_allocated_objects
63
- return if RubyProf::ALLOCATIONS.nil?
64
-
65
- RubyProf::measure_mode = RubyProf::ALLOCATIONS
66
-
67
- assert_equal(RubyProf::ALLOCATIONS, RubyProf::measure_mode)
68
-
69
- result = RubyProf.profile do
70
- Array.new
71
- end
72
- end
73
-
74
- def test_invalid
75
- assert_raise(ArgumentError) do
76
- RubyProf::measure_mode = 7777
77
- end
78
- end
79
- end
@@ -1,17 +0,0 @@
1
- require 'prime2'
2
- require 'prime3'
3
-
4
- def run_primes
5
- length = 500
6
- maxnum = 10000
7
-
8
- # Create random numbers
9
- random_array = make_random_array(length, maxnum)
10
-
11
- # Find the primes
12
- primes = find_primes(random_array)
13
-
14
- # Find the largest primes
15
- largest = find_largest(primes)
16
- #puts "largest is #{largest}"
17
- end
@@ -1,26 +0,0 @@
1
- require 'prime3'
2
-
3
- # Need to use wall time for this test due to the sleep calls
4
- RubyProf::measure_mode = RubyProf::WALL_TIME
5
-
6
- def find_primes(arr)
7
- result = arr.select do |value|
8
- is_prime(value)
9
- end
10
- result
11
- end
12
-
13
- def find_largest(primes)
14
- largest = primes.first
15
-
16
- # Intentionally use upto for example purposes
17
- # (upto is also called from is_prime)
18
- 0.upto(primes.length-1) do |i|
19
- sleep(0.02)
20
- prime = primes[i]
21
- if prime > largest
22
- largest = prime
23
- end
24
- end
25
- largest
26
- end