svn commit: r246033 - head/usr.bin/systat

Andrey Zonov zont at FreeBSD.org
Tue Jan 29 12:12:00 UTC 2013


On 1/28/13 6:51 PM, Bruce Evans wrote:
> On Mon, 28 Jan 2013, Andrey Zonov wrote:
> 
>> Log:
>>  - Show page faults requiring I/O on vmstat display.
> 
> No space is available there for showing it.
> 

Yep, you're right.

>> Modified: head/usr.bin/systat/vmstat.c
>> ==============================================================================
>>
>> --- head/usr.bin/systat/vmstat.c    Mon Jan 28 12:54:53 2013    (r246032)
>> +++ head/usr.bin/systat/vmstat.c    Mon Jan 28 12:57:42 2013    (r246033)
>> @@ -324,24 +325,25 @@ labelkre(void)
>>     mvprintw(INTSROW, INTSCOL + 1, "Interrupts");
>>     mvprintw(INTSROW + 1, INTSCOL + 6, "total");
>>
>> -    mvprintw(VMSTATROW, VMSTATCOL + 9, "cow");
>> -    mvprintw(VMSTATROW + 1, VMSTATCOL + 9, "zfod");
>> -    mvprintw(VMSTATROW + 2, VMSTATCOL + 9, "ozfod");
>> -    mvprintw(VMSTATROW + 3, VMSTATCOL + 9 - 1, "%%ozfod");
>> -    mvprintw(VMSTATROW + 4, VMSTATCOL + 9, "daefr");
>> -    mvprintw(VMSTATROW + 5, VMSTATCOL + 9, "prcfr");
>> -    mvprintw(VMSTATROW + 6, VMSTATCOL + 9, "totfr");
>> -    mvprintw(VMSTATROW + 7, VMSTATCOL + 9, "react");
>> -    mvprintw(VMSTATROW + 8, VMSTATCOL + 9, "pdwak");
>> -    mvprintw(VMSTATROW + 9, VMSTATCOL + 9, "pdpgs");
>> -    mvprintw(VMSTATROW + 10, VMSTATCOL + 9, "intrn");
>> -    mvprintw(VMSTATROW + 11, VMSTATCOL + 9, "wire");
>> -    mvprintw(VMSTATROW + 12, VMSTATCOL + 9, "act");
>> -    mvprintw(VMSTATROW + 13, VMSTATCOL + 9, "inact");
>> -    mvprintw(VMSTATROW + 14, VMSTATCOL + 9, "cache");
>> -    mvprintw(VMSTATROW + 15, VMSTATCOL + 9, "free");
>> -    if (LINES - 1 > VMSTATROW + 16)
>> -        mvprintw(VMSTATROW + 16, VMSTATCOL + 9, "buf");
> 
> This is the last possible line on a 25-line display.  On a 24-line
> display, it is omitted so that it doesn't mangle or get mangled by the
> prompt/status line.  But previous lines are not specially handled, and
> neither are other parts of the display.  Also, the interrupt display
> may reach the last line of the window, and then it interacts with the
> prompt/status line even on a 25-line display.
> 
> On a 23-line display, mangling occurs as follows:
> - the special case for the "buf" line has no visible effect, since
>   this line is outside of the window
> - the free "line" and the prompt/status line are both on the last line
>   in the window, together with the %busy display and possibly the
>   interrupts display.  These mangle each other,
> 
> On a 22-line display, the mangling moves up by 1 line and becomes worse.
> Now there seems to be a windowing bug.  Some field (the "free" one) is
> mispositioned, so the display becomes magled (instead of just truncated)
> even when the prompt/status line is not used.
> 
>> +    mvprintw(VMSTATROW, VMSTATCOL + 9, "ioflt");
> 
> Putting it first unsorts the fields a bit and makes the diff large.
> 
> It is not documented in the man page.
> 

Fixed in attached systat1.patch.txt.

