module StackProf::Remote::ReportSaver

Public Class Methods

marshaled_results() click to toggle source
# File lib/stackprof/remote/middleware.rb, line 71
def self.marshaled_results
  if results = StackProf.results
    Marshal.dump(results)
  end
end
save(base_path) click to toggle source
# File lib/stackprof/remote/middleware.rb, line 77
def self.save(base_path)
  if results = marshaled_results
    FileUtils.mkdir_p(base_path)
    filename = "stackprof-#{Process.pid}-#{Time.now.to_i}.dump"
    path     = File.join(base_path, filename)
    File.open(path, 'wb') do |f|
      f.write results
    end
    File.readable?(path) ? path : nil
  end
end