Class: JRubyProf::GraphHtmlPrinter
Constant Summary
collapse
" <html>\n <body>\n<head>\n<style media=\"all\" type=\"text/css\">\n table {\n border-collapse: collapse;\n border: 1px solid #CCC;\n font-family: Verdana, Arial, Helvetica, sans-serif;\n font-size: 9pt;\n line-height: normal;\n }\n\n th {\n text-align: center;\n border-top: 1px solid #FB7A31;\n border-bottom: 1px solid #FB7A31;\n background: #FFC;\n padding: 0.3em;\n border-left: 1px solid silver;\n }\n\n tr.break td {\n border: 0;\n border-top: 1px solid #FB7A31;\n padding: 0;\n margin: 0;\n }\n\n tr.method td {\n font-weight: bold;\n }\n\n td {\n padding: 0.3em;\n }\n\n td:first-child {\n width: 190px;\n }\n\n td {\n border-left: 1px solid #CCC;\n text-align: center;\n } \n </style>\n</head>\n"
"<table>\n <tr>\n <th>%total</th>\n <th>%self</th>\n <th>total</th>\n <th>self</th>\n <th>children</th>\n <th>calls</th>\n <th>Name</th>\n </tr>\n"
"</table>\n<br />\n<br />\n"
"</body>\n</html>\n"
Instance Attribute Summary
#thread_set
Instance Method Summary
collapse
#initialize, #print_to_file
Instance Method Details
#print_method(output, method, total_duration, major_row) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/jruby-prof/graph_html_printer.rb', line 30
def print_method(output, method, total_duration, major_row)
return if method.name =~ /JRubyProf\.stop/
total = method.duration
total_pc = (total.to_f/total_duration)*100
children = method.childrens_duration
self_ = total - children
self_pc = (self_.to_f/total_duration)*100
calls = method.count
name = method.name
inv_id = nil
template = File.read(File.join(File.dirname(__FILE__), "..", "..", "templates", "graph_row.html.erb"))
erb = ERB.new(template)
output.puts(erb.result(binding))
end
|
#print_on(output) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/jruby-prof/graph_html_printer.rb', line 4
def print_on(output)
output.puts
total_duration = thread_set.duration
thread_set.invocations.each_with_index do |thread, i|
methods = thread.get_methods.values.sort_by {|m| m.duration }.reverse
output.puts "<h3>Thread #{i + 1}/#{thread_set.length}</h3>"
output.puts
rows = methods.map do |method|
method.parent_contexts.each do |context|
print_method(output, context, total_duration, false)
end
print_method(output, method, total_duration, true)
method.child_contexts.each do |context|
print_method(output, context, total_duration, false)
end
output.puts " <tr class=\"break\">\n <td colspan=\"7\"></td>\n </tr>\n HTML\n end\n output.puts TABLE_FOOTER\n end\n output.puts FOOTER\nend\n"
|
#safe_name(name) ⇒ Object
45
46
47
|
# File 'lib/jruby-prof/graph_html_printer.rb', line 45
def safe_name(name)
name.gsub("#", "_inst_").gsub(".", "_stat_")
end
|