Commit Graph

30 Commits

Author SHA1 Message Date
John Baldwin
e4253ae822 rpc.rstatd/rwalld: Use more accurate function pointer types.
Reviewed by:	zlei, rmacklem
Differential Revision:	https://reviews.freebsd.org/D39521
2023-04-18 11:21:50 -07:00
Gleb Smirnoff
83c9dea1ba - Remove 'struct vmmeter' from 'struct pcpu', leaving only global vmmeter
in place.  To do per-cpu stats, convert all fields that previously were
  maintained in the vmmeters that sit in pcpus to counter(9).
- Since some vmmeter stats may be touched at very early stages of boot,
  before we have set up UMA and we can do counter_u64_alloc(), provide an
  early counter mechanism:
  o Leave one spare uint64_t in struct pcpu, named pc_early_dummy_counter.
  o Point counter(9) fields of vmmeter to pcpu[0].pc_early_dummy_counter,
    so that at early stages of boot, before counters are allocated we already
    point to a counter that can be safely written to.
  o For sparc64 that required a whole dummy pcpu[MAXCPU] array.

Further related changes:
- Don't include vmmeter.h into pcpu.h.
- vm.stats.vm.v_swappgsout and vm.stats.vm.v_swappgsin changed to 64-bit,
  to match kernel representation.
- struct vmmeter hidden under _KERNEL, and only vmstat(1) is an exclusion.

This is based on benno@'s 4-year old patch:
https://lists.freebsd.org/pipermail/freebsd-arch/2013-July/014471.html

Reviewed by:	kib, gallatin, marius, lidl
Differential Revision:	https://reviews.freebsd.org/D10156
2017-04-17 17:34:47 +00:00
Gleb Smirnoff
62cd9e48ca Remove unused vmmeter. 2017-03-17 04:16:14 +00:00
Ed Schouten
902d9eafbf Rework all non-contributed files that use `struct timezone'.
This structure is not part of POSIX. According to POSIX, gettimeofday()
has the following prototype:

	int gettimeofday(struct timeval *restrict tp, void *restrict tzp);

Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is
not used). Remove dead error handling code. Also use NULL for a
nul-pointer instead of integer 0.

While there, change all pieces of code that only use tv_sec to use
time(3), as this provides less overhead.
2012-09-01 14:45:15 +00:00
John Baldwin
87f2ff4f3e Use sysctl to fetch stats from the kernel instead of reading variables
directly via libkvm.

PR:		kern/122875, bin/123014
Tested by:	Danny Braniss  danny cs.huji.ac.il
MFC after:	1 week
2008-06-10 18:47:43 +00:00
David E. O'Brien
bd273f0c0b Add the variable's type to the declaration. 2003-06-02 02:34:36 +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
a57042df90 Update to current devstat API. 2003-03-15 21:04:50 +00:00
Poul-Henning Kamp
fd3a502df2 Add #include <sys/resource.h> 2003-02-16 15:21:26 +00:00
Poul-Henning Kamp
1b16b28926 Remove <sys/dkstat.h> #include 2003-02-16 14:09:16 +00:00
Mike Barcroft
821aa3b401 Rename local function havedisk() to haveadisk() to avoid conflict a
with another function by the same name in a system header.
2002-10-02 18:29:50 +00:00
Bruce Evans
7309e024bf Include <nlist.h> for nlist interfaces instead of depending on namespace
pollution in <kvm.h>.
2002-08-18 17:57:08 +00:00
Dag-Erling Smørgrav
f249dbcc71 Spell void * as void * rather than caddr_t. This is complicated by the
fact that caddr_t is often misspelled as char *.

Sponsored by:	DARPA, NAI Labs
2002-04-28 15:18:50 +00:00
Warner Losh
a174e5b13a o __P removal
o use new style prototypes and function definitions
o signal handlers need an argument.  Mark it unused.
2002-02-07 05:24:53 +00:00
Bill Fenner
b9d45cebf4 The interface index space may be sparsely populated (e.g. when an
interface in the middle is if_detach()'d).  Return (and handle)
 ENOENT when the ifmib(4) is accessed for a nonexistent interface.

MFC after: 14 days
2001-10-17 04:12:29 +00:00
Jonathan Chen
685233abc5 Fixes file descriptor leak in standalone mode.
Prevents simultaneous calls to updatestat() as function is not reentrant.

PR:		bin/24857
Submitted by:	Martin Butkus <mb@bagheera.thgwf.de>
MFC after:	1 month
2001-08-03 00:23:37 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Kenneth D. Merry
b994e5358d Fix a memory leak in rpc.rstatd that shows up when it's run in standalone
mode.  (i.e., not from inetd)

PR:		bin/8212
1998-10-08 19:59:40 +00:00
Doug Rabson
8223b746c9 Work around an alpha compiler bug.
Reviewed by: Kenneth D. Merry <ken@plutotech.com>
1998-09-16 21:33:14 +00:00
Justin T. Gibbs
b2dfb1f906 Update system to new device statistics code.
Submitted by:	"Kenneth D. Merry" <ken@plutotech.com>
		mike@smith.net.au (Mike Smith)
1998-09-15 08:15:30 +00:00
Bill Paul
e4a0e42ba8 Make these programs compile and work correctly now that /usr/include/rpcsvc
has been ANSI-fied.

Pointed out by: bde
1998-01-19 23:13:38 +00:00
Philippe Charnier
859c540701 Remove unused #include. Display if inetd started us in case of failure. 1998-01-07 07:51:00 +00:00
Philippe Charnier
754c3c574d Remove \n at end of syslog string. -Wall cleaning. Cosmetics in man page. 1997-11-26 07:34:56 +00:00
Peter Wemm
9e522f7a18 Revert $FreeBSD$ to $Id$ 1997-02-22 14:22:49 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Garrett Wollman
702a1d0148 Update to match changes in <net/if.h>. 1997-01-03 20:19:50 +00:00
Garrett Wollman
e831f30876 Convert this program to use sysctl rather than kvm for some of its
statistics.  Unfortunately, the coverage of sysctl isn't good enough to do
all of them :-( .
1996-12-11 19:11:52 +00:00
Rodney W. Grimes
6c06b4e2aa Remove trailing whitespace. 1995-05-30 05:51:47 +00:00
David Greenman
3e54d2c866 Updated to changes in struct vmmeter. There is a slight bogosity here:
"pageins/outs" now refers to vnode paging.
1994-10-15 13:39:54 +00:00
Geoff Rehmet
0c0b205ceb rstatd -- from FreeBSD-1.1.5.1, with changes for 4.4-Lite kvm interface.
Original rstatd by John Brezak
Submitted by:	Geoff.
1994-08-28 14:49:04 +00:00