diff options
| author | oster <oster@NetBSD.org> | 2002-09-16 23:40:57 +0000 |
|---|---|---|
| committer | oster <oster@NetBSD.org> | 2002-09-16 23:40:57 +0000 |
| commit | e8ffb40a0e701984ecbe1b1b3a9a932eeab95898 (patch) | |
| tree | 796a5e60976cff9cfd62b9d75127747587e6f2f3 /sys/dev/raidframe/rf_debugMem.c | |
| parent | 763ac2f8fec7b90e20844894183f46a2b526c094 (diff) | |
Those of us who might be interested in debugging internal memory usage
of RAIDframe can use RF_DEBUG_MEM. I suspsect the rest of the world would
rather use that 14K of kernel memory for something else.
Diffstat (limited to 'sys/dev/raidframe/rf_debugMem.c')
| -rw-r--r-- | sys/dev/raidframe/rf_debugMem.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sys/dev/raidframe/rf_debugMem.c b/sys/dev/raidframe/rf_debugMem.c index 94cc30d09cc..f3f3383f863 100644 --- a/sys/dev/raidframe/rf_debugMem.c +++ b/sys/dev/raidframe/rf_debugMem.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_debugMem.c,v 1.10 2002/09/14 17:53:57 oster Exp $ */ +/* $NetBSD: rf_debugMem.c,v 1.11 2002/09/16 23:40:57 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rf_debugMem.c,v 1.10 2002/09/14 17:53:57 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_debugMem.c,v 1.11 2002/09/16 23:40:57 oster Exp $"); #include <dev/raidframe/raidframevar.h> @@ -46,6 +46,8 @@ __KERNEL_RCSID(0, "$NetBSD: rf_debugMem.c,v 1.10 2002/09/14 17:53:57 oster Exp $ #include "rf_debugMem.h" #include "rf_general.h" +#if RF_DEBUG_MEM + static long tot_mem_in_use = 0; /* Hash table of information about memory allocations */ @@ -61,10 +63,10 @@ struct mh_struct { }; static struct mh_struct *mh_table[RF_MH_TABLESIZE]; RF_DECLARE_MUTEX(rf_debug_mem_mutex) - static int mh_table_initialized = 0; +static int mh_table_initialized = 0; - static void memory_hash_insert(void *addr, int size, int line, char *filen); - static int memory_hash_remove(void *addr, int sz); +static void memory_hash_insert(void *addr, int size, int line, char *filen); +static int memory_hash_remove(void *addr, int sz); void rf_record_malloc(p, size, line, filen) @@ -120,11 +122,13 @@ rf_print_unfreed() printf("%ld total bytes in use\n", tot_mem_in_use); } } +#endif /* RF_DEBUG_MEM */ int rf_ConfigureDebugMem(listp) RF_ShutdownList_t **listp; { +#if RF_DEBUG_MEM int i, rc; rc = rf_create_managed_mutex(listp, &rf_debug_mem_mutex); @@ -137,8 +141,12 @@ rf_ConfigureDebugMem(listp) mh_table[i] = NULL; mh_table_initialized = 1; } +#endif return (0); } + +#if RF_DEBUG_MEM + #define HASHADDR(_a_) ( (((unsigned long) _a_)>>3) % RF_MH_TABLESIZE ) static void @@ -200,3 +208,6 @@ memory_hash_remove(addr, sz) p->allocated = 0; return (p->size); } +#endif /* RF_DEBUG_MEM */ + + |
