ruby-prof 0.11.0.rc2-x86-mingw32 → 0.11.0.rc3-x86-mingw32

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.
@@ -39,7 +39,7 @@
39
39
  <PropertyGroup Label="UserMacros" />
40
40
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
41
41
  <LinkIncremental>true</LinkIncremental>
42
- <OutDir>C:\MinGW\local\src\ruby-prof\lib\1.9</OutDir>
42
+ <OutDir>..\..\..\lib\1.9</OutDir>
43
43
  <TargetExt>.so</TargetExt>
44
44
  </PropertyGroup>
45
45
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -0,0 +1,66 @@
1
+ # encoding: utf-8
2
+
3
+ # Load the C-based binding.
4
+ begin
5
+ RUBY_VERSION =~ /(\d+.\d+)/
6
+ require "#{$1}/ruby_prof"
7
+ rescue LoadError
8
+ require "ruby_prof"
9
+ end
10
+
11
+ require 'ruby-prof/aggregate_call_info'
12
+ require 'ruby-prof/call_info'
13
+ require 'ruby-prof/call_info_visitor'
14
+ require 'ruby-prof/compatibility'
15
+ require 'ruby-prof/method_info'
16
+ require 'ruby-prof/profile'
17
+ require 'ruby-prof/rack'
18
+
19
+ require 'ruby-prof/printers/abstract_printer'
20
+ require 'ruby-prof/printers/call_info_printer'
21
+ require 'ruby-prof/printers/call_stack_printer'
22
+ require 'ruby-prof/printers/call_tree_printer'
23
+ require 'ruby-prof/printers/dot_printer'
24
+ require 'ruby-prof/printers/flat_printer'
25
+ require 'ruby-prof/printers/flat_printer_with_line_numbers'
26
+ require 'ruby-prof/printers/graph_html_printer'
27
+ require 'ruby-prof/printers/graph_printer'
28
+ require 'ruby-prof/printers/multi_printer'
29
+
30
+ module RubyProf
31
+ # Checks if the user specified the clock mode via
32
+ # the RUBY_PROF_MEASURE_MODE environment variable
33
+ def self.figure_measure_mode
34
+ case ENV["RUBY_PROF_MEASURE_MODE"]
35
+ when "wall" || "wall_time"
36
+ RubyProf.measure_mode = RubyProf::WALL_TIME
37
+ when "cpu" || "cpu_time"
38
+ if ENV.key?("RUBY_PROF_CPU_FREQUENCY")
39
+ RubyProf.cpu_frequency = ENV["RUBY_PROF_CPU_FREQUENCY"].to_f
40
+ else
41
+ begin
42
+ open("/proc/cpuinfo") do |f|
43
+ f.each_line do |line|
44
+ s = line.slice(/cpu MHz\s*:\s*(.*)/, 1)
45
+ if s
46
+ RubyProf.cpu_frequency = s.to_f * 1000000
47
+ break
48
+ end
49
+ end
50
+ end
51
+ rescue Errno::ENOENT
52
+ end
53
+ end
54
+ RubyProf.measure_mode = RubyProf::CPU_TIME
55
+ when "allocations"
56
+ RubyProf.measure_mode = RubyProf::ALLOCATIONS
57
+ when "memory"
58
+ RubyProf.measure_mode = RubyProf::MEMORY
59
+ else
60
+ # the default...
61
+ RubyProf.measure_mode = RubyProf::PROCESS_TIME
62
+ end
63
+ end
64
+ end
65
+
66
+ RubyProf::figure_measure_mode
@@ -8,24 +8,36 @@ module Rack
8
8
  @options = options
9
9
  @options[:min_percent] ||= 1
10
10
  @tmpdir = options[:path] || Dir.tmpdir