>> +    mvprintw(VMSTATROW + 1, VMSTATCOL + 9, "cow");
>> +    mvprintw(VMSTATROW + 2, VMSTATCOL + 9, "zfod");
>> +    mvprintw(VMSTATROW + 3, VMSTATCOL + 9, "ozfod");
>> +    mvprintw(VMSTATROW + 4, VMSTATCOL + 9 - 1, "%%ozfod");
>> +    mvprintw(VMSTATROW + 5, VMSTATCOL + 9, "daefr");
>> +    mvprintw(VMSTATROW + 6, VMSTATCOL + 9, "prcfr");
>> +    mvprintw(VMSTATROW + 7, VMSTATCOL + 9, "totfr");
>> +    mvprintw(VMSTATROW + 8, VMSTATCOL + 9, "react");
>> +    mvprintw(VMSTATROW + 9, VMSTATCOL + 9, "pdwak");
>> +    mvprintw(VMSTATROW + 10, VMSTATCOL + 9, "pdpgs");
>> +    mvprintw(VMSTATROW + 11, VMSTATCOL + 9, "intrn");
>> +    mvprintw(VMSTATROW + 12, VMSTATCOL + 9, "wire");
>> +    mvprintw(VMSTATROW + 13, VMSTATCOL + 9, "act");
>> +    mvprintw(VMSTATROW + 14, VMSTATCOL + 9, "inact");
>> +    mvprintw(VMSTATROW + 15, VMSTATCOL + 9, "cache");
>> +    mvprintw(VMSTATROW + 16, VMSTATCOL + 9, "free");
>> +    if (LINES - 1 > VMSTATROW + 17)
>> +        mvprintw(VMSTATROW + 17, VMSTATCOL + 9, "buf");
> 
> Adding a field at the top pushes the "buf" field to the last line of
> the window in the most common case of a 25-line display, and makes its
> special case useless except for 26-line displays, so mangling from the
> "buf" line now occurs in the most common case.
> 
> It moves the problems for 22-24 line displays to 23-25 line displays,
> respectively.  Now it is the "free" field that needs the special handling
> to avoid mangling in the nextmost common case of 24-line displays.  Even
> more seriously, the "free" field is much more interesting than the "buf"
> field, so we don't want to lose it or have it mangled in a common case.
> The "buf" field really belongs in another group of fields (before "dtbuf")
> but is spaced where it is since there is no free space near "dtbuf" but
> just 1 line of free space (in the most common case) in the vmmeter fields
> column ("buf" also isn't a vmmeter field so it doesn't belong there).  But
> now there are 0 lines of free space there.
> 
> Since systat output barely works with screen depths other than 24 and
> 25 lines, omitting the "buf" field after moving its special case to the
> "free" field and moving some less important field than "free" to the
> end would be the simplest fix.
> 
> The "buf" field is worse than useless because it is just the constant
> limit on the amount of virtual memory for buffers (nbuf * BKVASIZE).
> It is not merely useless, since it wastes space and confuses users
> into thinking that it is useful.  top(1) prints it too.  In other OS's
> top(1) prints something related to buffer resources that is actually
> useful.  The related usful values in FreeBSD are the non-constant
> amount of physical memory mapped to buffers and to a lesser extent the
> non-constant amount of virtual memory mapped to buffers.  These are
> not directly available.  Also the amount of malloced memory pointed
> to by buffers (available in vfs.bufmallocspace), and the amount of
> disk space cached in VMIO buffers (not directly available, buf "inact"
> often approximates it).  But there is no space for these.
> 
> "buf" is even more useless with zfs.  So are some of the other fields
> printed by systat and top.  I think zfs has its own statistics programs,
> but it would be especially difficult to combine these with systat
> statistics see the combined resource usage if both zfs and file systems
> using the buffer cache/VMIO are active.
> 

I totally agree with you, 'buf' should go away from systat and top. I
removed 'buf' from systat.  Please review systat2.patch.txt.

To count 'disk cache' we have to add new counter which should track all
pages with OBJT_VNODE type.  It doesn't look hard to implement this.  I
wrote utility [1] which allows me to inspect memory and find what is in
disk cache.

I also found that %ozfod is not useful for me and I removed it to not
mangle 'free' on 24-line terminals (systat3.patch.txt).

Thanks for comments!

[1] https://github.com/z0nt/meminfo/

-- 
Andrey Zonov
-------------- next part --------------
commit 8b2daa5a9ffae685987ec7c7641d94f87d8da91e
Author: Andrey Zonov <zont at FreeBSD.org>
Date:   Tue Jan 29 15:21:54 2013 +0400

    - Document 'ioflt' in man page.
    
    Spotted by:	bde
    X-MFC-with:	r246033

