From nobody Fri Oct 07 02:00:52 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MkBNj0YrRz4f2Qg; Fri, 7 Oct 2022 02:00:53 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MkBNj07Wcz4DYb; Fri, 7 Oct 2022 02:00:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665108053; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ob6iDUphhjAvRCMUlRFr97ibqhCSfK6fOdlt2yVCn6U=; b=kGQctkG3X7IG+NamRWFHVHaox+WGMWd8Qlq65FncwG63XdBycFzgKqbu6LkX8zS8+SM1ev yVIxRw3+c2+Kcht8uxQzwsy+5U9K69Z3BF5BMcdZCGEj0QaJOJeO2n+fROTLeAJile18QE G+T62y/Ia/RHCyANuapqR+NAM/+7qJtV59R/YU/mXFUF1ve5y4UtyEz/77qBH17ggVLZ7y +BG9s7MZVuzVGAKpUoYv6b7uEctrn22jXeg93+PyDrzRHxbifZw9GXXovZ1jmvrexN0hIx hxMohvD7ygAG4MtzhPLxAU5xPWE0kIWEZdMmXyu93wxV1Gj0Zee8fvWMN5RoPQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MkBNh6JqZzRhy; Fri, 7 Oct 2022 02:00:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 29720q5v050771; Fri, 7 Oct 2022 02:00:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29720qkJ050770; Fri, 7 Oct 2022 02:00:52 GMT (envelope-from git) Date: Fri, 7 Oct 2022 02:00:52 GMT Message-Id: <202210070200.29720qkJ050770@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 38fe63afdc9d - stable/13 - vmstat: remove processor counting from getcpuinfo() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 38fe63afdc9d4473629881c805d82c5034934c0d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665108053; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ob6iDUphhjAvRCMUlRFr97ibqhCSfK6fOdlt2yVCn6U=; b=OdAFIjgCTWIR3FC1fbpfxQ00mvES6GHj7bRNfhc3ugdGWBNKW7uU0q1Du7Jb6VKGJU0rKN /5XqZymyjfag08EkTTPjOHW8V22FIb1wvfx85XXwXPLPWYDhH8KXrbAXf49Xq0WFLfSzXd m7SzFU31yHAsDBcyUgjeiKwFYM1yk/455pw7TTEWAUrtcMorlhsKT7NGhDNwIf8nhDo5TC LOqO5F4LdVGMDkJAu0C9wDS0TlfznH5byJdQ1bM7k+DyfgNzcKuJJ1HOWML6WR+Es7GGK1 xzvXc0H8JsqOBS3UExYBTQAgxVhnnh3PTcrmzmuiaFt43haTR06Q/Kow14FGIg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665108053; a=rsa-sha256; cv=none; b=SMmwiiSM7YI+ZpvVpAvEniGxmkKYznZ2JwzxWajsmrivLGJWr4fu9bKsOHNapw/bJBrV47 MOuH7yzuvZ695lYmIPizd17EPf/HZ48Ne0V66NjGlX0fZaoXDMVQo0Btdbty2BHk3pm0vn ZTky0rkIjMyzWuEy1z0vGnoQcucDh/xP9m9oxWEyCp9MmV9jOzFu5k5dUo8IRWri5/Vn6g /4JnX3CWCKEa7Y0cozbHgMRODmmo7wlzze8vQvADKKXDtQfc/PHBBVA8YFoabXb88TFMAY 1+rgHwRUUIguAaIom5/VbV/uOtN5GlNtMfdL9s5M/XkVyo5hcsGl7NcuRNKjCA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=38fe63afdc9d4473629881c805d82c5034934c0d commit 38fe63afdc9d4473629881c805d82c5034934c0d Author: Elliott Mitchell AuthorDate: 2022-09-29 16:27:24 +0000 Commit: Konstantin Belousov CommitDate: 2022-10-07 02:00:23 +0000 vmstat: remove processor counting from getcpuinfo() (cherry picked from commit 42dc8696df5e3004ea65fd315aba500d269dbcbf) --- usr.bin/vmstat/vmstat.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index 403dc6e2a054..5e04dc26ac6c 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -604,18 +604,17 @@ fill_vmtotal(struct vmtotal *vmtp) } /* Determine how many cpu columns, and what index they are in kern.cp_times */ -static int +static void getcpuinfo(u_long *maskp, int *maxidp) { long *times; u_long mask; size_t size; - int empty, i, j, maxcpu, maxid, ncpus; + int empty, i, j, maxcpu, maxid; if (kd != NULL) xo_errx(1, "not implemented"); mask = 0; - ncpus = 0; size = sizeof(maxcpu); mysysctl("kern.smp.maxcpus", &maxcpu, &size); if (size != sizeof(maxcpu)) @@ -632,16 +631,13 @@ getcpuinfo(u_long *maskp, int *maxidp) if (times[i * CPUSTATES + j] != 0) empty = 0; } - if (!empty) { + if (!empty) mask |= (1ul << i); - ncpus++; - } } if (maskp) *maskp = mask; if (maxidp) *maxidp = maxid; - return (ncpus); } @@ -670,12 +666,11 @@ dovmstat(unsigned int interval, int reps) u_long cpumask; size_t size; time_t uptime, halfuptime; - int ncpus, maxid, rate_adj, retval; + int maxid, rate_adj, retval; uptime = getuptime() / 1000000000LL; halfuptime = uptime / 2; rate_adj = 1; - ncpus = 1; maxid = 0; cpumask = 0; @@ -714,7 +709,7 @@ dovmstat(unsigned int interval, int reps) } if (Pflag) { - ncpus = getcpuinfo(&cpumask, &maxid); + getcpuinfo(&cpumask, &maxid); size_cp_times = sizeof(long) * (maxid + 1) * CPUSTATES; cur_cp_times = calloc(1, size_cp_times); last_cp_times = calloc(1, size_cp_times);