Commit Graph

113 Commits

Author SHA1 Message Date
Brian Feldman
22ab6be3d4 Make vmstat -m work with -M/-N again. Note that making vmstat -z work
is much harder, and -m is grossly using unexported interfaces (that is,
the array of malloc zones/sizes does not have an exported type).
2004-06-30 01:34:26 +00:00
Ruslan Ermilov
79e447559c Bumped the document date. 2004-05-19 09:54:14 +00:00
Tim J. Robbins
6d4ba9cd4e Print fork statistics with %u as they are unsigned quantities.
PR:		65889
Submitted by:	Ken Stailey
2004-04-23 13:10:29 +00:00
Ruslan Ermilov
ab82970ed2 Properly document the -M and -N options. 2004-03-26 11:01:45 +00:00
Bruce Evans
c044589554 Fixed a misspelling of 0 as NULL.
Fixed a nearby bug.  The "play it safe" code in dosysctl() was unsafe
because it overran the buffer by 1 if sysctl() filled all of the buffer.

Fixed a nearby style bug in output.  Not just 1, but 2 extra newlines
were printed at the end by "vmstat -m" and "vmstat -z".  Don't print
any newlines explicitly.  This depends on 2 of the many formatting
bugs in the corresponding sysctls.  First, the sysctls return an extra
newline at the end of the strings.  This also messes up output from
sysctl(8).  Second, the sysctls return an extra newline at the beginning
of the strings.  This is good for separating the 2 tables output by
"vmstat -mz" and for starting the header on a new line in plain sysctl
output, but gives a bogus extra newline at the beginning for "vm -[m | z]"
and "sysctl -n [kern.malloc | vm.zone]".

Fixed some nearby style bugs in the source code:
- the same line that misspelled 0 as NULL also spelled NULL as 0.
- the size was doubled twice in the realloc loop.
- the "play it safe" comment was misleading.  Terminating the buffer
  is bogus because dosysctl() is only meant to work with sysctls that
  return strings and the terminator is part of a string.  However, the
  kern.malloc sysctl has more than style bugs.  It also doesn't return
  a string.  Termination is needed to work around this bug.
2004-03-11 11:30:57 +00:00
Ruslan Ermilov
80c49332e2 Put libdevstat before libkvm, because the former depends on the latter. 2004-02-04 10:20:43 +00:00
David Malone
67206e04f9 Remove an unused variable.
Add some missing constness.
2003-12-25 01:32:55 +00:00
Bruce Evans
06849fd97a Fixed misplacement of __FBSDID(). Backed out editing of vendor id lines.
Just wrap them in #if 0...#endif.
2003-12-11 10:58:29 +00:00
Dag-Erling Smørgrav
56f9b09632 Revert part of revision 1.74 after bde reminded me of a detail I'd
forgotten about how sysctl works.  This removes a potential (though
not very likely) race that 1.74 introduced.
2003-12-11 07:46:08 +00:00
Dag-Erling Smørgrav
1b62c2410d Whitespace cleanup. 2003-12-10 22:19:19 +00:00
Dag-Erling Smørgrav
dc4ed4fe11 Remove debugging printf 2003-12-10 22:14:32 +00:00
Dag-Erling Smørgrav
eb23b4e6cd Document the simpler -a semantics. 2003-12-10 22:12:06 +00:00
Dag-Erling Smørgrav
7d268144f1 Fix a couple of issues in the interrupt code:
- Replace overly-complicated (and buggy) -a logic with a much simpler
   version: -a causes all interrupts to be displayed, otherwise only
   those that have occurred are displayed.  This removes the need for
   any MD code.

 - Instead of just making sure intrcnt is large enough, figure out the
   exact size it needs to be.  We derive nintr from this number, and we
   don't want to risk printing garbage.  Note that on sparc64, we end up
   printing garbage anyway because the names of non-existent interrupts
   are left uninitialized by the kernel.

Tested on:	alpha, i386, sparc64
2003-12-10 22:11:51 +00:00
Dag-Erling Smørgrav
3c455bcacc s/u_(int|long)\>/unsigned \1/ 2003-12-10 21:43:10 +00:00
David Malone
e38926c160 Fix a couple of warnings (const a function parameter and change some
ints to size_ts to better match the types of variables they are used
with).

