Commit cd09ca4
committed
src: clamp idle time to avoid underflow in metrics
Clamp idle time values before subtracting from loop duration to
avoid unsigned underflow when clock skew causes idle time to be
slightly larger than total loop time. This manifests on Windows
when the loop is nearly 100% idle.
Applied in two locations:
- uv_metrics_cb_: prevents bogus rolling_est_lag_ values
- get_event_loop_stats_: prevents bogus loop_utilization values
Fixes: nodesource/nsolid-private#15
PR-URL: #372
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>1 parent 45abe09 commit cd09ca4
1 file changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
614 | 618 | | |
615 | 619 | | |
616 | 620 | | |
| |||
2162 | 2166 | | |
2163 | 2167 | | |
2164 | 2168 | | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
2165 | 2175 | | |
2166 | 2176 | | |
2167 | 2177 | | |
| |||
0 commit comments