class RubyProf::MultiPrinter

  1. lib/ruby-prof/multi_printer.rb
Parent: RubyProf

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.

Methods

Public Class

  1. new

Public Instance

  1. flat_profile
  2. graph_profile
  3. print
  4. stack_profile
  5. tree_profile

Public Class methods

new (result)
[show source]
# File lib/ruby-prof/multi_printer.rb, line 7
def initialize(result)
  @stack_printer = CallStackPrinter.new(result)
  @graph_printer = GraphHtmlPrinter.new(result)
  @tree_printer = CallTreePrinter.new(result)
  @flat_printer = FlatPrinter.new(result)
end

Public Instance methods

flat_profile ()

the name of the flat profile file

[show source]
# File lib/ruby-prof/multi_printer.rb, line 50
def flat_profile
  "#{@directory}/#{@profile}.flat.txt"
end
graph_profile ()

the name of the graph profile file

[show source]
# File lib/ruby-prof/multi_printer.rb, line 40
def graph_profile
  "#{@directory}/#{@profile}.graph.html"
end
print (options)

create profile files under options or the current directory. options is used as the base name for the pofile file, defaults to "profile".

[show source]
# File lib/ruby-prof/multi_printer.rb, line 17
def print(options)
  @profile = options.delete(:profile) || "profile"
  @directory = options.delete(:path) || File.expand_path(".")
  File.open(stack_profile, "w") do |f|
    @stack_printer.print(f, options.merge(:graph => "#{@profile}.graph.html"))
  end
  File.open(graph_profile, "w") do |f|
    @graph_printer.print(f, options)
  end
  File.open(tree_profile, "w") do |f|
    @tree_printer.print(f, options)
  end
  File.open(flat_profile, "w") do |f|
    @flat_printer.print(f, options)
  end
end
stack_profile ()

the name of the call stack profile file

[show source]
# File lib/ruby-prof/multi_printer.rb, line 35
def stack_profile
  "#{@directory}/#{@profile}.stack.html"
end
tree_profile ()

the name of the callgrind profile file

[show source]
# File lib/ruby-prof/multi_printer.rb, line 45
def tree_profile
  "#{@directory}/#{@profile}.grind.dat"
end