Glanced at by:	des
2003-12-10 19:24:11 +00:00
Marcel Moolenaar
7e00080caa Unbreak vmstat -i on ia64:
o  nintr and inamlen must by of type size_t, not int,
o  Remove now unnecessary casts,
o  Handle the aflag differently, because the intr. names have a
   fixed width and almost always have trailing spaces.
2003-12-08 07:57:57 +00:00
Dag-Erling Smørgrav
c51633823d Finish the transition from libkvm to sysctl that I started a while ago.
The use of libkvm for post-mortem analysis is still supported (though it
could use more testing).  We can now remove vmstat's setgid bit.

While I'm here, hack the interrupt listing code to not display interrupts
that haven't occurred unless the -a option was given on the command line,
and document this change.
2003-12-07 17:46:14 +00:00
John-Mark Gurney
25d136776e make minimum column size for interrupt name be the heading (depends upon
Total being shorter than interrupt)..

Pointed out by:	bde
2003-11-09 20:39:56 +00:00
John-Mark Gurney
2eb7cf1a2b fix an overflow bug when scanning for length of names that I introduced in
the last commit...

include some minor style changes and fixes that bde sent me

Submitted by:	bde
2003-11-08 07:24:03 +00:00
John-Mark Gurney
a86e06a60c take mux's fix to the next level, scan the names and make the field larger
as necessary... on sparcs where:
atapci0 vec1996
is a bit too long
2003-10-28 05:02:03 +00:00
Tim J. Robbins
bd67e96dbc Uncomment the description of the -f option. Add rfork() to the list of
system calls it displays stats about.

PR:		50924
2003-04-14 07:22:25 +00:00
Tim J. Robbins
3c93cfb510 Reimplement the vmstat -f option (display fork statistics).
PR:		50924
Submitted by:	Ken Stailey (with a few changes)
2003-04-14 07:21:03 +00:00
Maxime Henrion
74d66b34d7 Slightly rework formatting in vmstat -i so that it doesn't
break with "fooX irqY" lines that are a bit bigger.
2003-04-10 00:44:18 +00:00
Poul-Henning Kamp
7194d335cf Run a revision of the devstat interface:
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
2003-03-15 21:59:06 +00:00
Poul-Henning Kamp
571d13be84 Update to use current rev of devstat API. 2003-03-15 21:25:44 +00:00
Poul-Henning Kamp
190ff54ebb Add #include <sys/resource.h>
My apologies for missing these #includes, I must have confused the
dependencies with a wrong timestamp or something.
2003-02-16 16:01:52 +00:00
Poul-Henning Kamp
f341ca9891 Remove #include <sys/dkstat.h> 2003-02-16 14:13:23 +00:00
Matthew Dillon
f7550ecf3f Make 'sysctl vm.vmtotal' work properly using updated patch from Hiten.
(the patch in the PR was stale).

PR:             kern/5689
Submitted by:   Hiten Pandya <hiten@unixdaemons.com>
2003-01-11 07:29:47 +00:00
Thomas Moestl
95ba428ccb The boottime variable in sys/kern/kern_tc.c is a struct timeval, not a
time_t, so do not use the latter as type when retrieving the variable
via libkvm. This should fix vmstat on sparc64.
2002-08-09 15:47:43 +00:00
Philippe Charnier
084e19802d The .Nm utility 2002-07-14 15:12:00 +00:00
Josef Karthauser
1063e12617 Replace /kernel with /boot/kernel/kernel.
PR:		docs/37757
Submitted by:	Hiten Pandya <hiten@uk.FreeBSD.org>
2002-05-09 11:47:42 +00:00
Jeff Roberson
6f2671750e Remove malloc_type's ks_limit.
Updated the kmemzones logic such that the ks_size bitmap can be used as an
index into it to report the size of the zone used.

Create the kern.malloc sysctl which replaces the kvm mechanism to report
similar data.  This will provide an easy place for statistics aggregation if
malloc_type statistics become per cpu data.

Add some code ifdef'd under MALLOC_PROFILING to facilitate a tool for sizing
the malloc buckets.
2002-04-15 04:05:53 +00:00
Jeroen Ruigrok van der Werven
e2cf520799 Fix a missed conversion of lld to llu for the uint64_t ks_calls and cast
to unsigned long long.

