From owner-svn-src-head@freebsd.org Thu Feb 8 05:18:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFA09F03980; Thu, 8 Feb 2018 05:18:30 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8600A73773; Thu, 8 Feb 2018 05:18:30 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 810A01191D; Thu, 8 Feb 2018 05:18:30 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w185IUiw071677; Thu, 8 Feb 2018 05:18:30 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w185IUxl071676; Thu, 8 Feb 2018 05:18:30 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201802080518.w185IUxl071676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 8 Feb 2018 05:18:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329013 - head/usr.bin/vmstat X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/usr.bin/vmstat X-SVN-Commit-Revision: 329013 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Feb 2018 05:18:31 -0000 Author: jhibbits Date: Thu Feb 8 05:18:30 2018 New Revision: 329013 URL: https://svnweb.freebsd.org/changeset/base/329013 Log: 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 Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Thu Feb 8 03:12:25 2018 (r329012) +++ head/usr.bin/vmstat/vmstat.c Thu Feb 8 05:18:30 2018 (r329013) @@ -1304,7 +1304,7 @@ print_intrcnts(unsigned long *intrcnts, unsigned long 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",