git: b7f62c6042f8 - main - usr.bin/top: fix displaying load average for loads of at least 100

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Wed, 22 May 2024 14:47:56 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/src/commit/?id=b7f62c6042f8b4b322d9fa20a8c6a81a9a58c164

commit b7f62c6042f8b4b322d9fa20a8c6a81a9a58c164
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2024-05-21 10:28:35 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2024-05-22 14:47:46 +0000

    usr.bin/top: fix displaying load average for loads of at least 100
    
    After top registers load average of at least 100 which then gets reduced to
    below 100, there are left stray digits.
    Supporting load over 100 requires increasing the width only to 6, but since
    we support over 1000 CPU's now, let's increase it to 7.
    
    Reviewed by:    kib
    Differential Revision: https://reviews.freebsd.org/D45284
---
 usr.bin/top/display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.bin/top/display.c b/usr.bin/top/display.c
index 32b8b12798dc..b6cde0e63aa7 100644
--- a/usr.bin/top/display.c
+++ b/usr.bin/top/display.c
@@ -252,7 +252,7 @@ i_loadave(int mpid, double avenrun[])
 
     for (i = 0; i < 3; i++)
     {
-	printf("%c %5.2f",
+	printf("%c %7.2f",
 	    i == 0 ? ':' : ',',
 	    avenrun[i]);
     }
@@ -289,7 +289,7 @@ u_loadave(int mpid, double *avenrun)
     /* we should optimize this and only display changes */
     for (i = 0; i < 3; i++)
     {
-	printf("%s%5.2f",
+	printf("%s%7.2f",
 	    i == 0 ? "" : ", ",
 	    avenrun[i]);
     }