</head>
<body>
<table>
- <tr><th>File</th><th>Coverage</th></tr>
+ <tr>
+ <th>File</th>
+ <th title=\"Ratio of covered edge points to all edge points in file.\">Edge Coverage</th>
+ <th width=200 align=\"right\" title=\"Ratio of all at least partly covered functions to \
+all instrumented functions in file or in total.\">Functions Coverage</th></tr>
<tr><td><em>Files with 0 coverage are not shown.</em></td></tr>
$filenames
</table>
"""Build a filename->pct coverage."""
result = dict()
all_points = set()
+ all_funcs_cnt = 0
+ cov_funcs_cnt = 0
for filename, fns in self.point_symbol_info.items():
file_points = []
+ cov_file_funcs_cnt = 0
for fn, points in fns.items():
+ all_funcs_cnt += 1
+ if len(set(points) & self.covered_points) > 0:
+ cov_funcs_cnt += 1
+ cov_file_funcs_cnt += 1
file_points.extend(points.keys())
covered_points = self.covered_points & set(file_points)
all_points |= set(file_points)
- result[filename] = int(math.ceil(
- len(covered_points) * 100 / len(file_points)))
+ result[filename] = (
+ int(math.ceil(len(covered_points) * 100 / len(file_points))),
+ int(math.ceil(cov_file_funcs_cnt * 100 / len(fns)))
+ )
+
+ result[SymcovData.TOTAL_COV_KEY] = (
+ int(math.ceil(len(self.covered_points) * 100 / len(all_points))),
+ int(math.ceil(cov_funcs_cnt * 100 / all_funcs_cnt))
+ )
- result[SymcovData.TOTAL_COV_KEY] = int(math.ceil(
- len(self.covered_points) * 100 / len(all_points)))
return result
def total_coverage(self):
return self.file_coverage[SymcovData.TOTAL_COV_KEY]
-
def format_pct(pct):
pct_str = str(max(0, min(100, pct)))
zeroes = '0' * (3 - len(pct_str))
if filename.startswith(tuple(exclude_headers)) and\
filename.endswith((".h", ".hpp")):
continue
- file_coverage = self.__symcov_data.file_coverage[filename]
- if not file_coverage:
+ edge_coverage, funcs_coverage = self.__symcov_data.file_coverage[filename]
+ if not edge_coverage:
continue
filelist.append(
"<tr><td><a href=\"./{name}.html\">{name}</a></td>"
- "<td>{coverage}%</td></tr>".format(
+ "<td align=\"right\">{edge}%</td><td align=\"right\">{funcs}%</td></tr>".format(
name=self.__html_chars_escape(filename),
- coverage=format_pct(file_coverage)))
+ edge=format_pct(edge_coverage),
+ funcs=format_pct(funcs_coverage)))
# TODO: Print it pretty
- print("{:<76} {}%".format(filename, file_coverage))
+ print("{:<76} {}% {}%".format(filename, edge_coverage, funcs_coverage))
self.__dump_src_file(filename)
+ total_edge, total_funcs = self.__symcov_data.total_coverage()
filelist.append(
- "<tr><td><b>Total coverage</b></td>"
- "<td>{coverage}%</td></tr>".format(
- coverage=format_pct(self.__symcov_data.total_coverage())))
+ "<tr><td><b>Total</b></td>"
+ "<td align=\"right\">{edge}%</td><td align=\"right\">{funcs}%</td></tr>".format(
+ edge=format_pct(total_edge),
+ funcs=format_pct(total_funcs)))
response = string.Template(INDEX_PAGE_TMPL).safe_substitute(
filenames='\n'.join(filelist))