Fix overflow in delta percentage calculation due to the fact that our 32 bit
authorMatthew Dillon <dillon@dragonflybsd.org>
Fri, 11 Jul 2003 23:33:24 +0000 (23:33 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Fri, 11 Jul 2003 23:33:24 +0000 (23:33 +0000)
cp_time[] counters are now in microseconds.

contrib/top/utils.c

index 04a2d35..ab0a33d 100644 (file)
@@ -9,7 +9,7 @@
  *  Copyright (c) 1989, 1990, 1992, William LeFebvre, Northwestern University
  *
  * $FreeBSD: src/contrib/top/utils.c,v 1.3.6.1 2002/08/11 17:09:25 dwmalone Exp $
- * $DragonFly: src/contrib/top/utils.c,v 1.2 2003/06/17 04:24:07 dillon Exp $
+ * $DragonFly: src/contrib/top/utils.c,v 1.3 2003/07/11 23:33:24 dillon Exp $
  */
 
 /*
@@ -316,7 +316,7 @@ long *diffs;
     if(total_change) {
         for (i = 0; i < cnt; i++)
         {
-          *out++ = (int)((*diffs++ * 1000 + half_total) / total_change);
+          *out++ = (int)((*diffs++ * 1000LL + half_total) / total_change);
         }
     }