class Vernier::Output::FileListing

def format_file(output, filename, all_samples, total:)

def format_file(output, filename, all_samples, total:)
  samples = all_samples[filename]
  # file_name, lines, file_wall, file_cpu, file_idle, file_sort
  output << sprintf(" TOTAL |  SELF  | LINE SOURCE\n")
  File.readlines(filename).each_with_index do |line, i|
    lineno = i + 1
    calls = samples[lineno]
    if calls && calls.total > 0
      output << sprintf("%5.1f%% | %5.1f%% | % 4i  %s", 100 * calls.total / total.to_f, 100 * calls.self / total.to_f, lineno, line)
    else
      output << sprintf("       |        | % 4i  %s", lineno, line)
    end
  end
end