Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/systat Allow display intervals > 25 seconds.
details: https://anonhg.NetBSD.org/src/rev/1e5c49ed6d8b
branches: trunk
changeset: 748765:1e5c49ed6d8b
user: dsl <dsl%NetBSD.org@localhost>
date: Wed Nov 04 21:46:24 2009 +0000
description:
Allow display intervals > 25 seconds.
Fixes PR/36999
I did contemplate chaging curses - but the code is replicated and warped.
diffstat:
usr.bin/systat/main.c | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diffs (53 lines):
diff -r 8184926e9f79 -r 1e5c49ed6d8b usr.bin/systat/main.c
--- a/usr.bin/systat/main.c Wed Nov 04 21:24:57 2009 +0000
+++ b/usr.bin/systat/main.c Wed Nov 04 21:46:24 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.44 2009/07/14 21:08:31 apb Exp $ */
+/* $NetBSD: main.c,v 1.45 2009/11/04 21:46:24 dsl Exp $ */
/*-
* Copyright (c) 1980, 1992, 1993
@@ -36,7 +36,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif
-__RCSID("$NetBSD: main.c,v 1.44 2009/07/14 21:08:31 apb Exp $");
+__RCSID("$NetBSD: main.c,v 1.45 2009/11/04 21:46:24 dsl Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -267,8 +267,14 @@
void
display(int signo)
{
+ static int skip;
int j;
struct mode *p;
+ int ms_delay;
+
+ if (signo == SIGALRM && skip-- > 0)
+ /* Don't display on this timeout */
+ return;
/* Get the load average over the last minute. */
(void)getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0]));
@@ -308,9 +314,17 @@
allcounter=0;
} else
allcounter++;
- }
+ }
- timeout(naptime * 1000);
+ /* curses timeout() uses VTIME, limited to 255 1/10th secs */
+ ms_delay = naptime * 1000;
+ if (ms_delay < 25500) {
+ timeout(ms_delay);
+ skip = 0;
+ } else {
+ skip = ms_delay / 25500;
+ timeout(ms_delay / (skip + 1));
+ }
}
void
Home |
Main Index |
Thread Index |
Old Index