Skip to content

Commit 4e0d2f1

Browse files
committedJan 15, 2020
Auto merge of #7803 - alexcrichton:less-overflow, r=Eh2406
Don't assume iowait always increases on Linux According to [documentation] looks like this value is documented as it can decrease, so let's handle that without overflowing. [documentation]: http://man7.org/linux/man-pages/man5/proc.5.html
2 parents c22380d + 4c665c0 commit 4e0d2f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎src/cargo/util/cpu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ mod imp {
7272
let nice = next.nice - prev.nice;
7373
let system = next.system - prev.system;
7474
let idle = next.idle - prev.idle;
75-
let iowait = next.iowait - prev.iowait;
75+
let iowait = next.iowait.checked_sub(prev.iowait).unwrap_or(0);
7676
let irq = next.irq - prev.irq;
7777
let softirq = next.softirq - prev.softirq;
7878
let steal = next.steal - prev.steal;

0 commit comments

Comments
 (0)