---
 components/cpu.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/components/cpu.c b/components/cpu.c
index d9bd018..47a10c5 100644
--- a/components/cpu.c
+++ b/components/cpu.c
@@ -92,6 +92,11 @@
                        return NULL;
                }
 
+               if (a[CP_USER] + a[CP_NICE] + a[CP_SYS] + a[CP_INTR] + 
a[CP_IDLE] ==
+                   b[CP_USER] + b[CP_NICE] + b[CP_SYS] + b[CP_INTR] + 
b[CP_IDLE]) {
+                       return NULL;
+               }
+
                return bprintf("%d", 100 *
                               ((a[CP_USER] + a[CP_NICE] + a[CP_SYS] +
                                 a[CP_INTR]) -
-- 
2.20.1


Reply via email to