ruby-prof 0.10.8 → 0.11.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. data/CHANGES +38 -18
  2. data/LICENSE +4 -3
  3. data/README.rdoc +30 -66
  4. data/Rakefile +47 -54
  5. data/bin/ruby-prof +24 -4
  6. data/ext/ruby_prof/extconf.rb +9 -16
  7. data/ext/ruby_prof/rp_call_info.c +369 -0
  8. data/ext/ruby_prof/rp_call_info.h +46 -0
  9. data/ext/ruby_prof/rp_measure.c +48 -0
  10. data/ext/ruby_prof/rp_measure.h +45 -0
  11. data/ext/ruby_prof/rp_measure_allocations.c +86 -0
  12. data/ext/ruby_prof/rp_measure_cpu_time.c +112 -0
  13. data/ext/ruby_prof/rp_measure_gc_runs.c +87 -0
  14. data/ext/ruby_prof/rp_measure_gc_time.c +73 -0
  15. data/ext/ruby_prof/rp_measure_memory.c +81 -0
  16. data/ext/ruby_prof/rp_measure_process_time.c +71 -0
  17. data/ext/ruby_prof/rp_measure_wall_time.c +42 -0
  18. data/ext/ruby_prof/rp_method.c +363 -0
  19. data/ext/ruby_prof/rp_method.h +55 -0
  20. data/ext/ruby_prof/rp_stack.c +61 -0
  21. data/ext/ruby_prof/rp_stack.h +40 -0
  22. data/ext/ruby_prof/rp_thread.c +113 -0
  23. data/ext/ruby_prof/rp_thread.h +20 -0
  24. data/ext/ruby_prof/ruby_prof.c +259 -1398
  25. data/ext/ruby_prof/ruby_prof.h +54 -190
  26. data/ext/ruby_prof/version.h +6 -3
  27. data/lib/1.8/ruby_prof.so +0 -0
  28. data/lib/1.9/ruby_prof.exp +0 -0
  29. data/lib/1.9/ruby_prof.ilk +0 -0
  30. data/lib/1.9/ruby_prof.lib +0 -0
  31. data/lib/1.9/ruby_prof.pdb +0 -0
  32. data/lib/1.9/ruby_prof.so +0 -0
  33. data/lib/ruby-prof.rb +14 -11
  34. data/lib/ruby-prof/abstract_printer.rb +10 -0
  35. data/lib/ruby-prof/aggregate_call_info.rb +2 -0
  36. data/lib/ruby-prof/call_info.rb +2 -0
  37. data/lib/ruby-prof/call_stack_printer.rb +2 -4
  38. data/lib/ruby-prof/call_tree_printer.rb +1 -0
  39. data/lib/ruby-prof/compatibility.rb +134 -0
  40. data/lib/ruby-prof/dot_printer.rb +7 -7
  41. data/lib/ruby-prof/flat_printer.rb +7 -7
  42. data/lib/ruby-prof/flat_printer_with_line_numbers.rb +2 -5
  43. data/lib/ruby-prof/graph_html_printer.rb +4 -2
  44. data/lib/ruby-prof/graph_printer.rb +4 -3
  45. data/lib/ruby-prof/method_info.rb +2 -0
  46. data/lib/ruby-prof/multi_printer.rb +2 -0
  47. data/lib/ruby-prof/{result.rb → profile.rb} +3 -1
  48. data/lib/ruby-prof/rack.rb +1 -0
  49. data/lib/ruby-prof/symbol_to_proc.rb +2 -0
  50. data/lib/ruby-prof/task.rb +1 -0
  51. data/lib/ruby-prof/test.rb +2 -0
  52. data/lib/ruby_prof.exp +0 -0
  53. data/lib/ruby_prof.ilk +0 -0
  54. data/lib/ruby_prof.lib +0 -0
  55. data/lib/ruby_prof.pdb +0 -0
  56. data/lib/ruby_prof.so +0 -0
  57. data/lib/unprof.rb +2 -0
  58. data/test/aggregate_test.rb +8 -8
  59. data/test/basic_test.rb +3 -251
  60. data/test/bug_test.rb +6 -0
  61. data/test/duplicate_names_test.rb +2 -2
  62. data/test/dynamic_method_test.rb +61 -0
  63. data/test/enumerable_test.rb +2 -2
  64. data/test/exceptions_test.rb +4 -3
  65. data/test/exclude_threads_test.rb +2 -2
  66. data/test/exec_test.rb +3 -3
  67. data/test/line_number_test.rb +5 -5
  68. data/test/measure_allocations_test.rb +25 -0
  69. data/test/measure_cpu_time_test.rb +212 -0
  70. data/test/measure_gc_runs_test.rb +29 -0
  71. data/test/measure_gc_time_test.rb +29 -0
  72. data/test/measure_memory_test.rb +36 -0
  73. data/test/measure_process_time_test.rb +205 -0
  74. data/test/measure_wall_time_test.rb +209 -0
  75. data/test/method_elimination_test.rb +2 -2
  76. data/test/module_test.rb +3 -2
  77. data/test/multi_printer_test.rb +2 -2
  78. data/test/no_method_class_test.rb +3 -1
  79. data/test/prime_test.rb +3 -3
  80. data/test/printers_test.rb +106 -8
  81. data/test/recursive_test.rb +7 -6
  82. data/test/singleton_test.rb +2 -2
  83. data/test/stack_printer_test.rb +2 -3
  84. data/test/stack_test.rb +2 -2
  85. data/test/start_stop_test.rb +2 -2
  86. data/test/test_helper.rb +81 -0
  87. data/test/test_suite.rb +34 -29
  88. data/test/thread_test.rb +24 -23
  89. data/test/unique_call_path_test.rb +2 -2
  90. metadata +101 -69
  91. data/ext/ruby_prof/measure_allocations.h +0 -83
  92. data/ext/ruby_prof/measure_cpu_time.h +0 -152
  93. data/ext/ruby_prof/measure_gc_runs.h +0 -76
  94. data/ext/ruby_prof/measure_gc_time.h +0 -57
  95. data/ext/ruby_prof/measure_memory.h +0 -101
  96. data/ext/ruby_prof/measure_process_time.h +0 -63
  97. data/ext/ruby_prof/measure_wall_time.h +0 -53
  98. data/ext/ruby_prof/mingw/Rakefile +0 -23
  99. data/ext/ruby_prof/mingw/build.rake +0 -38
  100. data/rails/environment/profile.rb +0 -24
  101. data/rails/example/example_test.rb +0 -9
  102. data/rails/profile_test_helper.rb +0 -21
  103. data/test/current_failures_windows +0 -8
  104. data/test/measurement_test.rb +0 -132
  105. data/test/ruby-prof-bin +0 -20
