Class: Rcov::HTMLProfiling
- Inherits:
-
HTMLCoverage
- Object
- Formatter
- HTMLCoverage
- Rcov::HTMLProfiling
- Defined in:
- lib/rcov/report.rb
Overview
:nodoc:
Constant Summary collapse
- DEFAULT_OPTS =
{:destdir => "profiling"}
Constants inherited from HTMLCoverage
Rcov::HTMLCoverage::CSS_PROLOG, Rcov::HTMLCoverage::JAVASCRIPT_PROLOG
Constants included from XX::Markup
XX::Markup::XX_MARKUP_RECURSIVE_INCLUSION_PROC
Instance Method Summary collapse
- #default_color ⇒ Object
- #default_title ⇒ Object
-
#initialize(opts = {}) ⇒ HTMLProfiling
constructor
A new instance of HTMLProfiling.
- #output_color_table? ⇒ Boolean
- #span_class(sourceinfo, marked, count) ⇒ Object
Methods inherited from HTMLCoverage
Methods included from XX::XMLish
Methods included from XX::Markup
Methods included from XX::Markup::ClassMethods
#xx_ancestors, #xx_config, #xx_config_for, #xx_configure, #xx_define_tag_method, #xx_define_tmp_method, #xx_remove_tag_method, #xx_tag_method_name
Methods included from XX::Markup::InstanceMethods
#method_missing, #xx_ancestors, #xx_any_, #xx_cdata_, #xx_class, #xx_config, #xx_config_for, #xx_configure, #xx_define_tag_method, #xx_define_tmp_method, #xx_doc, #xx_markup_, #xx_parse_attributes, #xx_parse_yaml_attributes, #xx_remove_tag_method, #xx_tag_, #xx_tag_method_name, #xx_text_, #xx_which, #xx_with_doc_in_effect
Methods included from XX::XHTML
Methods inherited from Formatter
#add_file, #code_coverage, #each_file_pair_sorted, #mangle_filename, #normalize_filename, #num_code_lines, #num_lines, #sorted_file_pairs, #total_coverage
Constructor Details
#initialize(opts = {}) ⇒ HTMLProfiling
Returns a new instance of HTMLProfiling.
1118 1119 1120 1121 1122 1123 |
# File 'lib/rcov/report.rb', line 1118 def initialize(opts = {}) = DEFAULT_OPTS.clone.update(opts) super() @max_cache = {} @median_cache = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class XX::Markup::InstanceMethods
Instance Method Details
#default_color ⇒ Object
1129 1130 1131 1132 1133 1134 1135 |
# File 'lib/rcov/report.rb', line 1129 def default_color if @color "rgb(179,205,255)" else "rgb(255, 255, 255)" end end |
#default_title ⇒ Object
1125 1126 1127 |
# File 'lib/rcov/report.rb', line 1125 def default_title "Bogo-profile information" end |
#output_color_table? ⇒ Boolean
1137 1138 1139 |
# File 'lib/rcov/report.rb', line 1137 def output_color_table? false end |
#span_class(sourceinfo, marked, count) ⇒ Object
1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 |
# File 'lib/rcov/report.rb', line 1141 def span_class(sourceinfo, marked, count) full_scale_range = @fsr # dB nz_count = sourceinfo.counts.select{|x| x && x != 0} nz_count << 1 # avoid div by 0 max = @max_cache[sourceinfo] ||= nz_count.max #avg = @median_cache[sourceinfo] ||= 1.0 * # nz_count.inject{|a,b| a+b} / nz_count.size median = @median_cache[sourceinfo] ||= 1.0 * nz_count.sort[nz_count.size/2] max ||= 2 max = 2 if max == 1 if marked == true count = 1 if !count || count == 0 idx = 50 + 1.0 * (500/full_scale_range) * Math.log(count/median) / Math.log(10) idx = idx.to_i idx = 0 if idx < 0 idx = 100 if idx > 100 "run#{idx}" else nil end end |