diff --git a/usr.bin/systat/systat.1 b/usr.bin/systat/systat.1
index 849c890..d815e54 100644
--- a/usr.bin/systat/systat.1
+++ b/usr.bin/systat/systat.1
@@ -28,7 +28,7 @@
 .\"	@(#)systat.1	8.2 (Berkeley) 12/30/93
 .\" $FreeBSD: head/usr.bin/systat/systat.1 240605 2012-09-17 13:36:47Z melifaro $
 .\"
-.Dd September 17, 2012
+.Dd January 29, 2013
 .Dt SYSTAT 1
 .Os
 .Sh NAME
@@ -371,6 +371,7 @@ memory system.
 The first few lines describe,
 in units (except as noted below)
 of pages per second averaged over the sampling interval,
+page faults requiring I/O (`ioflt'),
 pages copied on write (`cow'),
 pages zero filled on demand (`zfod'),
 pages optimally zero filled on demand (`ozfod'),
-------------- next part --------------
commit dc19ccb997e57ddc8a31ad839f26db5f32590b7d
Author: Andrey Zonov <zont at FreeBSD.org>
Date:   Tue Jan 29 14:51:44 2013 +0400

    - Do not show bufspace, because it is useless and constant in fact.
    
    Suggested by:	bde
    X-MFC-with:	r246033

diff --git a/usr.bin/systat/systat.1 b/usr.bin/systat/systat.1
index 29b3276..07cf12a 100644
--- a/usr.bin/systat/systat.1
+++ b/usr.bin/systat/systat.1
@@ -396,15 +396,6 @@ free pages (`free').
 Note that the values displayed are the current transient ones;
 they are not averages.
 .Pp
-At the bottom of this column is a line showing the
-amount of virtual memory, in kilobytes, mapped into the buffer cache (`buf').
-This statistic is not useful.
-It exists only as a placeholder for the corresponding useful statistic
-(the amount of real memory used to cache disks).
-The most important component of the latter (the amount of real memory
-used by the vm system to cache disks) is not available,
-but can be guessed from the `inact' amount under some system loads.
-.Pp
 Running down the right hand side of the display is a breakdown
 of the interrupts being handled by the system.
 At the top of the list is the total interrupts per second
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
index 7a9d719..c7e3c7f 100644
--- a/usr.bin/systat/vmstat.c
+++ b/usr.bin/systat/vmstat.c
@@ -112,7 +112,6 @@ static struct Info {
 	struct	nchstats nchstats;
 	long	nchcount;
 	long	*intrcnt;
-	long	bufspace;
 	int	desiredvnodes;
 	long	numvnodes;
 	long	freevnodes;
@@ -342,8 +341,6 @@ labelkre(void)
 	mvprintw(VMSTATROW + 14, VMSTATCOL + 9, "inact");
 	mvprintw(VMSTATROW + 15, VMSTATCOL + 9, "cache");
 	mvprintw(VMSTATROW + 16, VMSTATCOL + 9, "free");
-	if (LINES - 1 > VMSTATROW + 17)
-		mvprintw(VMSTATROW + 17, VMSTATCOL + 9, "buf");
 
 	mvprintw(GENSTATROW, GENSTATCOL, " Csw  Trp  Sys  Int  Sof  Flt");
 
@@ -513,8 +510,6 @@ showkre(void)
 	putint(pgtokb(s.v_inactive_count), VMSTATROW + 14, VMSTATCOL, 8);
 	putint(pgtokb(s.v_cache_count), VMSTATROW + 15, VMSTATCOL, 8);
 	putint(pgtokb(s.v_free_count), VMSTATROW + 16, VMSTATCOL, 8);
-	if (LINES - 1 > VMSTATROW + 17)
-		putint(s.bufspace / 1024, VMSTATROW + 17, VMSTATCOL, 8);
 	PUTRATE(v_vnodein, PAGEROW + 2, PAGECOL + 6, 5);
 	PUTRATE(v_vnodeout, PAGEROW + 2, PAGECOL + 12, 5);
 	PUTRATE(v_swapin, PAGEROW + 2, PAGECOL + 19, 5);
@@ -779,7 +774,6 @@ getinfo(struct Info *ls)
 	GETSYSCTL("vm.stats.vm.v_active_count", ls->v_active_count);
 	GETSYSCTL("vm.stats.vm.v_inactive_count", ls->v_inactive_count);
 	GETSYSCTL("vm.stats.vm.v_cache_count", ls->v_cache_count);
-	GETSYSCTL("vfs.bufspace", ls->bufspace);
 	GETSYSCTL("kern.maxvnodes", ls->desiredvnodes);
 	GETSYSCTL("vfs.numvnodes", ls->numvnodes);
 	GETSYSCTL("vfs.freevnodes", ls->freevnodes);
-------------- next part --------------
commit 89bb37ad23d3d893e7efb6b8fc2eea9fdd08fa02
Author: Andrey Zonov <zont at FreeBSD.org>
Date:   Tue Jan 29 15:18:06 2013 +0400

    - Remove '%ozfod' on vmstat display to not mangle 'free' on 24-line terminal.

diff --git a/usr.bin/systat/systat.1 b/usr.bin/systat/systat.1
index 07cf12a..849c890 100644
--- a/usr.bin/systat/systat.1
+++ b/usr.bin/systat/systat.1
@@ -374,7 +374,6 @@ of pages per second averaged over the sampling interval,
 pages copied on write (`cow'),
 pages zero filled on demand (`zfod'),
 pages optimally zero filled on demand (`ozfod'),
-the ratio of the (average) ozfod / zfod as a percentage (`%ozfod'),
 pages freed by the page daemon (`daefr'),
 pages freed by exiting processes (`prcfr'),
 total pages freed (`totfr'),
@@ -384,7 +383,7 @@ times per second that the page daemon was awakened (`pdwak'),
 pages analyzed by the page daemon (`pdpgs'),
 and
 in-transit blocking page faults (`intrn').
-Note that the units are special for `%ozfod' and `pdwak'.
+Note that the units are special for `pdwak'.
 The next few lines describe,
 as amounts of memory in kilobytes,
 pages wired down (`wire'),
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
index c7e3c7f..f8e051d 100644
--- a/usr.bin/systat/vmstat.c
+++ b/usr.bin/systat/vmstat.c
@@ -328,19 +328,18 @@ labelkre(void)
 	mvprintw(VMSTATROW + 1, VMSTATCOL + 9, "cow");
 	mvprintw(VMSTATROW + 2, VMSTATCOL + 9, "zfod");
 	mvprintw(VMSTATROW + 3, VMSTATCOL + 9, "ozfod");
-	mvprintw(VMSTATROW + 4, VMSTATCOL + 9 - 1, "%%ozfod");
-	mvprintw(VMSTATROW + 5, VMSTATCOL + 9, "daefr");
-	mvprintw(VMSTATROW + 6, VMSTATCOL + 9, "prcfr");
-	mvprintw(VMSTATROW + 7, VMSTATCOL + 9, "totfr");
-	mvprintw(VMSTATROW + 8, VMSTATCOL + 9, "react");
-	mvprintw(VMSTATROW + 9, VMSTATCOL + 9, "pdwak");
-	mvprintw(VMSTATROW + 10, VMSTATCOL + 9, "pdpgs");
-	mvprintw(VMSTATROW + 11, VMSTATCOL + 9, "intrn");
-	mvprintw(VMSTATROW + 12, VMSTATCOL + 9, "wire");
-	mvprintw(VMSTATROW + 13, VMSTATCOL + 9, "act");
-	mvprintw(VMSTATROW + 14, VMSTATCOL + 9, "inact");
-	mvprintw(VMSTATROW + 15, VMSTATCOL + 9, "cache");
-	mvprintw(VMSTATROW + 16, VMSTATCOL + 9, "free");
+	mvprintw(VMSTATROW + 4, VMSTATCOL + 9, "daefr");
+	mvprintw(VMSTATROW + 5, VMSTATCOL + 9, "prcfr");
+	mvprintw(VMSTATROW + 6, VMSTATCOL + 9, "totfr");
+	mvprintw(VMSTATROW + 7, VMSTATCOL + 9, "react");
+	mvprintw(VMSTATROW + 8, VMSTATCOL + 9, "pdwak");
+	mvprintw(VMSTATROW + 9, VMSTATCOL + 9, "pdpgs");
+	mvprintw(VMSTATROW + 10, VMSTATCOL + 9, "intrn");
+	mvprintw(VMSTATROW + 11, VMSTATCOL + 9, "wire");
+	mvprintw(VMSTATROW + 12, VMSTATCOL + 9, "act");
+	mvprintw(VMSTATROW + 13, VMSTATCOL + 9, "inact");
+	mvprintw(VMSTATROW + 14, VMSTATCOL + 9, "cache");
+	mvprintw(VMSTATROW + 15, VMSTATCOL + 9, "free");
 
 	mvprintw(GENSTATROW, GENSTATCOL, " Csw  Trp  Sys  Int  Sof  Flt");
 
@@ -496,20 +495,18 @@ showkre(void)
 	PUTRATE(v_cow_faults, VMSTATROW + 1, VMSTATCOL + 2, 8 - 2);
 	PUTRATE(v_zfod, VMSTATROW + 2, VMSTATCOL + 2, 8 - 2);
 	PUTRATE(v_ozfod, VMSTATROW + 3, VMSTATCOL, 8);
-	putint(s.v_zfod != 0 ? (int)(s.v_ozfod * 100.0 / s.v_zfod) : 0,
-	    VMSTATROW + 4, VMSTATCOL + 1, 8 - 1);
-	PUTRATE(v_dfree, VMSTATROW + 5, VMSTATCOL + 2, 8 - 2);
-	PUTRATE(v_pfree, VMSTATROW + 6, VMSTATCOL + 2, 8 - 2);
-	PUTRATE(v_tfree, VMSTATROW + 7, VMSTATCOL, 8);
-	PUTRATE(v_reactivated, VMSTATROW + 8, VMSTATCOL, 8);
-	PUTRATE(v_pdwakeups, VMSTATROW + 9, VMSTATCOL, 8);
-	PUTRATE(v_pdpages, VMSTATROW + 10, VMSTATCOL, 8);
-	PUTRATE(v_intrans, VMSTATROW + 11, VMSTATCOL, 8);
-	putint(pgtokb(s.v_wire_count), VMSTATROW + 12, VMSTATCOL, 8);
-	putint(pgtokb(s.v_active_count), VMSTATROW + 13, VMSTATCOL, 8);
-	putint(pgtokb(s.v_inactive_count), VMSTATROW + 14, VMSTATCOL, 8);
-	putint(pgtokb(s.v_cache_count), VMSTATROW + 15, VMSTATCOL, 8);
-	putint(pgtokb(s.v_free_count), VMSTATROW + 16, VMSTATCOL, 8);
+	PUTRATE(v_dfree, VMSTATROW + 4, VMSTATCOL + 2, 8 - 2);
+	PUTRATE(v_pfree, VMSTATROW + 5, VMSTATCOL + 2, 8 - 2);
+	PUTRATE(v_tfree, VMSTATROW + 6, VMSTATCOL, 8);
+	PUTRATE(v_reactivated, VMSTATROW + 7, VMSTATCOL, 8);
+	PUTRATE(v_pdwakeups, VMSTATROW + 8, VMSTATCOL, 8);
+	PUTRATE(v_pdpages, VMSTATROW + 9, VMSTATCOL, 8);
+	PUTRATE(v_intrans, VMSTATROW + 10, VMSTATCOL, 8);
+	putint(pgtokb(s.v_wire_count), VMSTATROW + 11, VMSTATCOL, 8);
+	putint(pgtokb(s.v_active_count), VMSTATROW + 12, VMSTATCOL, 8);
+	putint(pgtokb(s.v_inactive_count), VMSTATROW + 13, VMSTATCOL, 8);
+	putint(pgtokb(s.v_cache_count), VMSTATROW + 14, VMSTATCOL, 8);
+	putint(pgtokb(s.v_free_count), VMSTATROW + 15, VMSTATCOL, 8);
 	PUTRATE(v_vnodein, PAGEROW + 2, PAGECOL + 6, 5);
 	PUTRATE(v_vnodeout, PAGEROW + 2, PAGECOL + 12, 5);
 	PUTRATE(v_swapin, PAGEROW + 2, PAGECOL + 19, 5);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 535 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20130129/a4389d6b/attachment.sig>


More information about the svn-src-all mailing list