@@ -1,21 +0,0 @@
1
- # Load profile environment
2
- env = ENV["RAILS_ENV"] = "profile"
3
- require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
4
-
5
- # Load Rails testing infrastructure
6
- require 'test_help'
7
-
8
- # Now we can load test_helper since we've already loaded the
9
- # profile RAILS environment.
10
- require File.expand_path(File.join(RAILS_ROOT, 'test', 'test_helper'))
11
-
12
- # Reset the current environment back to profile
13
- # since test_helper reset it to test
14
- ENV["RAILS_ENV"] = env
15
-
16
- # Now load ruby-prof and away we go
17
- require 'ruby-prof'
18
-
19
- # Setup output directory to Rails tmp directory
20
- RubyProf::Test::PROFILE_OPTIONS[:output_dir] =
21
- File.expand_path(File.join(RAILS_ROOT, 'tmp', 'profile'))
@@ -1,8 +0,0 @@
1
- 1.8 passes, 1.9 however...
2
-
3
- 1) Failure:
4
- test_flat_string_with_numbers(PrintersTest) [E:/dev/ruby/ruby-prof/test/printers_test.rb:68]:
5
- <2> expected but was
6
- <29>.
7
-
8
- which is expected until core backports a recent fix.
@@ -1,132 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'test/unit'
3
- require 'ruby-prof'
4
-
5
- class MeasurementTest < Test::Unit::TestCase
6
- def setup
7
- # also done in C these days...
8
- GC.enable_stats if GC.respond_to?(:enable_stats)
9
- end
10
-
11
- def teardown
12
- # also done in C for normal runs...
13
- GC.disable_stats if GC.respond_to?(:disable_stats)
14
- end
15
-
16
- def test_process_time_mode
17
- RubyProf::measure_mode = RubyProf::PROCESS_TIME
18
- assert_equal(RubyProf::PROCESS_TIME, RubyProf::measure_mode)
19
- end
20
-
21
- def test_process_time
22
- t = RubyProf.measure_process_time
23
- assert_kind_of(Float, t)
24
-
25
- u = RubyProf.measure_process_time
26
- assert(u >= t, [t, u].inspect)
27
- end
28
-
29
- def test_wall_time_mode
30
- RubyProf::measure_mode = RubyProf::WALL_TIME
31
- assert_equal(RubyProf::WALL_TIME, RubyProf::measure_mode)
32
- end
33
-
34
- def test_wall_time
35
- t = RubyProf.measure_wall_time
36
- assert_kind_of Float, t
37
-
38
- u = RubyProf.measure_wall_time
39
- assert u >= t, [t, u].inspect
40
- end
41
-
42
- if RubyProf::CPU_TIME
43
- def test_cpu_time_mode
44
- RubyProf::measure_mode = RubyProf::CPU_TIME
45
- assert_equal(RubyProf::CPU_TIME, RubyProf::measure_mode)
46
- end
47
-
48
- def test_cpu_time
49
- RubyProf.cpu_frequency = 2.33e9
50
-
51
- t = RubyProf.measure_cpu_time
52
- assert_kind_of Float, t
53
-
54
- u = RubyProf.measure_cpu_time
55
- assert u > t, [t, u].inspect
56
- end
57
- end
58
-
59
- if RubyProf::ALLOCATIONS
60
- def test_allocations_mode
61
- RubyProf::measure_mode = RubyProf::ALLOCATIONS
62
- assert_equal(RubyProf::ALLOCATIONS, RubyProf::measure_mode)
63
- end
64
-
65
- def test_allocations
66
- t = RubyProf.measure_allocations
67
- assert_kind_of Integer, t
68
-
69
- u = RubyProf.measure_allocations
70
- assert u > t, [t, u].inspect
71
- end
72
- end
73
-
74
- def memory_test_helper
75
- result = RubyProf.profile {Array.new}
76
- total = result.threads.values.first.inject(0) { |sum, m| sum + m.total_time }
77
- assert(total < 1_000_000, 'Total should not have subtract overflow error')
78
- total
79
- end
80
-
81
- if RubyProf::MEMORY
82
- def test_memory_mode
83
- RubyProf::measure_mode = RubyProf::MEMORY
84
- assert_equal(RubyProf::MEMORY, RubyProf::measure_mode)
85
- end
86
-
87
- def test_memory
88
- t = RubyProf.measure_memory
89
- assert_kind_of Integer, t
90
-
91
- u = RubyProf.measure_memory
92
- assert(u >= t, [t, u].inspect)
93
- RubyProf::measure_mode = RubyProf::MEMORY
94
- total = memory_test_helper
95
- assert(total > 0, 'Should measure more than zero kilobytes of memory usage')
96
- assert_not_equal(0, total % 1, 'Should not truncate fractional kilobyte measurements')
97
- end
98
- end
99
-
100
- if RubyProf::GC_RUNS
101
- def test_gc_runs_mode
102
- RubyProf::measure_mode = RubyProf::GC_RUNS
103
- assert_equal(RubyProf::GC_RUNS, RubyProf::measure_mode)
104
- end
105
-
106
- def test_gc_runs
107
- t = RubyProf.measure_gc_runs
108
- assert_kind_of Integer, t
109
-
110
- GC.start
111
-
112
- u = RubyProf.measure_gc_runs
113
- assert u > t, [t, u].inspect
114
- RubyProf::measure_mode = RubyProf::GC_RUNS
115
- memory_test_helper
116
- end
117
- end
118
-
119
- if RubyProf::GC_TIME
120
- def test_gc_time
121
- t = RubyProf.measure_gc_time
122
- assert_kind_of Integer, t
123
-
124
- GC.start
125
-
126
- u = RubyProf.measure_gc_time
127
- assert u > t, [t, u].inspect
128
- RubyProf::measure_mode = RubyProf::GC_TIME
129
- memory_test_helper
130
- end
131
- end
132
- end
@@ -1,20 +0,0 @@
1
- #!E:/installs/ruby191p376/bin/ruby.exe
2
- #
3
- # This file was generated by RubyGems.
4
- #
5
- # The application 'ruby-prof' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'rubygems'
10
-
11
- version = ">= 0"
12
-
13
- if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
14
- version = $1
15
- ARGV.shift
16
- end
17
-
18
- #gem 'ruby-prof', version
19
- $: << File.dirname(__FILE__) + '/../lib'
20
- load File.dirname(__FILE__) + '/../bin/ruby-prof'