diff --git a/src/tools/pw-top.c b/src/tools/pw-top.c index 4df68a86b..e0f558d76 100644 --- a/src/tools/pw-top.c +++ b/src/tools/pw-top.c @@ -450,9 +450,11 @@ static const char *print_perc(char *buf, bool active, size_t len, uint64_t val, snprintf(buf, len, " --- "); } else if (val == (uint64_t)-2) { snprintf(buf, len, " +++ "); + } else if (quantum == 0.0f) { + snprintf(buf, len, " ??? "); } else { float frac = val / 1000000000.f; - snprintf(buf, len, "%5.2f", quantum == 0.0f ? 0.0f : frac/quantum); + snprintf(buf, len, "%5.2f", frac/quantum); } return buf; } @@ -504,7 +506,7 @@ static void print_node(struct data *d, struct driver *i, struct node *n, int y) if (i->clock.rate.denom) quantum = (float)i->clock.duration * i->clock.rate.num / (float)i->clock.rate.denom; else - quantum = 0.0; + quantum = 0.0f; if (n->measurement.awake >= n->measurement.signal) waiting = n->measurement.awake - n->measurement.signal;