Commit Graph

163 Commits

Author SHA1 Message Date
Mike Silbersack
ba2bc772d1 Make systat -net aware of compressed time_wait sockets. 2003-12-24 08:54:53 +00:00
Tim J. Robbins
d980da6c66 Copy cur's snap_time to last when refreshing statistics. Fixes problem
where MB/s and tps statistics would always be zero, presumably because
they were being averaged out over the time between now and when the
system booted instead of a few seconds.

PR:		58683
2003-11-01 02:06:02 +00:00
Poul-Henning Kamp
84b4ac514e Use 'k' as suffix for Kilo
Pointed out by:	several.
2003-10-24 21:23:47 +00:00
Poul-Henning Kamp
f46a0535ef When a numeric field overflows its width, try formatting the number in
'kilo' or 'mega' with appropriate suffix instead of filling the field
with stars.
2003-10-20 20:13:50 +00:00
David Malone
f29d8c1abe Add ip6 and icmp6 displays to systat.
MFC after:	2 weeks
2003-08-01 20:28:20 +00:00
Poul-Henning Kamp
1e3f260a6b Let libdevstat calculate the device-busy % instead of home-rolling. 2003-04-09 07:49:43 +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
Ruslan Ermilov
ace5be682d mdoc(7) police: Scheduled sweep. 2003-02-24 22:53:26 +00:00
Poul-Henning Kamp
3bd41074f4 Add #include <sys/resource.h> 2003-02-16 15:46:25 +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
Poul-Henning Kamp
b59ba7df87 Add "ifstat" display:
ifstat      Display the network traffic going through active interfaces
                 on the system.  Idle interfaces will not be displayed until
                 they receive some traffic.

                 For each interface being displayed, the current, peak and
                 total statistics are displayed for incoming and outgoing
                 traffic.  By default, the ifstat display will automatically
                 scale the units being used so that they are in a human-read-
                 able format.  The scaling units used for the current and peak
                 traffic columns can be altered by the scale command.

Submitted by:	Trent Nelson <trent@arpa.com>
2003-01-04 22:07:24 +00:00
Poul-Henning Kamp
319e2a24de When we close a display, mark it as not-initialized so that we will
properly open it again next time.

Submitted by:	Trent Nelson <trent@arpa.com>
2003-01-04 21:58:25 +00:00
Mike Barcroft
3c392172d7 Back out rev 1.20; getbsize(3)'s original interface has been restored.
Approved by:	markm
2002-12-30 18:14:43 +00:00
Jens Schweikhardt
57bd0fc6e8 english(4) police. 2002-12-27 12:15:40 +00:00
Mark Murray
a09114536e Adjust for getbsize argument type change. 2002-10-23 19:02:17 +00:00
Mark Murray
4b51efd2b3 Remove unneeded function prototypes. 2002-10-23 16:20:12 +00:00
John Polstra
f824b5187e Widen struct sockbuf's sb_timeo member to int from short. With
non-default but reasonable values of hz this member overflowed,
breaking NFS over UDP.

Also, as long as I'm plowing up struct sockbuf ... Change certain
members from u_long/long to u_int/int in order to reduce wasted
space on 64-bit machines.  This change was requested by Andrew
Gallatin.

Netstat and systat need to be rebuilt.  I am incrementing
__FreeBSD_version in case any ports need to change.
2002-07-24 03:02:43 +00:00
Giorgos Keramidas
3fbfa86b4c ^Z suspends any and all programs that don't do anything special about
it.  There's really no reason to explicitly mention it here.

