Class: RubyProf::MultiPrinter
- Inherits:
-
Object
- Object
- RubyProf::MultiPrinter
- Defined in:
- lib/ruby-prof/printers/multi_printer.rb
Overview
Helper class to simplify printing profiles of several types from one profiling run. Currently prints a flat profile, a callgrind profile, a call stack profile and a graph profile.
Instance Method Summary collapse
-
#flat_profile ⇒ Object
the name of the flat profile file.
-
#graph_profile ⇒ Object
the name of the graph profile file.
-
#initialize(result) ⇒ MultiPrinter
constructor
A new instance of MultiPrinter.
-
#print(options) ⇒ Object
create profile files under options or the current directory.
-
#stack_profile ⇒ Object
the name of the call stack profile file.
-
#tree_profile ⇒ Object
the name of the callgrind profile file.
Constructor Details
#initialize(result) ⇒ MultiPrinter
Returns a new instance of MultiPrinter.
8 9 10 11 12 13 |
# File 'lib/ruby-prof/printers/multi_printer.rb', line 8 def initialize(result) @stack_printer = CallStackPrinter.new(result) @graph_printer = GraphHtmlPrinter.new(result) @tree_printer = CallTreePrinter.new(result) @flat_printer = FlatPrinter.new(result) end |
Instance Method Details
#flat_profile ⇒ Object
the name of the flat profile file
53 54 55 |
# File 'lib/ruby-prof/printers/multi_printer.rb', line 53 def flat_profile "#{@directory}/#{@profile}.flat.txt" end |
#graph_profile ⇒ Object
the name of the graph profile file
43 44 45 |
# File 'lib/ruby-prof/printers/multi_printer.rb', line 43 def graph_profile "#{@directory}/#{@profile}.graph.html" end |
#print(options) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ruby-prof/printers/multi_printer.rb', line 18 def print() @profile = .delete(:profile) || "profile" @directory = .delete(:path) || File.(".") File.open(stack_profile, "w") do |f| @stack_printer.print(f, .merge(:graph => "#{@profile}.graph.html")) end File.open(graph_profile, "w") do |f| @graph_printer.print(f, ) end @tree_printer.print(.merge(:path => @directory, :profile => @profile)) File.open(flat_profile, "w") do |f| @flat_printer.print(f, ) end end |
#stack_profile ⇒ Object
the name of the call stack profile file
38 39 40 |
# File 'lib/ruby-prof/printers/multi_printer.rb', line 38 def stack_profile "#{@directory}/#{@profile}.stack.html" end |
#tree_profile ⇒ Object
the name of the callgrind profile file
48 49 50 |
# File 'lib/ruby-prof/printers/multi_printer.rb', line 48 def tree_profile "#{@directory}/#{@profile}.callgrind.out.#{$$}" end |