ruby-prof 0.5.1-mswin32 → 0.5.2-mswin32

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'rake/rdoctask'
5
5
  SO_NAME = "ruby_prof.so"
6
6
 
7
7
  # ------- Default Package ----------
8
- RUBY_PROF_VERSION = "0.5.1"
8
+ RUBY_PROF_VERSION = "0.5.2"
9
9
 
10
10
  FILES = FileList[
11
11
  'Rakefile',
@@ -14,6 +14,7 @@ FILES = FileList[
14
14
  'CHANGES',
15
15
  'bin/*',
16
16
  'lib/**/*',
17
+ 'rails_plugin/**/*',
17
18
  'examples/*',
18
19
  'ext/*',
19
20
  'doc/**/*',
data/ext/ruby_prof.c CHANGED
@@ -57,7 +57,7 @@
57
57
 
58
58
  /* ================ Constants =================*/
59
59
  #define INITIAL_STACK_SIZE 8
60
- #define PROF_VERSION "0.5.1"
60
+ #define PROF_VERSION "0.5.2"
61
61
 
62
62
 
63
63
  /* ================ Measurement =================*/
data/lib/ruby_prof.so CHANGED
Binary file
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,57 @@
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
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: ruby-prof
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.1
7
- date: 2007-07-18 10:34:52 -06:00
6
+ version: 0.5.2
7
+ date: 2007-07-19 14:02:03 -06:00
8
8
  summary: Fast Ruby profiler
9
9
  require_paths:
10
10
  - lib
@@ -44,6 +44,10 @@ files:
44
44
  - lib/ruby-prof/graph_printer.rb
45
45
  - lib/ruby-prof/profile_test_case.rb
46
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
47
51
  - examples/flat.txt
48
52
  - examples/graph.html
49
53
  - examples/graph.txt