Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev add a couple of event counters.



details:   https://anonhg.NetBSD.org/src/rev/7a2b8a74189a
branches:  trunk
changeset: 333586:7a2b8a74189a
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Nov 09 20:29:58 2014 +0000

description:
add a couple of event counters.

diffstat:

 sys/dev/rndpseudo.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (53 lines):

diff -r 54614ee75979 -r 7a2b8a74189a sys/dev/rndpseudo.c
--- a/sys/dev/rndpseudo.c       Sun Nov 09 20:14:01 2014 +0000
+++ b/sys/dev/rndpseudo.c       Sun Nov 09 20:29:58 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rndpseudo.c,v 1.23 2014/10/26 18:22:32 tls Exp $       */
+/*     $NetBSD: rndpseudo.c,v 1.24 2014/11/09 20:29:58 christos Exp $  */
 
 /*-
  * Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rndpseudo.c,v 1.23 2014/10/26 18:22:32 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rndpseudo.c,v 1.24 2014/11/09 20:29:58 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -58,6 +58,7 @@
 #include <sys/cpu.h>
 #include <sys/stat.h>
 #include <sys/percpu.h>
+#include <sys/evcnt.h>
 
 #include <sys/rnd.h>
 #ifdef COMPAT_50
@@ -166,6 +167,13 @@
 extern rndsave_t       *boot_rsp;              /* XXX */
 extern LIST_HEAD(, krndsource) rnd_sources;    /* XXX */
 
+static struct evcnt rndpseudo_soft = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
+    NULL, "rndpseudo", "open soft");
+static struct evcnt rndpseudo_hard = EVCNT_INITIALIZER(EVCNT_TYPE_MISC,
+    NULL, "rndpseudo", "open hard");
+EVCNT_ATTACH_STATIC(rndpseudo_soft);
+EVCNT_ATTACH_STATIC(rndpseudo_hard);
+
 /*
  * Generate a 32-bit counter.  This should be more machine dependent,
  * using cycle counters and the like when possible.
@@ -219,10 +227,12 @@
        switch (minor(dev)) {
        case RND_DEV_URANDOM:
                hard = false;
+               rndpseudo_soft.ev_count++;
                break;
 
        case RND_DEV_RANDOM:
                hard = true;
+               rndpseudo_hard.ev_count++;
                break;
 
        default:



Home | Main Index | Thread Index | Old Index