11
- @printer_klasses = {::RubyProf::FlatPrinter => 'flat.txt',
12
- ::RubyProf::GraphPrinter => 'graph.txt',
13
- ::RubyProf::GraphHtmlPrinter => 'graph.html',
14
- ::RubyProf::CallStackPrinter => 'call_stack.html'}
11
+ @printer_klasses = @options[:printers] || {::RubyProf::FlatPrinter => 'flat.txt',
12
+ ::RubyProf::GraphPrinter => 'graph.txt',
13
+ ::RubyProf::GraphHtmlPrinter => 'graph.html',
14
+ ::RubyProf::CallStackPrinter => 'call_stack.html'}
15
+
16
+ @printer_klasses = @options[:printers] || {::RubyProf::FlatPrinter => 'flat.txt',
17
+ ::RubyProf::GraphPrinter => 'graph.txt',
18
+ ::RubyProf::GraphHtmlPrinter => 'graph.html',
19
+ ::RubyProf::CallStackPrinter => 'call_stack.html'}
20
+
21
+ @skip_paths = options[:skip_paths] || [%r{^/assets}, %r{\.css$}, %r{\.js}, %r{\.png}, %r{\.jpeg}]
15
22
  end
16
23
 
17
24
  def call(env)
18
- result = nil
19
- data = ::RubyProf::Profile.profile do
20
- result = @app.call(env)
21
- end
22
-
23
25
  request = Rack::Request.new(env)
24
- path = request.path.gsub('/', '-')
25
- path.slice!(0)
26
26
 
27
- print(data, path)
28
- result
27
+ if @skip_paths.any? {|skip_path| skip_path =~ request.path}
28
+ @app.call(env)
29
+ else
30
+ result = nil
31
+ data = ::RubyProf::Profile.profile do
32
+ result = @app.call(env)
33
+ end
34
+
35
+ path = request.path.gsub('/', '-')
36
+ path.slice!(0)
37
+
38
+ print(data, path)
39
+ result
40
+ end
29
41
  end
30
42
 
31
43
  def print(data, path)
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+
3
+ require "ruby-prof"
4
+
5
+ at_exit {
6
+ result = RubyProf.stop
7
+ printer = RubyProf::FlatPrinter.new(result)
8
+ printer.print(STDOUT)
9
+ }
10
+ RubyProf.start
@@ -7,7 +7,7 @@ match = version_header.match(/RUBY_PROF_VERSION\s*"([^"]+)"/)
7
7
  raise(RuntimeError, "Could not determine RUBY_PROF_VERSION") if not match
8
8
 
9
9
  # For now make this an rc1
10
- RUBY_PROF_VERSION = "#{match[1]}.rc2"
10
+ RUBY_PROF_VERSION = "#{match[1]}.rc3"
11
11
 
12
12
  Gem::Specification.new do |spec|
13
13
  spec.name = "ruby-prof"
@@ -45,6 +45,8 @@ EOF
45
45
  'ext/ruby_prof/*.h',
46
46
  'ext/ruby_prof/vc/*.sln',
47
47
  'ext/ruby_prof/vc/*.vcxproj',
48
+ 'lib/ruby-prof.rb',
49
+ 'lib/unprof.rb',
48
50
  'lib/ruby-prof/*.rb',
49
51
  'lib/ruby-prof/images/*.png',
50
52
  'lib/ruby-prof/printers/*.rb',
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.11.0.rc2
4
+ version: 0.11.0.rc3
5
5
  prerelease: 7
6
6
  platform: x86-mingw32
7
7
  authors:
@@ -89,6 +89,8 @@ files:
89
89
  - ext/ruby_prof/vc/ruby_prof.sln
90
90
  - ext/ruby_prof/vc/ruby_prof.vcxproj
91
91
  - ext/ruby_prof/vc/ruby_prof_18.vcxproj
92
+ - lib/ruby-prof.rb
93
+ - lib/unprof.rb
92
94
  - lib/ruby-prof/aggregate_call_info.rb
93
95
  - lib/ruby-prof/call_info.rb
94
96
  - lib/ruby-prof/call_info_visitor.rb