# File lib/ruby-prof/printers/call_stack_printer.rb, line 38
    def print(output = STDOUT, options = {})
      @output = output
      setup_options(options)
      if @graph_html = options.delete(:graph)
        @graph_html = "file://" + @graph_html if @graph_html[0]=="/"
      end

      print_header

      @overall_threads_time = @result.threads.inject(0) do |val, thread|
        val += thread.top_method.total_time
      end

      @result.threads.each do |thread|
        @current_thread_id = thread.id
        @overall_time = thread.top_method.total_time
        @output.print "<div class=\"thread\">Thread: #{thread.id} (#{"%4.2f%%" % ((@overall_time/@overall_threads_time)*100)} ~ #{@overall_time})</div>"
        @output.print "<ul name=\"thread\">"
        thread.methods.each do |m|
          # $stderr.print m.dump
          next unless m.root?
          m.call_infos.each do |ci|
            next unless ci.root?
            print_stack ci, thread.top_method.total_time
          end
        end
        @output.print "</ul>"
      end

      print_footer

      copy_image_files
    end