aboutsummaryrefslogtreecommitdiff
path: root/libexec/rpc.rstatd
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2003-03-15 21:59:06 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2003-03-15 21:59:06 +0000
commit7194d335cfa65141113997cdc4ac01fe9c4504c1 (patch)
treec322a33c0275fefd9ca33cd377e3d6f459cb9a8c /libexec/rpc.rstatd
parent0c61d694a810b1a9d361f7414576ff1afdde28a9 (diff)
downloadsrc-7194d335cfa65141113997cdc4ac01fe9c4504c1.tar.gz
src-7194d335cfa65141113997cdc4ac01fe9c4504c1.zip
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
Notes
Notes: svn path=/head/; revision=112288
Diffstat (limited to 'libexec/rpc.rstatd')
-rw-r--r--libexec/rpc.rstatd/rstat_proc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libexec/rpc.rstatd/rstat_proc.c b/libexec/rpc.rstatd/rstat_proc.c
index bb04c16b75a2..440bdb6f588b 100644
--- a/libexec/rpc.rstatd/rstat_proc.c
+++ b/libexec/rpc.rstatd/rstat_proc.c
@@ -370,7 +370,7 @@ haveadisk(void)
void
updatexfers(int numdevs, int *devs)
{
- register int i, j, t;
+ register int i, j, k, t;
struct statinfo stats;
int num_devices = 0;
u_int64_t total_transfers;
@@ -400,9 +400,10 @@ updatexfers(int numdevs, int *devs)
& DEVSTAT_TYPE_MASK) == DEVSTAT_TYPE_DIRECT)
&& ((stats.dinfo->devices[i].device_type
& DEVSTAT_TYPE_PASS) == 0)) {
- total_transfers = stats.dinfo->devices[i].num_reads +
- stats.dinfo->devices[i].num_writes +
- stats.dinfo->devices[i].num_other;
+ total_transfers = 0;
+ for (k = 0; k < DEVSTAT_N_TRANS_FLAGS; k++)
+ total_transfers +=
+ stats.dinfo->devices[i].operations[k];
/*
* XXX KDM If the total transfers for this device
* are greater than the amount we can fit in a