Suggested by:	Mark Valentine <mark@thuvia.demon.co.uk>
2002-07-15 05:54:35 +00:00
Giorgos Keramidas
c7a5e9a0a2 ^Z doesn't "stop" systat, but it "suspends" it.
PR:		docs/40489
Submitted by:	Dave McCammon <davemac11@yahoo.com>
2002-07-15 01:53:29 +00:00
Dag-Erling Smørgrav
a5426997a3 debug.{numvnodes,freevnodes} moved to vfs. 2002-06-06 23:01:50 +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
Philippe Charnier
e8937ba009 Use `The .Nm utility' 2002-04-20 12:18:28 +00:00
David Malone
72c7c2e625 Remove previously unneeded and now incorrect cast of user_from_uid()
to a char *.
Fix up vendor ID.
2002-04-13 21:09:55 +00:00
Warner Losh
bbf5c743d2 unifdef __STDC__ 2002-03-23 23:37:07 +00:00
Warner Losh
3f330d7d1a remove __P 2002-03-22 01:42:45 +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
9ff712b0f5 WARNS=2 fixes with NO_WERROR set, as there are some header issues
with namelists. use __FBSDID().
2001-12-12 00:13:37 +00:00
Mark Murray
4b0ef38df3 Remove the 'irq' string from the irqN part of the "interrupts" display.
This allows us to see the irq number when device names ate too long.
2001-12-01 17:41:37 +00:00
Jonathan Lemon
5b7d36ba0f Add #include <net/route.h> in order to get this to compile.
Spotted by: David Wolfskill
Forgotten by: me
2001-11-22 17:19:52 +00:00
Bruce Evans
6eabd84580 Compensate for "Compensate for header dethreading" by backing it out. 2001-10-10 17:48:44 +00:00
Maxim Sobolev
3ff9006c71 Remove greatly outdated comment that systat(1) takes 2-10% of the CPU time.
This isn't true nowadays.
2001-10-09 16:07:32 +00:00
Bosko Milekic
70a61707f6 Re-enable mbtypes statistics in the mbuf allocator. I disabled these
when I changed the allocator bits. This implements per-CPU mbtypes
stats by keeping net number of decrements/increments of a given mbtype
per-CPU and then summing all of the per-CPU mbtypes to produce the total
net number of allocated mbufs of the given mbtype.
Counters are carefully balanced to avoid/prevent underflows/overflows.

mbtypes stats are re-enabled with the idea that we may occasionally
(although very rarely) observe slight inconsistencies in the stat
reporting. Most of the time, we should be fine, though.

Also make appropriate modifications to netstat(1) and systat(1) to do
the necessary reporting.

Submitted by: Jiangyi Liu <jyliu@163.net>
2001-09-30 01:58:39 +00:00
Kenneth D. Merry
8f29de8be3 Convert systat(1) to use the new devstat interface.
Submitted by:	"Sergey A. Osokin" <osa@freebsd.org.ru>
2001-09-06 04:06:12 +00:00
Bosko Milekic
49f854f926 - Do not handle the per-CPU containers in mbuf code as though the cpuids
were indices in a dense array. The cpuids are a sparse set and treat
  them as such, setting up containers only for CPUs activated during
  mb_init().

- Fix netstat(1) and systat(1) to treat the per-CPU stats area as a sparse
  map, in accordance with the above.

This allows us to properly boot with certain CPUs disactivated. However, if
we later decide to re-activate said CPUs, we will barf until we decide to
implement CPU spinon/spinoff callback hooks to allow for said CPUs' per-CPU
containers to get configured on their activation.

Reported by: mjacob
Partially (sys/ diffs) Submitted by: mjacob
2001-07-26 18:47:46 +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
Ruslan Ermilov
5521ff5a4d mdoc(7) police: sort SEE ALSO xrefs (sort -b -f +2 -3 +1 -2). 2001-07-06 16:46:48 +00:00
Bosko Milekic
4edec6b79a Make sure to try hw.ncpu if kern.smp.cpus doesn't exist (i.e. on UP) when
getting number of CPUs.
2001-06-23 17:03:27 +00:00
Bosko Milekic
08442f8a82 Introduce numerous SMP friendly changes to the mbuf allocator. Namely,
introduce a modified allocation mechanism for mbufs and mbuf clusters; one
which can scale under SMP and which offers the possibility of resource
reclamation to be implemented in the future. Notable advantages:

 o Reduce contention for SMP by offering per-CPU pools and locks.
 o Better use of data cache due to per-CPU pools.
 o Much less code cache pollution due to excessively large allocation macros.
 o Framework for `grouping' objects from same page together so as to be able
   to possibly free wired-down pages back to the system if they are no longer
   needed by the network stacks.

 Additional things changed with this addition:

  - Moved some mbuf specific declarations and initializations from
    sys/conf/param.c into mbuf-specific code where they belong.
  - m_getclr() has been renamed to m_get_clrd() because the old name is really
    confusing. m_getclr() HAS been preserved though and is defined to the new
    name. No tree sweep has been done "to change the interface," as the old
    name will continue to be supported and is not depracated. The change was
    merely done because m_getclr() sounds too much like "m_get a cluster."
  - TEMPORARILY disabled mbtypes statistics displaying in netstat(1) and
    systat(1) (see TODO below).
  - Fixed systat(1) to display number of "free mbufs" based on new per-CPU
    stat structures.
  - Fixed netstat(1) to display new per-CPU stats based on sysctl-exported
    per-CPU stat structures. All infos are fetched via sysctl.

 TODO (in order of priority):

  - Re-enable mbtypes statistics in both netstat(1) and systat(1) after
    introducing an SMP friendly way to collect the mbtypes stats under the
    already introduced per-CPU locks (i.e. hopefully don't use atomic() - it
    seems too costly for a mere stat update, especially when other locks are
    already present).
  - Optionally have systat(1) display not only "total free mbufs" but also
    "total free mbufs per CPU pool."
  - Fix minor length-fetching issues in netstat(1) related to recently
    re-enabled option to read mbuf stats from a core file.
  - Move reference counters at least for mbuf clusters into an unused portion
    of the cluster itself, to save space and need to allocate a counter.
  - Look into introducing resource freeing possibly from a kproc.

