diff options
author | bde <bde@FreeBSD.org> | 2003-11-16 23:05:52 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2003-11-16 23:05:52 +0000 |
commit | 44e24b4739d0c28d3ffa69afb7e63d3229969a27 (patch) | |
tree | b116cd99193ed18f9d355ba39996d3325d678a43 /sys/dev/sio/sio.c | |
parent | bf46bca8b22499ef2fdfa7604dd6add7a7b9580a (diff) | |
download | FreeBSD-src-44e24b4739d0c28d3ffa69afb7e63d3229969a27.zip FreeBSD-src-44e24b4739d0c28d3ffa69afb7e63d3229969a27.tar.gz |
Don't waste so much space for the latency debugging buffer. Its size
will now need editing except for spot checks.
Changed this buffer from a circular one to a linear one. This is more
useful for some cases and the sysctl that prints it doesn't support
circular buffers.
Fixed (output) formatting bugs in this sysctl. An off by 1 error caused
a garbage byte to be returned after annotation of large deltas, and
a race with the writer sometimes caused premature string termination.
Diffstat (limited to 'sys/dev/sio/sio.c')
-rw-r--r-- | sys/dev/sio/sio.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 50b2d55..42c285b 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -1730,7 +1730,7 @@ siointr(arg) #endif /* COM_MULTIPORT */ } -static struct timespec siots[8192]; +static struct timespec siots[8]; static int siotso; static int volatile siotsunit = -1; @@ -1740,17 +1740,17 @@ sysctl_siots(SYSCTL_HANDLER_ARGS) char buf[128]; long long delta; size_t len; - int error, i; + int error, i, tso; - for (i = 1; i < siotso; i++) { + for (i = 1, tso = siotso; i < tso; i++) { delta = (long long)(siots[i].tv_sec - siots[i - 1].tv_sec) * 1000000000 + (siots[i].tv_nsec - siots[i - 1].tv_nsec); len = sprintf(buf, "%lld\n", delta); if (delta >= 110000) len += sprintf(buf + len - 1, ": *** %ld.%09ld\n", - (long)siots[i].tv_sec, siots[i].tv_nsec); - if (i == siotso - 1) + (long)siots[i].tv_sec, siots[i].tv_nsec) - 1; + if (i == tso - 1) buf[len - 1] = '\0'; error = SYSCTL_OUT(req, buf, len); if (error != 0) @@ -1922,11 +1922,9 @@ cont: } else { outb(com->data_port, *ioptr++); ++com->bytes_out; - if (com->unit == siotsunit) { - nanouptime(&siots[siotso]); - siotso = (siotso + 1) % - (sizeof siots / sizeof siots[0]); - } + if (com->unit == siotsunit + && siotso < sizeof siots / sizeof siots[0]) + nanouptime(&siots[siotso++]); } com->obufq.l_head = ioptr; if (COM_IIR_TXRDYBUG(com->flags)) |