From nobody Sun Aug 04 10:33:08 2024 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 4WcG9w2VGDz5SZ8V; Sun, 04 Aug 2024 10:33:08 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WcG9w1rRHz4FyP; Sun, 4 Aug 2024 10:33:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722767588; 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=hjDxMd+JS5Il0n2TVvJw0+rLUzv35E3UDfOTUjq+vE0=; b=A+Txx29p63C5T6rlMs6kk3oqugh2/w+0yclGC09e4rA0cNidQW4WysSnJ8TzvZi7Fh7K5f 26RStrDPaaiznf2kbIVJ2N8gJoHsp+Re10gdMgr3mdl2797NXg2txZV8ZvS0kUrywn73yl meIs/ricNBQNufwFkX++85g523R4gme1zhMsp+Pn75WVqX4OWWNHK7JRmvmP/TdyR8QdYp wMrVtiCsTvUVRH5cp0kVhulRXxOQoYX7sfsXKJg3eTMpVH7xvbCjzm4aWxbH8/b3HwLgHB BiMhwvM/rHOd9+Snc96bG1qD2hCEKSmdWAEtbIvEkdRo95PS2BIXkskzF+Ue2g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722767588; a=rsa-sha256; cv=none; b=SA2tVq4nRVBdp76xY6KH/Q8wyvJQixoZpVUFSKMSDClGKyqnyBcZEUse2F3WVxr+tQQ5e0 5Ac0Mu8RDTZlLNTAL8oYPuuZPMcriWfthSmPoWglPQG8ucuUNWyUc1uI7j4iYjRdILWj37 6IyKkSz6YG3lJ4KAtm0iBemx+yQU4xtiI6oPgp4RTm24XweWA/gEfGfbHuDxkL1uQtZIhE fqgwJycf6+9JrbCeXfGa8dtHTVyd/8JLMcX5IDxuUBGgYhp3rJ0RzBoT/7C4RwNU98W1OG 0Q6Yp7q6f+o7mJcttl5hMH0nfJ2UWfFEJmJzrNZpgvB0VDbJyzMsf8/vHZBVEg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722767588; 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=hjDxMd+JS5Il0n2TVvJw0+rLUzv35E3UDfOTUjq+vE0=; b=T9H5VLF9ZvnS6t7Kk2MS+cJ4OoLrJZnx3cUYcdZT8UNxha0fd/ddzHV3C4bHYeDw+nXP7l B+x9ppAdtyNEGZSA0O4xThXBDPyFbQak/ePxAEmFyt5JU1Jqtqa/b+3gp4hO5Jbv7cPkVl YNc6OCgA6U2ecsKKDt0DtdbPCMNRRolmBRAXeon4A8QjGtKJXZ7X9GSYLF+PQ+7Y5sw3Vp 0LEFqY+JGWVvz27I9xeCyN5ev57jFBA54nTA6+Kd7W37/G9emSZoQlY2Oo+I62+1NqcH30 0pyyJrASWcd8KKLq62CdyD4IOV2ASSimw8emdQjwRx4HK3m3hc/G6+SBPKZK2Q== 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 4WcG9w1RQ8zrfG; Sun, 4 Aug 2024 10:33:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 474AX85N062408; Sun, 4 Aug 2024 10:33:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 474AX8Rf062405; Sun, 4 Aug 2024 10:33:08 GMT (envelope-from git) Date: Sun, 4 Aug 2024 10:33:08 GMT Message-Id: <202408041033.474AX8Rf062405@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Zhilin Subject: git: d471b4f71dd3 - main - usr.sbin/gstat: add microsecond precision for disk latency 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mizhka X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d471b4f71dd3b09ada5bf58912dfb1266dd47750 Auto-Submitted: auto-generated The branch main has been updated by mizhka: URL: https://cgit.FreeBSD.org/src/commit/?id=d471b4f71dd3b09ada5bf58912dfb1266dd47750 commit d471b4f71dd3b09ada5bf58912dfb1266dd47750 Author: Michael Zhilin AuthorDate: 2024-08-04 08:31:06 +0000 Commit: Michael Zhilin CommitDate: 2024-08-04 08:31:06 +0000 usr.sbin/gstat: add microsecond precision for disk latency This patch makes gstat to show latency in microseconds if actual latency is less than 1ms. It affects only "ms/r" and "ms/w" columns. Before patch: L(q) ops/s r/s kBps ms/r w/s kBps ms/w %busy Name 0 922 0 0 0.0 922 35809 0.0 2.8| nda0 0 928 2 34 0.1 926 35809 0.0 3.1| nda1 After patch: L(q) ops/s r/s kBps ms/r w/s kBps ms/w %busy Name 0 496 1 31 0.156 495 16020 0.040 1.5| nda0 0 492 0 0 0.000 492 16020 0.042 1.5| nda1 Reviewed by: imp MFC after: 3 days Sponsored by: Postgres Professional Differential Revision: https://reviews.freebsd.org/D41999 --- usr.sbin/gstat/gstat.c | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/usr.sbin/gstat/gstat.c b/usr.sbin/gstat/gstat.c index b99b750eb253..887ae9dbee16 100644 --- a/usr.sbin/gstat/gstat.c +++ b/usr.sbin/gstat/gstat.c @@ -406,16 +406,20 @@ main(int argc, char **argv) PRINTMSG(",%.0f", (double)ld[2] * 1024); if (ld[3] > 1e3) PRINTMSG(",%.0f", (double)ld[3]); - else + else if (ld[3] > 1e0) PRINTMSG(",%.1f", (double)ld[3]); + else + PRINTMSG(",%.3f", (double)ld[3]); PRINTMSG(",%.0f", (double)ld[4]); if (flag_s) PRINTMSG(",%.0f", (double)ld[14]); PRINTMSG(",%.0f", (double)ld[5] * 1024); if (ld[6] > 1e3) PRINTMSG(",%.0f", (double)ld[6]); - else + else if (ld[6] > 1e0) PRINTMSG(",%.1f", (double)ld[6]); + else + PRINTMSG(",%.3f", (double)ld[6]); if (flag_d) { PRINTMSG(",%.0f", (double)ld[8]); @@ -426,9 +430,12 @@ main(int argc, char **argv) if (ld[10] > 1e3) PRINTMSG(",%.0f", (double)ld[10]); - else + else if (ld[10] > 1e0) PRINTMSG(",%.1f", (double)ld[10]); + else + PRINTMSG(",%.3f", + (double)ld[10]); } if (flag_o) { @@ -436,8 +443,11 @@ main(int argc, char **argv) if (ld[12] > 1e3) PRINTMSG(",%.0f", (double)ld[12]); + else if (ld[12] > 1e0) + PRINTMSG(",%.1f", + (double)ld[12]); else - PRINTMSG(",%.1f", + PRINTMSG(",%.3f", (double)ld[12]); } PRINTMSG(",%.1lf", (double)ld[7]); @@ -450,16 +460,20 @@ main(int argc, char **argv) PRINTMSG(" %6.0f", (double)ld[2] * 1024); if (ld[3] > 1e3) PRINTMSG(" %6.0f", (double)ld[3]); - else + else if (ld[3] > 1e0) PRINTMSG(" %6.1f", (double)ld[3]); + else + PRINTMSG(" %6.3f", (double)ld[3]); PRINTMSG(" %6.0f", (double)ld[4]); if (flag_s) PRINTMSG(" %6.0f", (double)ld[14]); PRINTMSG(" %6.0f", (double)ld[5] * 1024); if (ld[6] > 1e3) PRINTMSG(" %6.0f", (double)ld[6]); - else + else if (ld[6] > 1e0) PRINTMSG(" %6.1f", (double)ld[6]); + else + PRINTMSG(" %6.3f", (double)ld[6]); if (flag_d) { PRINTMSG(" %6.0f", (double)ld[8]); @@ -471,9 +485,12 @@ main(int argc, char **argv) if (ld[10] > 1e3) PRINTMSG(" %6.0f", (double)ld[10]); - else + else if (ld[10] > 1e0) PRINTMSG(" %6.1f", (double)ld[10]); + else + PRINTMSG(" %6.3f", + (double)ld[10]); } if (flag_o) { @@ -481,8 +498,11 @@ main(int argc, char **argv) if (ld[12] > 1e3) PRINTMSG(" %6.0f", (double)ld[12]); + else if (ld[12] > 1e0) + PRINTMSG(" %6.1f", + (double)ld[12]); else - PRINTMSG(" %6.1f", + PRINTMSG(" %6.3f", (double)ld[12]); }