Reviewed by (in parts): jlemon, jake, silby, terry
Tested by: jlemon (Intel & Alpha), mjacob (Intel & Alpha)
Preliminary performance measurements: jlemon (and me, obviously)
URL: http://people.freebsd.org/~bmilekic/mb_alloc/
2001-06-22 06:35:32 +00:00
Thomas Moestl
d62de5c4bb Replace a use of the hw.nintr sysctl as it has just gone away, cast
size_t variables when passing them to a printf-like function, and some
minor cleanups.
2001-06-01 13:29:19 +00:00
Ruslan Ermilov
18fbb861ab Display -tcp w/o load average so that all statistics fits on a 80x25 screen. 2001-05-31 07:14:52 +00:00
Ruslan Ermilov
7bbf75ec4f Show TCP checksum failures with -tcp display.
PR:		bin/27786
Submitted by:	Brooks Davis <brooks@one-eyed-alien.net>
2001-05-31 07:08:49 +00:00
Kris Kennaway
096c40e3f3 Mark error() as __printflike() and fix a non-exploitable format string
error.

MFC after:	1 week
2001-05-25 23:15:05 +00:00
Thomas Moestl
5a3c3d039a Fix the error buffer passed to kvm_openfiles to have a length of
_POSIX2_LINE_MAX as required.
While being there, wrap an overly long line.

MFC after:	3 days
2001-05-25 23:10:27 +00:00
Ruslan Ermilov
3ab9a9d0e0 Removed -I${.CURDIR}/.../sys from CFLAGS. 2001-05-18 13:41:42 +00:00
Mark Murray
6e547eabb8 Compensate for header dethreading. 2001-05-01 08:46:02 +00:00
Andrew Gallatin
0b8b714fa9 numdirtybuffers is an int, not a long. 2001-03-29 02:18:19 +00:00
Thomas Moestl
342e2faa09 Get rid of setgid kmem for systat, and while being there, fix some bugs
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
2001-03-23 03:58:25 +00:00
Andrey A. Chernov
6ab831378a Don't attempt to parse %c 2001-03-21 20:32:20 +00:00