From nobody Fri Sep 30 03:15:00 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 4MdwMT1q5xz4dlpW; Fri, 30 Sep 2022 03:15:01 +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 4MdwMT1Kx9z3n7g; Fri, 30 Sep 2022 03:15:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664507701; 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=qwZoWvmBnvfHqGgHaX0od8nI2tp4dgAsAG3z6dSwg8o=; b=gIPN06CCtmhSM2NRR/BUqMsPKjY9UzOzDgSqmyN3P4avaN/YGRYXui7qMwoaQnHYbthGe/ kuzvioJA48Hlp3xd/q8fZbIaFrhP0lOz1ltdn2bdnM34TU9iMop/MxaiXhEUt9vnPNlZ9i Y7hEKertMtWYfvdUvECUm+8fo/d8X/IkwrOrAVtMigji5dTCH3B5AVF87R0SUhnMON4fSl 76Vp27gk/xvu9y1feNJkRRIt5ao9mGJHzfQ6BaGoJUfte70O2gCfe/dZcBKMptMIYpM72f buGAryauxCZlV3za9cYATg0GzrYvPvj1tUdJEQd7fw8fZCUSf7b0oTMhOTDlSw== 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 4MdwMT0M0hz12k9; Fri, 30 Sep 2022 03:15:01 +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 28U3F0jD087907; Fri, 30 Sep 2022 03:15:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28U3F0IN087905; Fri, 30 Sep 2022 03:15:00 GMT (envelope-from git) Date: Fri, 30 Sep 2022 03:15:00 GMT Message-Id: <202209300315.28U3F0IN087905@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 42dc8696df5e - main - 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/main X-Git-Reftype: branch X-Git-Commit: 42dc8696df5e3004ea65fd315aba500d269dbcbf Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664507701; 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=qwZoWvmBnvfHqGgHaX0od8nI2tp4dgAsAG3z6dSwg8o=; b=fbkRaBjXOoE0ZxKm6mKTsS05u66fW7e7g5Dn4wkvFAvxjG+T1hYiNIfEwhYFXz/o1LMF+Z 6rD6KlAXFlS2UBlBQcL7cL+v+be4n9ZCgGy69TwQ2Lzq+Ab7UThRy3QHJ+dfs3LofxTp34 GEwVTfhwqPdSLlvyTi6juEGn98Sws3kfwwREuGOfYmA/MmQi5dCtweJdBCz3hn2XepxZKP Z7RpJopGsI+HXyxWR/9F5nGbvckxlIfRc56w8CEd4FBq94+6oOBcs9VsoCBuADdCJNyH87 zE8Jwl7wS0l85oxGP/NZ94YS99bVBV7iCT+f7y4Tw3vwtu9tuY3/3tO29pYyxQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664507701; a=rsa-sha256; cv=none; b=aa3fyYiin1NfWTp1NCVQzCMTSVg8X8Ic444GBRJ9naz80B13+poRJlPpCgA3Od411SrS8R 5x5DxMobCNZH1P20I07N9i9Qj9GXdHg/oUZVwKYEVMAdslcZjJGYz/vSAPPffIY5dV/IJe 5p7WaE6TYg02QyWgpp6S1bVaotgoFA7rM24RV+AGjEkhF57NmmhoSZnlO5d8fYIVD2R3eP gDG3tVYzVkKeeeSLhzjDTGEetQGGLRJNLDKOjShr133nJqtK2JAwdeCSKV2HY6Ysr7YZa6 0Fi/qqBFiyL3IypfzIUM6kgv/yVVEq9mj5cVL5ts1eiDC+Dex+VC+XZj0Rb5vg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=42dc8696df5e3004ea65fd315aba500d269dbcbf commit 42dc8696df5e3004ea65fd315aba500d269dbcbf Author: Elliott Mitchell AuthorDate: 2022-09-29 16:27:24 +0000 Commit: Konstantin Belousov CommitDate: 2022-09-30 03:10:27 +0000 vmstat: remove processor counting from getcpuinfo() As `ncpus` was otherwise unused, keeping track was pointless. Gets rid of a warning from an unused variable. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D36628 --- 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 ba1dc9eef883..674ae2ab6728 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);