Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
Re: vmstat -m columns
To:
Ted Unangst <tedu@tedunangst.com>
Cc:
tech@openbsd.org
Date:
Tue, 20 May 2025 07:43:12 +0200

Download raw body.

Thread
On Mon, May 19, 2025 at 11:06:31PM -0400, Ted Unangst wrote:
> vmstat -m output for malloc buckets has become unreadable.

I agree. Also please do not test this on amd64 (that system is KVA
challanged and can not scale as much as e.g. fat sparc64 systems).
 
> Memory statistics by type                           Type  Kern
>           Type InUse MemUse HighUse  Limit Requests Limit Size(s)
>         devbuf  5076 17585K  18347K219874K     9164    0  16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288
>            pcb    17    13K     13K219874K       17    0  16,32,1024
>         rtable    58     2K      3K219874K      270    0  16,32,64,128,256
> 
> What do the words "Type  Kern" in the first header mean?

I think they belong to the value below. As in Type Limit and Kern Size
At least for limit it makes sense since there are two columns using Limit.

> The first column is ragged, making it hard to read. Text should be left
> aligned.
> The limit column has exploded.
> 
> I think this is an improvement. I kept one space on the left, so it's 
> easier to see when lines wrap.
> 
> Memory statistics by type
>  Type          InUse MemUse HighUse    Limit Requests Limit Size(s)
>  devbuf         5074 17557K  18347K  219874K     9210     0 16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144,524288
>  pcb              17    13K     13K  219874K       17     0 16,32,1024
>  rtable           58     2K      3K  219874K      273     0 16,32,64,128,256

I like this output a lot better.
 
> Index: vmstat.c
> ===================================================================
> RCS file: /home/cvs/src/usr.bin/vmstat/vmstat.c,v
> diff -u -p -r1.159 vmstat.c
> --- vmstat.c	10 Mar 2025 19:52:57 -0000	1.159
> +++ vmstat.c	20 May 2025 03:01:45 -0000
> @@ -854,14 +854,13 @@ domem(void)
>  		printf("\n");
>  	}
>  
> +	(void)printf("\nMemory statistics by type\n");
>  	(void)printf(
> -	   "\nMemory statistics by type                           Type  Kern\n");
> -	(void)printf(
> -"          Type InUse MemUse HighUse  Limit Requests Limit Size(s)\n");
> +" Type          InUse MemUse HighUse    Limit Requests Limit Size(s)\n");
>  	for (i = 0, ks = &kmemstats[0]; i < M_LAST; i++, ks++) {
>  		if (ks->ks_calls == 0)
>  			continue;
> -		(void)printf("%14s%6ld%6ldK%7ldK%6ldK%9ld%5u",
> +		(void)printf(" %-13s%6ld%6ldK%7ldK%8ldK%9ld%6u",
>  		    kmemnames[i] ? kmemnames[i] : "undefined",
>  		    ks->ks_inuse, (ks->ks_memuse + 1023) / 1024,
>  		    (ks->ks_maxused + 1023) / 1024,
> @@ -872,7 +871,7 @@ domem(void)
>  			if ((ks->ks_size & j) == 0)
>  				continue;
>  			if (first)
> -				printf("  %d", j);
> +				printf(" %d", j);
>  			else
>  				printf(",%d", j);
>  			first = 0;
> 

-- 
:wq Claudio