ruby-prof 0.10.2 → 0.10.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,11 @@
1
+ 0.10.4
2
+ =======================
3
+ Faster load time for ruby-prof itself.
4
+
5
+ 0.10.3
6
+ =======================
7
+ Can cleanly load before rubygems now.
8
+
1
9
  0.10.2
2
10
  =======================
3
11
  Fix for 1.9.2, os x for latest commits (thanks skaes!)
data/README.rdoc CHANGED
@@ -29,11 +29,11 @@ The easiest way to install ruby-prof is by using Ruby Gems. To install:
29
29
  gem install ruby-prof
30
30
 
31
31
  If you on windows mswin [not mingw] (check via ruby -v) and
32
- don't have an MSVC compiler, please install v0.7.3 which
32
+ don't have an MSVC compiler, please install v0.8.1 which
33
33
  has a prebuilt binary
34
34
  C:> gem install ruby-prof -v0.8.1
35
35
 
36
- If you're on mingw, please install the devkit first, then install the latest gem version (gem install ruby-prof).
36
+ If you're on mingw, please install the devkit first, then install the latest gem version (via gem install ruby-prof).
37
37
 
38
38
  == Usage
39
39
 
@@ -120,19 +120,6 @@ This will start profiling immediately at that point and will output the results
120
120
  using a flat profile report after the process ends.
121
121
 
122
122
 
123
- == Benchmarking full load time ==
124
-
125
- If you want to get a more accurate measurement of what takes a gem's bin/xxx
126
- command its time to load, you may want to also measure rubygems' startup penalty.
127
- You can do this by calling into bin/ruby-prof directly, ex:
128
-
129
-
130
- $ ruby C:/installs/Ruby187/lib/ruby/gems/1.8/gems/ruby-prof-0.10.0/bin/ruby-prof D:\Ruby192\bin\ruby-prof
131
-
132
- or
133
-
134
- $ ruby C:/installs/Ruby187/lib/ruby/gems/1.8/gems/ruby-prof-0.10.0/bin/ruby-prof some_file_that_does_a_require_rubygems_at_the_beginning
135
-
136
123
  == Method Elimination
137
124
 
138
125
  Starting with release 0.9.0, ruby-prof supports eliminating methods from profiling
