Temporarily widen count for interrupt rate calculations on 32-bit archs
If the interrupt count is very high (greater than ~42M), notably on one-shot execution on long running systems, the intermediate multiplication step in the rate calculation will overflow the width of a 32-bit architecture long (32 bits), causing the rest of the calculation to calculate with a truncated value, and report very low rates (sometimes 0). MFC after: 2 weeks
This commit is contained in:
parent
354fce2869
commit
fb3d972447
@ -1304,7 +1304,7 @@ print_intrcnts(unsigned long *intrcnts, unsigned long *old_intrcnts,
|
||||
for (i = 0, intrcnt=intrcnts, old_intrcnt=old_intrcnts; i < nintr; i++) {
|
||||
if (intrname[0] != '\0' && (*intrcnt != 0 || aflag)) {
|
||||
count = *intrcnt - *old_intrcnt;
|
||||
rate = (count * 1000 + period_ms / 2) / period_ms;
|
||||
rate = ((uint64_t)count * 1000 + period_ms / 2) / period_ms;
|
||||
xo_open_instance("interrupt");
|
||||
xo_emit("{d:name/%-*s}{ket:name/%s} "
|
||||
"{:total/%20lu} {:rate/%10lu}\n",
|
||||
|
Loading…
Reference in New Issue
Block a user