class Perf::ReportFormatHtml
Constants
- COUNT_FORMAT
- INDENT
- PERCENT_FORMAT
- TIME_FORMAT
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/perf/report_format_html.rb, line 12 def initialize super @line=0 end
Public Instance Methods
format(perf,options={})
click to toggle source
Example¶ ↑
m=Perf::Meter.new m.measure(:something) { something } m.report_html()
Calls superclass method
Perf::ReportFormat#format
# File lib/perf/report_format_html.rb, line 83 def format(perf,options={}) options||={} @time_format = options[:time_format] || TIME_FORMAT @percent_format = options[:percent_format] || PERCENT_FORMAT @count_format = options[:count_format] || COUNT_FORMAT @indent_string = options[:indent_string] || INDENT super end
format_header(v)
click to toggle source
Formats the header
# File lib/perf/report_format_html.rb, line 93 def format_header(v) "<table class='rubyperf_report'><tr>" \ "<th class='title'>#{v[:title]}</th>" \ "<th class='percent'>%</th>" \ "<th class='accuracy'>accuracy</th>" \ "<th class='count'>count</th>" \ "<th class='user_time'>user</th>" \ "<th class='system_time'>system</th>" \ "<th class='total_time'>total</th>" \ "<th class='real_time'>real</th>" \ "</tr>" end
format_measure(v)
click to toggle source
Formats the measure
# File lib/perf/report_format_html.rb, line 107 def format_measure(v) @line+=1 percent= v[:percent].is_a?(String) ? v[:percent] : (@percent_format % v[:percent]) "<tr class='#{@line % 2==0 ? "even_row" : "odd_row"}'>" \ "<td class='title'>#{v[:title]}</td>" \ "<td class='percent'>#{percent}</td>" \ "<td class='accuracy'>#{v[:accuracy]}</td>" \ "<td class='count'>#{@count_format % v[:count]}</td>" \ "<td class='user_time'>#{@time_format % v[:time].utime}</td>" \ "<td class='system_time'>#{@time_format % v[:time].stime}</td>" \ "<td class='total_time'>#{@time_format % v[:time].total}</td>" \ "<td class='real_time'>#{@time_format % v[:time].real}</td>" \ "</tr>" end
format_title(what,options)
click to toggle source
# File lib/perf/report_format_html.rb, line 126 def format_title(what,options) path=what.split("\\") "#{(path.size-2) ? @indent_string * (path.size-2) : ""}\\#{CGI.escapeHTML(path.last)}" end