Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 Turn bounce buffer stats into evcnts and en...
details: https://anonhg.NetBSD.org/src/rev/04c18bc1a4e0
branches: trunk
changeset: 584479:04c18bc1a4e0
user: thorpej <thorpej%NetBSD.org@localhost>
date: Tue Sep 20 04:48:10 2005 +0000
description:
Turn bounce buffer stats into evcnts and enable them by default.
diffstat:
sys/arch/x86/x86/bus_dma.c | 36 +++++++++++++++++++++++-------------
1 files changed, 23 insertions(+), 13 deletions(-)
diffs (100 lines):
diff -r c7e9c051da64 -r 04c18bc1a4e0 sys/arch/x86/x86/bus_dma.c
--- a/sys/arch/x86/x86/bus_dma.c Mon Sep 19 22:43:21 2005 +0000
+++ b/sys/arch/x86/x86/bus_dma.c Tue Sep 20 04:48:10 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.23 2005/08/22 11:09:39 bouyer Exp $ */
+/* $NetBSD: bus_dma.c,v 1.24 2005/09/20 04:48:10 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.23 2005/08/22 11:09:39 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.24 2005/09/20 04:48:10 thorpej Exp $");
/*
* The following is included because _bus_dma_uiomove is derived from
@@ -119,12 +119,22 @@
typedef void (vector) __P((void));
extern vector *IDTVEC(intr)[];
+#define BUSDMA_BOUNCESTATS
+
#ifdef BUSDMA_BOUNCESTATS
-int bus_dma_stats_nbouncebufs;
-int bus_dma_stats_loads;
-int bus_dma_stats_bounces;
-#define STAT_INCR(x) (x)++
-#define STAT_DECR(x) (x)++
+#define BUSDMA_EVCNT_DECL(name) \
+static struct evcnt bus_dma_ev_##name = \
+ EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "bus_dma", #name); \
+EVCNT_ATTACH_STATIC(bus_dma_ev_##name)
+
+#define STAT_INCR(name) \
+ bus_dma_ev_##name.ev_count++
+#define STAT_DECR(name) \
+ bus_dma_ev_##name.ev_count--
+
+BUSDMA_EVCNT_DECL(nbouncebufs);
+BUSDMA_EVCNT_DECL(loads);
+BUSDMA_EVCNT_DECL(bounces);
#else
#define STAT_INCR(x)
#define STAT_DECR(x)
@@ -318,7 +328,7 @@
struct x86_bus_dma_cookie *cookie = map->_dm_cookie;
int error;
- STAT_INCR(bus_dma_stats_loads);
+ STAT_INCR(loads);
/*
* Make sure that on error condition we return "no valid mappings."
@@ -346,7 +356,7 @@
* First attempt failed; bounce it.
*/
- STAT_INCR(bus_dma_stats_bounces);
+ STAT_INCR(bounces);
/*
* Allocate bounce pages, if necessary.
@@ -543,7 +553,7 @@
* First attempt failed; bounce it.
*/
- STAT_INCR(bus_dma_stats_bounces);
+ STAT_INCR(bounces);
/*
* Allocate bounce pages, if necessary.
@@ -629,7 +639,7 @@
((cookie->id_flags & X86_DMA_MIGHT_NEED_BOUNCE) == 0))
return error;
- STAT_INCR(bus_dma_stats_bounces);
+ STAT_INCR(bounces);
/*
* Allocate bounce pages, if necessary.
@@ -894,7 +904,7 @@
cookie->id_nbouncesegs = 0;
} else {
cookie->id_flags |= X86_DMA_HAS_BOUNCE;
- STAT_INCR(bus_dma_stats_nbouncebufs);
+ STAT_INCR(nbouncebufs);
}
return (error);
@@ -910,7 +920,7 @@
panic("_bus_dma_alloc_bouncebuf: no cookie");
#endif
- STAT_DECR(bus_dma_stats_nbouncebufs);
+ STAT_DECR(nbouncebufs);
_bus_dmamem_unmap(t, cookie->id_bouncebuf, cookie->id_bouncebuflen);
_bus_dmamem_free(t, cookie->id_bouncesegs,
Home |
Main Index |
Thread Index |
Old Index