Source-Changes-HG archive

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

[src/trunk]: src/sys Add accessor functions to get the number of gets and put...



details:   https://anonhg.NetBSD.org/src/rev/f6c79de8cd0d
branches:  trunk
changeset: 984824:f6c79de8cd0d
user:      simonb <simonb%NetBSD.org@localhost>
date:      Sun Jul 25 06:00:31 2021 +0000

description:
Add accessor functions to get the number of gets and puts on pools and
pool caches.

diffstat:

 sys/kern/subr_pool.c |  32 ++++++++++++++++++++++++++++++--
 sys/sys/pool.h       |   8 +++++++-
 2 files changed, 37 insertions(+), 3 deletions(-)

diffs (89 lines):

diff -r 303afbfb4873 -r f6c79de8cd0d sys/kern/subr_pool.c
--- a/sys/kern/subr_pool.c      Sun Jul 25 02:00:42 2021 +0000
+++ b/sys/kern/subr_pool.c      Sun Jul 25 06:00:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_pool.c,v 1.276 2021/02/24 05:36:02 mrg Exp $      */
+/*     $NetBSD: subr_pool.c,v 1.277 2021/07/25 06:00:31 simonb Exp $   */
 
 /*
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018,
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.276 2021/02/24 05:36:02 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.277 2021/07/25 06:00:31 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1609,6 +1609,20 @@
        mutex_exit(&pp->pr_lock);
 }
 
+unsigned int
+pool_nget(struct pool *pp)
+{
+
+       return pp->pr_nget;
+}
+
+unsigned int
+pool_nput(struct pool *pp)
+{
+
+       return pp->pr_nput;
+}
+
 /*
  * Release all complete pages that have not been used recently.
  *
@@ -2459,6 +2473,20 @@
        pool_prime(&pc->pc_pool, n);
 }
 
+unsigned int
+pool_cache_nget(pool_cache_t pc)
+{
+
+       return pool_nget(&pc->pc_pool);
+}
+
+unsigned int
+pool_cache_nput(pool_cache_t pc)
+{
+
+       return pool_nput(&pc->pc_pool);
+}
+
 /*
  * pool_pcg_get:
  *
diff -r 303afbfb4873 -r f6c79de8cd0d sys/sys/pool.h
--- a/sys/sys/pool.h    Sun Jul 25 02:00:42 2021 +0000
+++ b/sys/sys/pool.h    Sun Jul 25 06:00:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pool.h,v 1.93 2021/02/24 06:11:38 simonb Exp $ */
+/*     $NetBSD: pool.h,v 1.94 2021/07/25 06:00:31 simonb Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2000, 2007, 2020
@@ -319,6 +319,9 @@
 int            pool_totalpages(void);
 int            pool_totalpages_locked(void);
 
+unsigned int   pool_nget(struct pool *);
+unsigned int   pool_nput(struct pool *);
+
 /*
  * Debugging and diagnostic aides.
  */
@@ -353,6 +356,9 @@
 void           pool_cache_prime(pool_cache_t, int);
 void           pool_cache_cpu_init(struct cpu_info *);
 
+unsigned int   pool_cache_nget(pool_cache_t);
+unsigned int   pool_cache_nput(pool_cache_t);
+
 #define                pool_cache_get(pc, f) pool_cache_get_paddr((pc), (f), NULL)
 #define                pool_cache_put(pc, o) pool_cache_put_paddr((pc), (o), \
                                          POOL_PADDR_INVALID)



Home | Main Index | Thread Index | Old Index