Add colored percentage to htmlgen output

Signed-off-by: Clifford Wolf <clifford@clifford.at>
Signed-off-by: Tim 'mithro' Ansell <mithro@mithis.com>
This commit is contained in:
Clifford Wolf 2017-11-25 22:11:18 +01:00 committed by Tim 'mithro' Ansell
parent 2801c7f77f
commit 566f336957
1 changed files with 12 additions and 0 deletions

View File

@ -161,6 +161,9 @@ for segtype in segbits.keys():
segtype.upper(), re.sub("clbl[lm]", "int", segtype).upper()), file=f)
print("<table border>", file=f)
gray_bits = 0
colored_bits = 0
print("<tr>", file=f)
print("<th width=\"30\"></th>", file=f)
for frameidx in range(segframes[segtype]):
@ -267,6 +270,11 @@ for segtype in segbits.keys():
else:
onclick = " onmousedown=\"location.href = '#b%s'\"" % bit_pos
if bgcolor in ["#aaaaaa", "#444444"]:
gray_bits += 1
else:
colored_bits += 1
print("<td bgcolor=\"%s\" align=\"center\" title=\"%s\"%s><span style=\"font-size:10px\">%s</span></td>" %
(bgcolor, "\n".join(title), onclick, label), file=f)
print("</tr>", file=f)
@ -274,6 +282,10 @@ for segtype in segbits.keys():
print("<div>", file=f)
if True:
print(" gray: %d, colored: %d, total: %d, percentage: %.2f%%" % (gray_bits, colored_bits,
gray_bits + colored_bits, 100 * colored_bits / (gray_bits + colored_bits)))
bits_by_prefix = dict()
for bit_name, bit_pos in segbits[segtype].items():