Don't be too overzealous with the printing of ks_calls in the total
statistics, cut back from 20 to 13 positions to print (which should last
a couple of years easily (20 digits is enough for 3168 years of calls at a
measly billion (10^9) calls per second.)).

Submitted by:	bde
2002-04-13 10:32:36 +00:00
Jeroen Ruigrok van der Werven
9e74ac9de4 Cast totreq to unsigned long long, as needed on 64-bit machines.
Pointed out by:	jeff
2002-04-08 21:06:14 +00:00
Jeroen Ruigrok van der Werven
9333bd2aa6 Change totreq to uint64_t from a long (the PR has an int64_t, which didn't
make sense to me) and change the printf argument from %8ld to %20llu to
accompany the printing of the totals.
Realigned the header printed above it as well.

PR:		32342
Submitted by:	ryan beasley <ryanb@goddamnbastard.org>
Reviewed by:	jeff, Tim J Robbins
2002-04-08 10:39:12 +00:00
Warner Losh
3f330d7d1a remove __P 2002-03-22 01:42:45 +00:00
Jeff Roberson
2294143a5d Remove the kmembuckets stats in preparation for the UMA commit. 2002-03-19 08:45:55 +00:00
Mark Murray
e35f9517d6 Remove NO_WERRORs and WARNS=n's. To be revisited after GCC3. 2002-02-08 23:07:37 +00:00
Mark Murray
d6bf632706 WARNS=2 fixes, but set NO_WERROR, as there are some HardToFix(tm)
warnings originating in system headers.
2001-12-11 22:59:36 +00:00
Ruslan Ermilov
3b7e5ccc6a SECURITY: Drop `setgid kmem' bit as early as possible. 2001-08-31 16:26:37 +00:00
Kenneth D. Merry
9674f1d43a Change the compute_stats() call to the new devstat_compute_statistics()
interface.

Cast the return of the rest of the printfs in here to void.

Submitted by:	"Sergey A. Osokin" <osa@freebsd.org.ru>
2001-08-11 19:41:56 +00:00
Thomas Moestl
1e543a5075 Correct the old length argument passed to sysctl to be a pointer to a
size_t (not to an int).

MFC after:	2 days
2001-07-29 21:56:14 +00:00
Dima Dorfman
f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
Ruslan Ermilov
625003720a mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 14:16:33 +00:00
Jens Schweikhardt
9aa042f66c Increase column widths when using -i (they are now wide enough to
hold a 64bit or 32bit ~0 value, i.e. 20 and 10; this anticipates
soon-to-be machines with Exahertz rtc interrupt frequencies. :-)

PR:		bin/16206
Submitted by:	John Capo <jc@irbs.com>
MFC after:	1 week
2001-06-26 18:49:10 +00:00
Jens Schweikhardt
f40be3e157 Reduce field width for some columns so that the default output fits in <= 79
columns. 80 columns + newline is a problem for some terminals including syscons.

Requested by:	bde
MFC after:	1 week
2001-06-23 17:52:10 +00:00
Jens Schweikhardt
ca513e5e52 Made all fields in default output be space separated. Run-together
columns confuse the heck out of other apps trying to parse vmstat output
(eg sscope). I made sure we're still <= 80 cols per line.
Fixed warnings about unused vars and printf %format mismatches.

Requested by:	Eugene Aleynikov <eugenea@infospace.com>
Reviewed by:	joerg (implicitly)
MFC after:	2 weeks
2001-06-19 17:59:40 +00:00
Jens Schweikhardt
67d9fd5ac4 Avoid the avm field joining the w field when avm is > 9.999.999 pages
which is slightly less than 4GB. To use a quote from someone who shall
remain nameless "No one will ever need more than 4 GB" :-) But FreeBSD
is prepared if we one day will.

Requested by:	Eugene Aleynikov <eugenea@infospace.com>
2001-06-13 18:43:28 +00:00
Jens Schweikhardt
b1494cf05a Increase field width by one for 'fre' to accomodate today's memory sizes.
PR:		25267
Submitted by:	Eugene Aleynikov <eugene@infospace.com>
Reviewed by:	joerg
MFC after:	2 weeks
2001-06-12 19:47:40 +00:00
Ruslan Ermilov
3ab9a9d0e0 Removed -I${.CURDIR}/.../sys from CFLAGS. 2001-05-18 13:41:42 +00:00