summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1997-06-24 02:45:03 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1997-06-24 02:45:03 +0000
commiteff6e3e80e35d8f831768029b7ab27841f587ad7 (patch)
tree71cc5c2a53148e824f6706012057be8f766526e1
parent3b0b93f0c3f7c06b4273ee7798516deda393b195 (diff)
more accounting!
-rw-r--r--sbin/sysctl/sysctl.c9
-rw-r--r--sys/dev/rnd.c30
-rw-r--r--sys/dev/rndioctl.h2
-rw-r--r--sys/dev/rndvar.h5
-rw-r--r--usr.sbin/sysctl/sysctl.c9
5 files changed, 30 insertions, 25 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index af99d48f894..3e9855e58cc 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.9 1997/06/17 19:42:02 mickey Exp $ */
+/* $OpenBSD: sysctl.c,v 1.10 1997/06/24 02:45:02 mickey Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)sysctl.c 8.1 (Berkeley) 6/6/93";
#else
-static char *rcsid = "$OpenBSD: sysctl.c,v 1.9 1997/06/17 19:42:02 mickey Exp $";
+static char *rcsid = "$OpenBSD: sysctl.c,v 1.10 1997/06/24 02:45:02 mickey Exp $";
#endif
#endif /* not lint */
@@ -463,14 +463,15 @@ parse(string, flags)
if (!nflag)
fprintf(stdout, "%s = ", string);
fprintf(stdout,
- "%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
+ "%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
rndstats->rnd_total, rndstats->rnd_used,
rndstats->arc4_reads, rndstats->rnd_timer,
rndstats->rnd_mouse, rndstats->rnd_tty,
rndstats->rnd_disk, rndstats->rnd_net,
rndstats->rnd_reads, rndstats->rnd_waits,
rndstats->rnd_enqs, rndstats->rnd_deqs,
- rndstats->rnd_drops, rndstats->rnd_drople);
+ rndstats->rnd_drops, rndstats->rnd_drople,
+ rndstats->rnd_asleep, rndstats->rnd_queued);
return;
}
switch (type) {
diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c
index c95c328e928..00d2ae7a34f 100644
--- a/sys/dev/rnd.c
+++ b/sys/dev/rnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rnd.c,v 1.29 1997/06/22 05:05:00 flipk Exp $ */
+/* $OpenBSD: rnd.c,v 1.30 1997/06/24 02:45:00 mickey Exp $ */
/*
* random.c -- A strong random number generator
@@ -325,9 +325,7 @@ static struct timer_rand_state disk_timer_state;
static struct timer_rand_state net_timer_state;
static struct timer_rand_state tty_timer_state;
static struct rand_event event_space[QEVLEN];
-static int rnd_sleep = 0;
static int rnd_attached = 0;
-static int rnd_enqueued = 0;
static struct rand_event *event_q = NULL;
static struct rand_event *event_free;
@@ -566,7 +564,7 @@ enqueue_randomness(state, val)
for (nbits = 0; delta; nbits++)
delta >>= 1;
- if (rnd_enqueued > QEVSLOW && nbits < QEVSBITS) {
+ if (rndstats.rnd_queued > QEVSLOW && nbits < QEVSBITS) {
rndstats.rnd_drople++;
return;
}
@@ -592,10 +590,10 @@ enqueue_randomness(state, val)
rep = rep->re_next;
splx(s);
rndstats.rnd_timer++;
- rnd_enqueued++;
+ rndstats.rnd_queued++;
if (rep == NULL)
- timeout(dequeue_randomness, NULL, 1);
+ timeout(dequeue_randomness, (void *)0xdeadd00d, 1);
}
@@ -624,7 +622,6 @@ dequeue_randomness(v)
rep->re_next = event_free;
event_free = rep;
splx(s);
- rnd_enqueued--;
/* Prevent overflow */
if ((random_state.entropy_count + nbits) > POOLBITS &&
@@ -639,14 +636,17 @@ dequeue_randomness(v)
if (random_state.entropy_count > POOLBITS)
random_state.entropy_count = POOLBITS;
- if (random_state.entropy_count > 8 && rnd_sleep != 0) {
- rnd_sleep--;
+ rndstats.rnd_queued--;
+ if (random_state.entropy_count > 8 &&
+ rndstats.rnd_asleep != 0) {
#ifdef DEBUG
if (rnd_debug & RD_WAIT)
printf("rnd: wakeup[%d]{%u}\n",
- rnd_sleep, random_state.entropy_count);
+ rndstats.rnd_asleep,
+ random_state.entropy_count);
#endif
- wakeup(&rnd_sleep);
+ rndstats.rnd_asleep--;
+ wakeup(&rndstats.rnd_asleep);
}
} while(1);
@@ -825,12 +825,12 @@ randomread(dev, uio, ioflag)
#ifdef DEBUG
if (rnd_debug & RD_WAIT)
printf("rnd: sleep[%d]\n",
- rnd_sleep);
+ rndstats.rnd_asleep);
#endif
- rnd_sleep++;
+ rndstats.rnd_asleep++;
rndstats.rnd_waits++;
- ret = tsleep(&rnd_sleep, PWAIT | PCATCH,
- "rndrd", 0);
+ ret = tsleep(&rndstats.rnd_asleep,
+ PWAIT | PCATCH, "rndrd", 0);
#ifdef DEBUG
if (rnd_debug & RD_WAIT)
printf("rnd: awakened(%d)\n", ret);
diff --git a/sys/dev/rndioctl.h b/sys/dev/rndioctl.h
index b5f161932df..97f358452c4 100644
--- a/sys/dev/rndioctl.h
+++ b/sys/dev/rndioctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rndioctl.h,v 1.5 1997/06/22 04:58:06 flipk Exp $ */
+/* $OpenBSD: rndioctl.h,v 1.6 1997/06/24 02:45:01 mickey Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff.
diff --git a/sys/dev/rndvar.h b/sys/dev/rndvar.h
index 28edbc99322..8aee82949ab 100644
--- a/sys/dev/rndvar.h
+++ b/sys/dev/rndvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rndvar.h,v 1.9 1997/06/22 04:58:06 flipk Exp $ */
+/* $OpenBSD: rndvar.h,v 1.10 1997/06/24 02:45:01 mickey Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff.
@@ -63,6 +63,9 @@ struct rndstats {
u_long rnd_deqs; /* dequeue calls */
u_long rnd_drops; /* queue-full drops */
u_long rnd_drople;/* queue low watermark low entropy drops */
+
+ u_int rnd_asleep; /* sleeping for the data */
+ u_int rnd_queued; /* queued for processing */
};
#ifdef _KERNEL
diff --git a/usr.sbin/sysctl/sysctl.c b/usr.sbin/sysctl/sysctl.c
index af99d48f894..3e9855e58cc 100644
--- a/usr.sbin/sysctl/sysctl.c
+++ b/usr.sbin/sysctl/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.9 1997/06/17 19:42:02 mickey Exp $ */
+/* $OpenBSD: sysctl.c,v 1.10 1997/06/24 02:45:02 mickey Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)sysctl.c 8.1 (Berkeley) 6/6/93";
#else
-static char *rcsid = "$OpenBSD: sysctl.c,v 1.9 1997/06/17 19:42:02 mickey Exp $";
+static char *rcsid = "$OpenBSD: sysctl.c,v 1.10 1997/06/24 02:45:02 mickey Exp $";
#endif
#endif /* not lint */
@@ -463,14 +463,15 @@ parse(string, flags)
if (!nflag)
fprintf(stdout, "%s = ", string);
fprintf(stdout,
- "%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
+ "%lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
rndstats->rnd_total, rndstats->rnd_used,
rndstats->arc4_reads, rndstats->rnd_timer,
rndstats->rnd_mouse, rndstats->rnd_tty,
rndstats->rnd_disk, rndstats->rnd_net,
rndstats->rnd_reads, rndstats->rnd_waits,
rndstats->rnd_enqs, rndstats->rnd_deqs,
- rndstats->rnd_drops, rndstats->rnd_drople);
+ rndstats->rnd_drops, rndstats->rnd_drople,
+ rndstats->rnd_asleep, rndstats->rnd_queued);
return;
}
switch (type) {