1 /* $KAME: altq_rmclass_debug.h,v 1.3 2002/11/29 04:36:24 kjc Exp $ */
2 /* $DragonFly: src/sys/net/altq/altq_rmclass_debug.h,v 1.1 2005/02/11 22:25:57 joerg Exp $ */
5 * Copyright (c) Sun Microsystems, Inc. 1998 All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the SMCC Technology
21 * Development Group at Sun Microsystems, Inc.
23 * 4. The name of the Sun Microsystems, Inc nor may not be used to endorse or
24 * promote products derived from this software without specific prior
27 * SUN MICROSYSTEMS DOES NOT CLAIM MERCHANTABILITY OF THIS SOFTWARE OR THE
28 * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE. The software is
29 * provided "as is" without express or implied warranty of any kind.
31 * These notices must be retained in any copies of any part of this software.
34 #ifndef _ALTQ_ALTQ_RMCLASS_DEBUG_H_
35 #define _ALTQ_ALTQ_RMCLASS_DEBUG_H_
37 /* #pragma ident "@(#)rm_class_debug.h 1.7 98/05/04 SMI" */
40 * Cbq debugging macros
45 #define NCBQTRACE (16 * 1024)
49 * To view the trace output, using adb, type:
50 * adb -k /dev/ksyms /dev/mem <cr>, then type
51 * cbqtrace_count/D to get the count, then type
52 * cbqtrace_buffer,0tcount/Dp4C" "Xn
53 * This will dump the trace buffer from 0 to count.
56 * in ALTQ, "call cbqtrace_dump(N)" from DDB to display 20 events
57 * from Nth event in the circular buffer.
62 int function; /* address of function */
63 int trace_action; /* descriptive 4 characters */
64 int object; /* object operated on */
67 #define CBQTRACEINIT() { \
68 if (cbqtrace_ptr == NULL) \
69 cbqtrace_ptr = cbqtrace_buffer; \
71 cbqtrace_ptr = cbqtrace_buffer; \
72 bzero((void *)cbqtrace_ptr, sizeof(cbqtrace_buffer)); \
77 #define LOCK_TRACE() splimp()
78 #define UNLOCK_TRACE(x) splx(x)
80 #define CBQTRACE(func, act, obj) { \
81 int __s = LOCK_TRACE(); \
82 int *_p = &cbqtrace_ptr->count; \
83 *_p++ = ++cbqtrace_count; \
84 *_p++ = (int)(func); \
87 if ((struct cbqtrace *)(void *)_p >= &cbqtrace_buffer[NCBQTRACE])\
88 cbqtrace_ptr = cbqtrace_buffer; \
90 cbqtrace_ptr = (struct cbqtrace *)(void *)_p; \
95 /* If no tracing, define no-ops */
96 #define CBQTRACEINIT()
97 #define CBQTRACE(a, b, c)
99 #endif /* !CBQ_TRACE */
101 #endif /* _ALTQ_ALTQ_RMCLASS_DEBUG_H_ */