lib/stackprof-webnav/presenter.rb in stackprof-webnav-0.0.2 vs lib/stackprof-webnav/presenter.rb in stackprof-webnav-0.0.3
- old
+ new
@@ -1,7 +1,8 @@
require 'better_errors'
require 'stringio'
+require 'rexml/document'
module StackProf
module Webnav
class Presenter
attr_reader :report
@@ -29,9 +30,26 @@
:samples => call,
:samples_pct => percent(call.to_f/report.overall_samples),
:method => info[:name]
}
end
+ end
+
+ def listing_dumps
+ xml_data = Net::HTTP.get(URI.parse(Server.report_dump_listing))
+ if xml_data
+ doc = REXML::Document.new(xml_data)
+ dumps = []
+ doc.elements.each('ListBucketResult/Contents') do |ele|
+ dumps << {
+ :key => ele.elements["Key"].text,
+ :date => ele.elements["LastModified"].text,
+ :uri => Server.report_dump_listing + ele.elements["Key"].text
+ }
+ end
+ end
+ dumps.sort_by! { |hash| hash[:date] }
+ dumps.reverse!
end
def method_info name
name = /#{Regexp.escape name}/ unless Regexp === name
frames = report.frames.select do |frame, info|