@@ -155,6 +142,22 @@ the name of a file containing a list of regular expressions (line separated text
155
142
  After eliminating methods the resulting profile will appear exactly as if those methods
156
143
  had been inlined at their call sites.
157
144
 
145
+ == Benchmarking full load time including rubygems startup cost ==
146
+
147
+ If you want to get a more accurate measurement of what takes all of a gem's bin/xxx
148
+ command to load, you may want to also measure rubygems' startup penalty.
149
+ You can do this by calling into bin/ruby-prof directly, ex:
150
+
151
+ $ gem which ruby-prof
152
+ g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/lib/ruby-prof.rb
153
+
154
+ now run it thus (substitute lib/ruby-prof.rb with bin/ruby-prof):
155
+
156
+ $ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof g:\192\bin\some_installed_gem_command
157
+
158
+ or
159
+
160
+ $ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof ./some_file_that_does_a_require_rubygems_at_the_beginning.rb
158
161
 
159
162
  == Profiling Tests
160
163
 
@@ -450,4 +453,4 @@ See LICENSE for license information.
450
453
 
451
454
  Code is located at http://github.com/rdp/ruby-prof
452
455
 
453
- Google group/mailing list: http://groups.google.com/group/ruby-prof
456
+ Google group/mailing list: http://groups.google.com/group/ruby-prof
data/Rakefile CHANGED
@@ -4,8 +4,7 @@ require 'rake/rdoctask'
4
4
  require 'rake/testtask'
5
5
  require 'date'
6
6
 
7
-
8
- # to release it, do a git tag, then rake cleanr default and publish that
7
+ # to release a version of ruby-prof, do a git tag, then rake cleanr default and publish that
9
8
  # git tag 0.10.1
10
9
  # git push origin 0.10.1
11
10
  # rake cleanr default
@@ -13,8 +12,9 @@ require 'date'
13
12
 
14
13
  default_spec = eval File.read(File.expand_path('../ruby-prof.gemspec', __FILE__))
15
14
 
16
- desc 'build native .gem files -- use like "native_gems clobber cross native gem"--for non native gem creation use "native_gems clobber" then "clean gem"'
15
+ desc 'deprecated--build native .gem files -- use like "native_gems clobber cross native gem"--for non native gem creation use "native_gems clobber" then "clean gem"'
17
16
  task :native_gems do
17
+ # we don't do cross compiler anymore, now that mingw has devkit
18
18
  ENV['RUBY_CC_VERSION'] = '1.8.6:1.9.1'
19
19
  require 'rake/extensiontask'
20
20
  Rake::ExtensionTask.new('ruby_prof', default_spec) do |ext|
@@ -71,7 +71,7 @@ task :build do
71
71
  system(Gem.ruby + " extconf.rb")
72
72
  system("make clean")
73
73
  end
74
- system("make")
74
+ raise 'make failed' unless system("make")
75
75
  FileUtils.cp 'ruby_prof.so', '../../lib' if File.exist? 'lib/ruby_prof.so'
76
76
  FileUtils.cp 'ruby_prof.bundle', '../../lib' if File.exist? 'lib/ruby_prof.bundle'
77
77
  end
data/examples/empty.png CHANGED
File without changes
data/examples/minus.png CHANGED
File without changes
data/examples/plus.png CHANGED
File without changes
@@ -1,4 +1,4 @@
1
- #define RUBY_PROF_VERSION "0.10.2" // for easy parsing from rake files
1
+ #define RUBY_PROF_VERSION "0.10.4" // for easy parsing from rake files
2
2
  #define RUBY_PROF_VERSION_MAJ 0
3
3
  #define RUBY_PROF_VERSION_MIN 10
4
- #define RUBY_PROF_VERSION_MIC 2
4
+ #define RUBY_PROF_VERSION_MIC 4
data/lib/ruby-prof.rb CHANGED
@@ -1,24 +1,35 @@
1
- # require the .so (ext) file...
2
-
3
- me = File.dirname(__FILE__) + '/'
4
- begin
5
- # fat binaries
6
- require "#{me}/#{RUBY_VERSION[0..2]}/ruby_prof"
7
- rescue Exception
8
- require "#{me}/../ext/ruby_prof/ruby_prof"
9
- end
10
-
11
- # have to load them by hand since we don't want to load 'unprof'
12
-
13
- for file in ['abstract_printer', 'result', 'method_info', 'call_info', 'aggregate_call_info', 'flat_printer', 'flat_printer_with_line_numbers',
14
- 'graph_printer', 'graph_html_printer', 'call_tree_printer', 'call_stack_printer', 'multi_printer', 'dot_printer', 'symbol_to_proc', # for 1.8's backward compatible benefit
15
- 'rack']
16
-
17
- require File.dirname(__FILE__) + '/ruby-prof/' + file
18
- end
1
+ # require the .so file...
2
+ require File.dirname(__FILE__) + "/../ext/ruby_prof/ruby_prof"
19
3
 
20
4
  module RubyProf
21
- # See if the user specified the clock mode via
5
+
6
+ if RUBY_VERSION < '1.8.7'
7
+ require File.dirname(__FILE__) + '/ruby-prof/symbol_to_proc'
8
+ end
9
+
10
+ def self.camelcase(phrase)
11
+ ('_' + phrase).gsub(/_([a-z])/){|b| b[1..1].upcase}
12
+ end
13
+
14
+ lib_dir = File.dirname(__FILE__) + '/ruby-prof/'
15
+
16
+ for file in ['abstract_printer', 'aggregate_call_info', 'flat_printer', 'flat_printer_with_line_numbers',
17
+ 'graph_printer', 'graph_html_printer', 'call_tree_printer', 'call_stack_printer', 'multi_printer', 'dot_printer']
18
+ autoload camelcase(file), lib_dir + file
19
+ end
20
+
21
+ # A few need to be loaded manually their classes were already defined by the .so file so autoload won't work for them.
22
+ # plus we need them anyway
23
+ for name in ['result', 'method_info', 'call_info']
24
+ require lib_dir + name
25
+ end
26
+
27
+ require File.dirname(__FILE__) + '/ruby-prof/rack' # do we even need to load this every time?
28
+
29
+ # we don't require unprof.rb, as well, purposefully
30
+
31
+
32
+ # Checks if the user specified the clock mode via
22
33
  # the RUBY_PROF_MEASURE_MODE environment variable
23
34
  def self.figure_measure_mode
24
35
  case ENV["RUBY_PROF_MEASURE_MODE"]
File without changes
File without changes
File without changes
@@ -1,4 +1,3 @@
1
- require 'tmpdir'
2
1
 
3
2
  module Rack
4
3
  class RubyProf
@@ -16,6 +15,7 @@ module Rack
16
15
  end
17
16
 
18
17
  def print(data)
18
+ require 'tmpdir' # late require so we load on demand only
19
19
  printers = {::RubyProf::FlatPrinter => ::File.join(Dir.tmpdir, 'profile.txt'),
20
20
  ::RubyProf::GraphHtmlPrinter => ::File.join(Dir.tmpdir, 'profile.html')}
21
21
 
File without changes
File without changes
data/test/basic_test.rb CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
data/test/exec_test.rb CHANGED
File without changes
File without changes
File without changes
data/test/module_test.rb CHANGED
File without changes
File without changes
File without changes
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'test/unit'
3
3
  require 'ruby-prof'
4
- require 'prime'
4
+ require File.dirname(__FILE__) + '/prime'
5
5
  require 'stringio'
6
6
  require 'fileutils'
7
7
  require 'rubygems'
@@ -90,18 +90,12 @@ class PrintersTest < Test::Unit::TestCase
90
90
  assert_match(/called from/, output)
91
91
 
92
92
  # should combine common parents
93
- # lodo remove...
94
- #if RUBY_VERSION < '1.9'
95
- #require 'ruby-debug'
96
- #debugger
97
- #print output
98
- assert_equal(3, output.scan(/Object#is_prime/).length) # failing this is prolly a 1.9.2 core bug
99
- #else
100
- # # 1.9
101
- # require 'ruby-debug'
102
- # debugger
103
- # assert_equal(2, output.scan(/Object#is_prime/).length)
104
- #end
93
+ if RUBY_VERSION < '1.9'
94
+ assert_equal(3, output.scan(/Object#is_prime/).length)
95
+ else
96
+ # 1.9 inlines it's Fixnum#- so we don't see as many
97
+ assert_equal(2, output.scan(/Object#is_prime/).length)
98
+ end
105
99
  assert_no_match(/\.\/test\/prime.rb/, output) # don't use relative paths
106
100
  end
107
101
 
File without changes
File without changes
@@ -46,7 +46,7 @@ class StackPrinterTest < Test::Unit::TestCase
46
46
  assert file_contents =~ /Thread: (\d+) \(100\.00% ~ ([.0-9]+)\)/
47
47
  actual_time = $2.to_f
48
48
  difference = (expected_time-actual_time).abs
49
- assert difference<0.001 # less than 1 ms
49
+ assert difference < 0.01 # less than 1 ms
50
50
  end
51
51
 
52
52
  def test_method_elimination
data/test/stack_test.rb CHANGED
File without changes
File without changes
data/test/thread_test.rb CHANGED
File without changes
File without changes
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-prof
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 63
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 10
9
- - 2
10
- version: 0.10.2
9
+ - 4
10
+ version: 0.10.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Shugo Maeda, Charlie Savage, Roger Pack, Stefan Kaes
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-11 00:00:00 -06:00
18
+ date: 2011-04-20 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  requirements: []
178
178
 
179
179
  rubyforge_project: ruby-prof
180
- rubygems_version: 1.6.2
180
+ rubygems_version: 1.5.2
181
181
  signing_key:
182
182
  specification_version: 3
183
183
  summary: Fast Ruby profiler