aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/cover/heatmap.go
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2024-08-26 12:32:02 +0200
committerTaras Madan <tarasmadan@google.com>2024-08-27 15:12:58 +0000
commite4f3ea1bc2e083feadcf5a6083a5d7e74e9fc53e (patch)
treed9efa4202bea3cee892525837201d188c782179c /pkg/cover/heatmap.go
parent5fc2677b4aeffac87aef5092b99ca41ccefa57fa (diff)
pkg/covermerger: add tooltips to every coverage number
Hover mouse onto the percent value to see details. To test: $ go run ./tools/syz-cover -heatmap upstream -from 2024-08-23 -to 2024-08-23 $ google-chrome upstream.html
Diffstat (limited to 'pkg/cover/heatmap.go')
-rw-r--r--pkg/cover/heatmap.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/cover/heatmap.go b/pkg/cover/heatmap.go
index 1d0f04b9d..4de56fbec 100644
--- a/pkg/cover/heatmap.go
+++ b/pkg/cover/heatmap.go
@@ -28,6 +28,7 @@ type templateHeatmapRow struct {
IsDir bool
Depth int
LastDayInstrumented int64
+ Tooltips []string
builder map[string]*templateHeatmapRow
instrumented map[civil.Date]int64
@@ -74,6 +75,8 @@ func (thm *templateHeatmapRow) prepareDataFor(dates []civil.Date) {
dateCoverage = 100 * thm.covered[d] / thm.instrumented[d]
}
thm.Coverage = append(thm.Coverage, dateCoverage)
+ thm.Tooltips = append(thm.Tooltips, fmt.Sprintf("Instrumented:\t%d blocks\nCovered:\t%d blocks",
+ thm.instrumented[d], thm.covered[d]))
}
if len(dates) > 0 {
lastDate := dates[len(dates)-1]