[BACK]Return to altq_rmclass_debug.h CVS log [TXT][DIR] Up to [local] / sys / altq

Annotation of sys/altq/altq_rmclass_debug.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: altq_rmclass_debug.h,v 1.3 2006/03/04 22:40:15 brad Exp $     */
                      2: /*     $KAME: altq_rmclass_debug.h,v 1.2 2000/02/22 14:00:35 itojun Exp $      */
                      3:
                      4: /*
                      5:  * Copyright (c) Sun Microsystems, Inc. 1998 All rights reserved.
                      6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  *
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  *
                     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.
                     17:  *
                     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.
                     22:  *
                     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
                     25:  *      written permission.
                     26:  *
                     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.
                     30:  *
                     31:  * These notices must be retained in any copies of any part of this software.
                     32:  */
                     33:
                     34: #ifndef _ALTQ_ALTQ_RMCLASS_DEBUG_H_
                     35: #define        _ALTQ_ALTQ_RMCLASS_DEBUG_H_
                     36:
                     37: /* #pragma ident       "@(#)rm_class_debug.h   1.7     98/05/04 SMI" */
                     38:
                     39: /*
                     40:  * Cbq debugging macros
                     41:  */
                     42:
                     43: #ifdef __cplusplus
                     44: extern "C" {
                     45: #endif
                     46:
                     47: #ifdef CBQ_TRACE
                     48: #ifndef NCBQTRACE
                     49: #define        NCBQTRACE (16 * 1024)
                     50: #endif
                     51:
                     52: /*
                     53:  * To view the trace output, using adb, type:
                     54:  *     adb -k /dev/ksyms /dev/mem <cr>, then type
                     55:  *     cbqtrace_count/D to get the count, then type
                     56:  *     cbqtrace_buffer,0tcount/Dp4C" "Xn
                     57:  *     This will dump the trace buffer from 0 to count.
                     58:  */
                     59: /*
                     60:  * in ALTQ, "call cbqtrace_dump(N)" from DDB to display 20 events
                     61:  * from Nth event in the circular buffer.
                     62:  */
                     63:
                     64: struct cbqtrace {
                     65:        int count;
                     66:        int function;           /* address of function */
                     67:        int trace_action;       /* descriptive 4 characters */
                     68:        int object;             /* object operated on */
                     69: };
                     70:
                     71: extern struct cbqtrace cbqtrace_buffer[];
                     72: extern struct cbqtrace *cbqtrace_ptr;
                     73: extern int cbqtrace_count;
                     74:
                     75: #define        CBQTRACEINIT() {                                \
                     76:        if (cbqtrace_ptr == NULL)               \
                     77:                cbqtrace_ptr = cbqtrace_buffer; \
                     78:        else { \
                     79:                cbqtrace_ptr = cbqtrace_buffer; \
                     80:                bzero((void *)cbqtrace_ptr, sizeof(cbqtrace_buffer)); \
                     81:                cbqtrace_count = 0; \
                     82:        } \
                     83: }
                     84:
                     85: #define        LOCK_TRACE()    splnet()
                     86: #define        UNLOCK_TRACE(x) splx(x)
                     87:
                     88: #define        CBQTRACE(func, act, obj) {              \
                     89:        int __s = LOCK_TRACE();                 \
                     90:        int *_p = &cbqtrace_ptr->count; \
                     91:        *_p++ = ++cbqtrace_count;               \
                     92:        *_p++ = (int)(func);                    \
                     93:        *_p++ = (int)(act);                     \
                     94:        *_p++ = (int)(obj);                     \
                     95:        if ((struct cbqtrace *)(void *)_p >= &cbqtrace_buffer[NCBQTRACE])\
                     96:                cbqtrace_ptr = cbqtrace_buffer; \
                     97:        else                                    \
                     98:                cbqtrace_ptr = (struct cbqtrace *)(void *)_p; \
                     99:        UNLOCK_TRACE(__s);                      \
                    100:        }
                    101: #else
                    102:
                    103: /* If no tracing, define no-ops */
                    104: #define        CBQTRACEINIT()
                    105: #define        CBQTRACE(a, b, c)
                    106:
                    107: #endif /* !CBQ_TRACE */
                    108:
                    109: #ifdef __cplusplus
                    110: }
                    111: #endif
                    112:
                    113: #endif /* _ALTQ_ALTQ_RMCLASS_DEBUG_H_ */

CVSweb