Class: Estackprof::Report

Inherits:
StackProf::Report
  • Object
show all
Defined in:
lib/estackprof/report.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create(files) ⇒ Object



7
8
9
10
11
12
# File 'lib/estackprof/report.rb', line 7

def self.create(files)
  reports = files.map do |file|
    new(Marshal.load(IO.binread(file)))
  end
  reports.inject(:+)
end

Instance Method Details



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/estackprof/report.rb', line 14

def print_text(limit:, pattern:, sort_by_total: false, out: $stdout)
  print_summary(out)
  print_header(out)

  list = frames(sort_by_total)
  if pattern
    list = list.filter do |_frame, info|
      %i[file name].any? { |s| info[s].match?(pattern) }
    end
  end
  list = list.first(limit) if limit
  print_body(list, out)
end