summaryrefslogtreecommitdiffstats
path: root/usr.bin/systat/vmstat.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix the format specifier suitable for uintmax_t.ru2006-11-231-3/+3
|
* - Fix types of "struct vmmeter" members so they are unsigned.ru2006-11-201-19/+86
| | | | | | | - Fix overflow bugs in sysctl(8), systat(1), and vmstat(8) when printing values of "struct vmmeter" in kilobytes as they don't necessarily fit into 32 bits. (Fix sysctl(8) reporting of a total virtual memory; it's in pages too.)
* For the vmstat sub-display:bde2006-05-011-24/+24
| | | | | | | | | | | | | | | | | | vmstat.c: Move totfr to be under daefr and prcfr since it logically belongs there. Move all the count fields (wire, act, inact, cache and free) to near the bottom of the sub-display (after all the rate fields) to reduce competition with adjoining sub-displays. systat.1: Move things as above. Attempt to improve missing and poor wording in the description of the fields. The long sentence was hard to parse and didn't say anything about the different units. Increment .Dd.
* Unbreak the support for 24-row terminals in the vmstat display. Thebde2006-05-011-2/+4
| | | | | | | | | | | | | part that handled the 17th and 18th rows of the vmstat-proper subdisplay was deleted in rev.1.10 when these rows stopped being used and was not restored when the 17th row was used again. For such terminals, we now lose the `buf' field instead of making a mess with it. Terminals with fewer than 24 rows have never been supported. The problem is not avoided by using curses since we use the last line for data entry and don't use a separate subwindow for this line. Some other things in the vmstat display could be handled better using subwindows.
* Sort the ex-extended vmstat fields into their documented order in thebde2006-04-301-38/+38
| | | | | | | | | | | | | | | | output too. Fine tune all coordinates and most field widths in the vmstat (sub)display for this and previous changes now that we have to change almost all of them just to move the ex-extended fields: - change VMSTATROW back to 7. It was 6 due to a hack in the extended vm stats changes. - reduce the maximum field width that we try for from 9 to 8. 4 or 5 is enough for most fields but we try to use the same width for all fields. 8 is enough to display everything without changing units memory sizes exceed 100GB. Fix some unrelated coordinates and field widths in comments.
* Eliminate the "extended" vm stats. Move all fields in the extendedbde2006-04-301-34/+10
| | | | | | vm stats to the normal vm stats. Sort them into the normal stats according to the man page only in the source code so that diffs are almost readable. Reduce style bugs in printing the value of %ozfod.
* Reduce the namei (sub)display by 5 columns to make enough space for abde2006-04-301-17/+19
| | | | | | | | | | | | | | new vnstat display to the right of the namei display. Move the non-vmstat fields {des,num,fre}vn from the vmstat display to a new vnstat display. Move the dtbuf field there too. The buf and dtbuf fields are non-vmstat and non-vnstat, so there is no good place to display them. I need to move at least 1 of them out of the vm stats for further cleanups of the vm stats, and there is only space for 1 of them in the vn stats. (The best place for the current buf field is actually /dev/null, since it has been completely broken for about 10 years and broken for longer. It gives an uninteresting virtual memory count where an interesting real memory count is wanted.)
* Don't redraw the disk names on every update. This was apparently donebde2006-04-301-6/+0
| | | | | | | | | | | to handle changes to the set of disks selected, but it is unnecessary for that since the whole screen is redrawn when this set is changed. It was also buggy: - MAXDRIVES*6 = 42 was hard-coded as only 30 spaces in a string literal, the last 2 disk names were not cleared as intended - when the extended vmstats are active, clearing of even 30 columns overruns the ozfod value field by 3 columns. This was harmless because the field is much wider than necessary.
* Fix "slow (on-the-fly) zero fills percentage (`%slo-z')" some more. Thebde2006-04-301-3/+3
| | | | | | | | | | | | | | | | | | | value printed is actually the optimized (i.e., the non-slow, not-on-the-fly zero fills percentage) except in overflow cases. Describe it as %ozfod in the display. Move the field descriptor 1 to the left so that there is space for 5 characters after the % sign (this leaves no space between the number and the descriptor but the % character serves well as a separator). Fixed integer overflow at z.ozfod = UINT_MAX/100 in the calculation of %ozfod. This value can be reached just a few hours or minutes after booting, so %ozfod was usually garbage in boot mode. Now %ozfod is correct in boot mode for a few days or hours. Print a non-dummy %ozfod when the division for it isn't division by 0 instead of when the result will be less than 100%. A result of 100% may be correct, though a result of more than 100% indicates overflow of one or both counters.
* If DEBUG is defined, then fill numeric fields with asterisks instead ofbde2006-04-301-0/+15
| | | | spaces and numbers for temporary(?) debugging.
* Edit the interrupt name strings to shorten them. This is believed tobde2006-04-301-2/+33
| | | | | | | | | | | | | | | | | | | only affect amd64 and i386. alpha uses "intr N" instead of "irqN" and mostly has no device names. ia64 uses only device names. - Edit interrupt names once after they are read from the kernel and not every time they are displayed. - Discard bogus trailing spaces so that the next step doesn't move things to oblivion. - If an interrupt name starts with "irqN:" (as it usually does in on amd64 and i386), then move "irqN" to the end and strip ":", since we have no space for the ":" and don't want to start descriptions with "N" after stripping "irq" in the next step (since "N" would look like a count). This step may need reworking for interrupt names containing several device names -- then moving the irq number to the end would lose it instead of losing some device names. - Remove "irq" from an interrupt name if and only if the original name is too long to display.
* Backed out rev.1.49 since it had buffer overruns and only workedbde2006-04-301-10/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | accidentally. Read buffer overruns: The size of the target array (TSOTTA == 10) is a wrong limit to use for scanning the source string. Write buffer overruns: TSOTTA is also a wrong limit to use for copying to the target buffer, since we want to add a NUL terminator afterwards. TSOTTA was also 1 too small for holding both the desired number of visible characters and the NUL. Worked accidentally: There is error in the algorithm that tends to result in the space saved by stripping "irq" not actually being used, but some cases worked accidentally provided "irqN" is near the end of the source string and "N" is only 1 digit. Starting with 5.mumble-CURRENT, "irqN" is at the beginning of the string on all (?) arches that have it and the accidents don't happen. E.g. on i386's, the keyboard irq is now named "irq1: atkbd0<bogus blank padding>" by the kernel, and this name was converted to "1: atkb" -- not only the device number but part of the device name has been lost --, while before 5.mumble the kernel name was "atkbd0 irq1" and systat accidentally preserved the irq number to give "atkbd0 1". The ":" in the string wastes precious space, and stripping "irq" results in descriptions starting with numbers which makes them look too much like counts. This commit just fixes the last problem.
* Abbreviate long field descriptors at write time so that they don't getbde2006-04-291-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | clobbered at runtime: dirtybuf -> dtbuf desiredvnodes -> desvn numvnodes -> numvn freevnodes -> frevn The vmstats column has only 5 characters available for descriptors, but up to 13 were used. The extras get clobbered at runtime by interrupt values and/or descriptors on systems with more than 12 interrupt sources. %slo-z -> %sloz This one is in the "extended" vmstats area and doesn't get clobbered now. Removed stale documentation of desvn. Changed a descriptor: tfree -> totfr so that it is consistent with the abbreviations for other free counts (daefr and prcfr) and thus almost decodeable. Fixed missing documentation of tfree/totfr. This and everything else in the extended vmstats area is misdocumented as being in a certain place in the vmstats column.
* fix spelling of ozfod... I've been wondering why we'd need to fill a pagejmg2006-03-181-1/+1
| | | | | | | w/ non-zero data, and it turns out we don't... This is really optimized zero filled on demand, or pages that were already zero'd for us... MFC after: 3 days
* Move the "r p d s w" fields to the left to create space for expansion.bde2006-02-141-25/+26
| | | | | | | | | | | | | | | | | | | | | | 3 columns were wasted at the left, except these columns were used to make the header line up. Now there is no space on the same line for the "Proc:" part of the header. Try putting this on the line above although it clutters that line (there is already similar clutter for the "Interrupts" header). Leave 1 column between these fields. With the above and a previous change there is enough of space for this. Use 5 columns instead of 3 for the number of users since 3 is not quite enough and there was space to spare. This also fixes an off-by-2 error in a previous fix forthe column count in the comment on STATROW. Move all the pager fields 1 to the right so that the "count" and "pages" descriptors more clearly apply to the pager fields and not the memory fields. There was space to space. Waste some of the spare space at the right of the pager fields to expand all the pager field widths to their old values (but now with a column between the fields). There are fields more in need of expansion but most of them are not in places near spare space.
* Removed the frobbing of CPU percentages from > 99.9 to 99.9. Rev.1.35bde2006-02-141-2/+0
| | | | | | | | | | | | made it unnecessary. (Rev.1.6 had to reduce the field width to 4, and changed 100.0 and preposterous larger values down to 99.9 since 100.0 wouldn't have fitted. Rev.1.35 handles precentages > 99.9 well enough by changing the format to %.0f when the string given by the initial format is too wide.) Even with this change, during short testing I've never seen a percentage of 100 being displayed by systat -v, although top(1) displays percentages of 100 user or 100 idle for similar loads.
* Fix some minor bugs:bde2006-02-141-13/+21
| | | | | | | | | | | | | | | Always use snprintf()'s return value, since discarding it is a style bug at best and using it here gives slightly simpler code and better error checking. Use snprintf() in putlongdouble() the same as in putfloat(). (1.25 changed most sprintf()'s to snprintf()'s to fix non-bugs without changing the logic to use the result of snprintf(); 1.27 restored one of the sprintf()s by cloning a stale version of putfloat().) Don't print a too-long field in the unlikely case that the fallback to M units in putint() leaves the field still too long. (The fallback to printing stars was lost in rev.1.58 when the fallback to M units was added.)
* Reduce the field width by 1 for many numeric fields so that most fieldsbde2006-02-141-39/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | cannot run into other fields or field descriptors. If the value is too large to fit in the field width, then the output format is adjusted so that the value (usually) fits, but with fields running together externally this adjustment usually didn't help. Mostly it doesn't matter to lose 1 digit of precision, but switching the output format is bad if it happens often or gives bogus units. The loss of width is most serious for fields near "Csw" (which are also the ones which must often ran together) since these have a high variance and large values relative to the possible field widths so the switch occurs more often now, and for the memory size fields where the switch gives the bogus units kKB or MKB. Now only the fields for r, p, d, s and w can run into each other. These fields have width 3, and 3 cannot be reduced to 2 without losing all precision when the value is between 100 and 999. Trim "pdwake" to "pdwak" at think time now that it doesn't get clobbered at runtime. The manpage doesn't need to be changed for this because it documents the clobbered descriptor, unlike for 4 other too-long descriptors which only get clobbered if there are lots of interrupt sources. Trim "% busy" to "%busy" since most other descriptors for percentages are spelled without the space and this change makes changing the widths of the %busy fields unnecessary.
* Oops, the "excessive" {} removed in the previous commit was neededbde2006-02-141-1/+3
| | | | | | around PUTRATE() because PUTRATE() only looked like a function -- it was multiple statements. Use "do {...} while(0)" as usual in PUTRATE() so that it is a single statement that can be used like a function.
* Fixed all (?) bitrot in the comments about the number of columns used bybde2006-02-141-8/+8
| | | | various groups of fields.
* Fix all (?) cases where the field width of a numeric field was far toobde2006-02-141-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | large. In most cases it is still 1 too large, so fields tend to run together, but in the following cases it was more than 1 too large, and the starting column was too small too, so the field started inside the previous field or descriptor and clobbered that: - "wire": the number for this overwrote 2 characters of the number for "Flt". Reduce the field width by 3 (2 to avoid the overwrite and 1 so that the fields don't run together). This was already done for the preceding number for "cow". - "inact": the number for this overwrote 1 character of the descriptor "Idle". Reducing the field width by 2 is enough. - "cache:" the number for this overwrote 3 characters of the scale "...| |". The field width should be reduced by 4 to keep things from running together, but that is a lot and not so necessary here since the final "|" in the scale serves as a delimiter. Only reduce it by 3. - "free": the number for this overwrote 2 characters of the bar graph. The character position under the final "|" in the scale is apparently not used, so reducing the field width by 3 is enough. When "zfod" is in the main vmstat display: - use the normal field width of 9 (not 5) for it since there is no shortage of space. Fix style bugs (excessive {}) in the statement that conditionally writes it. Write all reduced field widths for vmstat fields as "9 - <reduction>" as a hint that we don't want to reduce them.
* Fixed style bugs in rev.1.12. Rev.1.12 arranged to display the interruptbde2006-02-141-7/+7
| | | | | | | | | | | | number in more cases by stealing 2 characters from the count field to give more space in the descriptor field, but it did the column adjustments for this strangely using an off-by-2 error in the base column and compensating off-by-2 errors in 6 offsets from the base column (4 new errors and 2 from not changing the offsets that actually changed). Print the "Interrupts" header directly at its offset from the base column instead of spacing it half using the offset and half by printing a space character.
* Fix an overflow when calculating the number of kilobytes from theps2005-02-211-1/+1
| | | | | | number of pages. Obtained from: Yahoo!
* Use 'k' as suffix for Kilophk2003-10-241-1/+1
| | | | Pointed out by: several.
* When a numeric field overflows its width, try formatting the number inphk2003-10-201-5/+4
| | | | | 'kilo' or 'mega' with appropriate suffix instead of filling the field with stars.
* Let libdevstat calculate the device-busy % instead of home-rolling.phk2003-04-091-13/+5
|
* Run a revision of the devstat interface:phk2003-03-151-12/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Kernel: Change statistics to use the *uptime() timescale (ie: relative to boottime) rather than the UTC aligned timescale. This makes the device statistics code oblivious to clock steps. Change timestamps to bintime format, they are cheaper. Remove the "busy_count", and replace it with two counter fields: "start_count" and "end_count", which are updated in the down and up paths respectively. This removes the locking constraint on devstat. Add a timestamp argument to devstat_start_transaction(), this will normally be a timestamp set by the *_bio() function in bp->bio_t0. Use this field to calculate duration of I/O operations. Add two timestamp arguments to devstat_end_transaction(), one is the current time, a NULL pointer means "take timestamp yourself", the other is the timestamp of when this transaction started (see above). Change calculation of busy_time to operate on "the salami principle": Only when we are idle, which we can determine by the start+end counts being identical, do we update the "busy_from" field in the down path. In the up path we accumulate the timeslice in busy_time and update busy_from. Change the byte_* and num_* fields into two arrays: bytes[] and operations[]. Userland: Change the misleading "busy_time" name to be called "snap_time" and make the time long double since that is what most users need anyway, fill it using clock_gettime(CLOCK_MONOTONIC) to put it on the same timescale as the kernel fields. Change devstat_compute_etime() to operate on struct bintime. Remove the version 2 legacy interface: the change to bintime makes compatibility far too expensive. Fix a bug in systat's "vm" page where boot relative busy times would be bogus. Bump __FreeBSD_version to 500107 Review & Collaboration by: ken
* Add #include <sys/resource.h>phk2003-02-161-0/+1
|
* Remove #include <sys/dkstat.h>phk2003-02-161-1/+0
|
* Make 'sysctl vm.vmtotal' work properly using updated patch from Hiten.dillon2003-01-111-1/+1
| | | | | | | (the patch in the PR was stale). PR: kern/5689 Submitted by: Hiten Pandya <hiten@unixdaemons.com>
* debug.{numvnodes,freevnodes} moved to vfs.des2002-06-061-2/+2
|
* remove __Pimp2002-03-221-9/+9
|
* WARNS=2 fixes with NO_WERROR set, as there are some header issuesmarkm2001-12-121-102/+101
| | | | with namelists. use __FBSDID().
* Remove the 'irq' string from the irqN part of the "interrupts" display.markm2001-12-011-2/+10
| | | | This allows us to see the irq number when device names ate too long.
* Convert systat(1) to use the new devstat interface.ken2001-09-061-15/+14
| | | | Submitted by: "Sergey A. Osokin" <osa@freebsd.org.ru>
* Replace a use of the hw.nintr sysctl as it has just gone away, casttmm2001-06-011-3/+9
| | | | | size_t variables when passing them to a printf-like function, and some minor cleanups.
* numdirtybuffers is an int, not a long.gallatin2001-03-291-1/+1
|
* Get rid of setgid kmem for systat, and while being there, fix some bugstmm2001-03-231-116/+118
| | | | | | | | | | | and compiler warnings. The data for network statistics are still obtained via the kvm interface if systat was started with the needed privileges, otherwise sysctls are used. The reason for this is that with really many open sockets, the sysctl method is probably slower, but it systat -netstat is probably not really usable in either mode under these conditions. Approved by: rwatson
* Don't attempt to parse %cache2001-03-211-2/+7
|
* Correct int/long type mismatch in the proper place this time. freevnodesgallatin2000-12-021-2/+2
| | | | | | | | | | | and numvnodes are longs in the kernel. They should remain longs in systat, what really needs to change is that they should be using SYSCTL_LONG rather than SYSCTL_INT. I also changed wantfreevnodes to SYSCTL_LONG because I happened to notice it. I wish there was a way to find all of these automatically.. Pointed out by: bde
* fix int/long type mismatches found on alphagallatin2000-12-011-4/+4
|
* o Make systat/vmstat.c use sysctl() to retrieve cp_time, bufspace,rwatson2000-11-251-29/+50
| | | | | | | | | | maxvnodes, numvnodes, freevnodes, nchstats, and numdirtybuffers. o Make the hw.ncpu error checking code a little more rigorous by sanity checking the returned data size. o Didn't fix machine-dependent non-sysctl-exported variables: intrnames, eintrnames, intrcnt, eintrcnt, as these variables are defined and exported from machine-dependent kernel code in assembly. This should probably be fixed somehow.
* Don't include <sys/buf.h>phk2000-05-051-1/+0
|
* #include <errno.h> where needed. Kill extern int errno;.imp2000-04-141-1/+1
| | | | Minor warnings in tip corrected.
* "Disks" is more correct than "Disks" could be.green1999-09-191-1/+1
|
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Show dirty buffers and the percentage of time a disk was busy.des1999-07-301-10/+32
| | | | | PR: 12858 Submitted by: Arjan de Vet <Arjan.deVet@adv.iae.nl>
* Display floats with format %*.0f instead of as "*****" if there isbde1999-03-221-1/+5
| | | | | enough space for this but not enough space for the normal %*.*f format. Similarly for long doubles.
* Include discrete ozfod as well as ozfod/zfod percentage.dillon1999-02-081-7/+7
|
* If there are 4 or fewer disk devices, we have room to display additionaldillon1999-02-081-5/+38
| | | | | VM statistics. zfod is moved and %slo-z ( percentage of zero-fills that were slow, i.e. not pre-zero'd ), and number of pages freed per second.
OpenPOWER on IntegriCloud