mirror of
https://github.com/golang/go
synced 2024-11-18 05:04:47 -07:00
cmd/trace: skip links for buckets with 0 count
Change-Id: Ib1c2f7cc8e8f631ed9e74161699332f492d4cb0d Reviewed-on: https://go-review.googlesource.com/112196 Reviewed-by: Peter Weinberger <pjw@google.com>
This commit is contained in:
parent
d96221f206
commit
9eface7077
@ -861,12 +861,16 @@ func (h *durationHistogram) ToHTML(urlmaker func(min, max time.Duration) string)
|
|||||||
fmt.Fprintf(w, `<table>`)
|
fmt.Fprintf(w, `<table>`)
|
||||||
for i := h.MinBucket; i <= h.MaxBucket; i++ {
|
for i := h.MinBucket; i <= h.MaxBucket; i++ {
|
||||||
// Tick label.
|
// Tick label.
|
||||||
fmt.Fprintf(w, `<tr><td class="histoTime" align="right"><a href=%s>%s</a></td>`, urlmaker(h.BucketMin(i), h.BucketMin(i+1)), niceDuration(h.BucketMin(i)))
|
if h.Buckets[i] > 0 {
|
||||||
|
fmt.Fprintf(w, `<tr><td class="histoTime" align="right"><a href=%s>%s</a></td>`, urlmaker(h.BucketMin(i), h.BucketMin(i+1)), niceDuration(h.BucketMin(i)))
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(w, `<tr><td class="histoTime" align="right">%s</td>`, niceDuration(h.BucketMin(i)))
|
||||||
|
}
|
||||||
// Bucket bar.
|
// Bucket bar.
|
||||||
width := h.Buckets[i] * barWidth / maxCount
|
width := h.Buckets[i] * barWidth / maxCount
|
||||||
fmt.Fprintf(w, `<td><div style="width:%dpx;background:blue;top:.6em;position:relative"> </div></td>`, width)
|
fmt.Fprintf(w, `<td><div style="width:%dpx;background:blue;position:relative"> </div></td>`, width)
|
||||||
// Bucket count.
|
// Bucket count.
|
||||||
fmt.Fprintf(w, `<td align="right"><div style="top:.6em;position:relative">%d</div></td>`, h.Buckets[i])
|
fmt.Fprintf(w, `<td align="right"><div style="position:relative">%d</div></td>`, h.Buckets[i])
|
||||||
fmt.Fprintf(w, "</tr>\n")
|
fmt.Fprintf(w, "</tr>\n")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user