From owner-svn-src-all@freebsd.org Sun Dec 29 12:24:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7B2A1DDDA9; Sun, 29 Dec 2019 12:24:41 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47m0B143NQz4RvS; Sun, 29 Dec 2019 12:24:41 +0000 (UTC) (envelope-from trasz@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 86771196F9; Sun, 29 Dec 2019 12:24:41 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xBTCOfGx082157; Sun, 29 Dec 2019 12:24:41 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xBTCOf5k082156; Sun, 29 Dec 2019 12:24:41 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912291224.xBTCOf5k082156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 29 Dec 2019 12:24:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356171 - head/usr.bin/vmstat X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/usr.bin/vmstat X-SVN-Commit-Revision: 356171 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2019 12:24:41 -0000 Author: trasz Date: Sun Dec 29 12:24:41 2019 New Revision: 356171 URL: https://svnweb.freebsd.org/changeset/base/356171 Log: Move type casts into a single place. No functional changes. MFC after: 2 weeks Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Sun Dec 29 12:22:11 2019 (r356170) +++ head/usr.bin/vmstat/vmstat.c Sun Dec 29 12:24:41 2019 (r356171) @@ -789,15 +789,14 @@ dovmstat(unsigned int interval, int reps) xo_close_container("processes"); xo_open_container("memory"); #define vmstat_pgtok(a) ((uintmax_t)(a) * (sum.v_page_size >> 10)) -#define rate(x) (((x) * rate_adj + halfuptime) / uptime) /* round */ +#define rate(x) (unsigned long)(((x) * rate_adj + halfuptime) / uptime) if (hflag) { prthuman("available-memory", total.t_avm * (uint64_t)sum.v_page_size, 5, HN_B); prthuman("free-memory", total.t_free * (uint64_t)sum.v_page_size, 5, HN_B); prthuman("total-page-faults", - (unsigned long)rate(sum.v_vm_faults - - osum.v_vm_faults), 5, 0); + rate(sum.v_vm_faults - osum.v_vm_faults), 5, 0); xo_emit(" "); } else { xo_emit(" "); @@ -808,55 +807,48 @@ dovmstat(unsigned int interval, int reps) vmstat_pgtok(total.t_free)); xo_emit(" "); xo_emit("{:total-page-faults/%5lu} ", - (unsigned long)rate(sum.v_vm_faults - - osum.v_vm_faults)); + rate(sum.v_vm_faults - osum.v_vm_faults)); } xo_close_container("memory"); xo_open_container("paging-rates"); xo_emit("{:page-reactivated/%3lu} ", - (unsigned long)rate(sum.v_reactivated - - osum.v_reactivated)); + rate(sum.v_reactivated - osum.v_reactivated)); xo_emit("{:paged-in/%3lu} ", - (unsigned long)rate(sum.v_swapin + sum.v_vnodein - + rate(sum.v_swapin + sum.v_vnodein - (osum.v_swapin + osum.v_vnodein))); xo_emit("{:paged-out/%3lu}", - (unsigned long)rate(sum.v_swapout + sum.v_vnodeout - + rate(sum.v_swapout + sum.v_vnodeout - (osum.v_swapout + osum.v_vnodeout))); if (hflag) { prthuman("freed", - (unsigned long)rate(sum.v_tfree - osum.v_tfree), - 5, 0); + rate(sum.v_tfree - osum.v_tfree), 5, 0); prthuman("scanned", - (unsigned long)rate(sum.v_pdpages - osum.v_pdpages), - 5, 0); + rate(sum.v_pdpages - osum.v_pdpages), 5, 0); xo_emit(" "); } else { xo_emit(" "); xo_emit("{:freed/%5lu} ", - (unsigned long)rate(sum.v_tfree - osum.v_tfree)); + rate(sum.v_tfree - osum.v_tfree)); xo_emit("{:scanned/%4lu} ", - (unsigned long)rate(sum.v_pdpages - osum.v_pdpages)); + rate(sum.v_pdpages - osum.v_pdpages)); } xo_close_container("paging-rates"); devstats(); xo_open_container("fault-rates"); - xo_emit("{:interrupts/%4lu}", - (unsigned long)rate(sum.v_intr - osum.v_intr)); + xo_emit("{:interrupts/%4lu}", rate(sum.v_intr - osum.v_intr)); if (hflag) { prthuman("system-calls", - (unsigned long)rate(sum.v_syscall - osum.v_syscall), - 5, 0); + rate(sum.v_syscall - osum.v_syscall), 5, 0); prthuman("context-switches", - (unsigned long)rate(sum.v_swtch - osum.v_swtch), - 5, 0); + rate(sum.v_swtch - osum.v_swtch), 5, 0); } else { xo_emit(" "); xo_emit("{:system-calls/%5lu} " "{:context-switches/%5lu}", - (unsigned long)rate(sum.v_syscall - osum.v_syscall), - (unsigned long)rate(sum.v_swtch - osum.v_swtch)); + rate(sum.v_syscall - osum.v_syscall), + rate(sum.v_swtch - osum.v_swtch)); } xo_close_container("fault-rates"); if (Pflag)