The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/ktr.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1996 Berkeley Software Design, Inc. All rights reserved.
    3  *
    4  * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
   10  *    notice, this list of conditions and the following disclaimer in the
   11  *    documentation and/or other materials provided with the distribution.
   12  * 3. Berkeley Software Design Inc's name may not be used to endorse or
   13  *    promote products derived from this software without specific prior
   14  *    written permission.
   15  *
   16  * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND
   17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   19  * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE
   20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   26  * SUCH DAMAGE.
   27  *
   28  *      from BSDI $Id: ktr.h,v 1.10.2.7 2000/03/16 21:44:42 cp Exp $
   29  * $FreeBSD: releng/6.3/sys/sys/ktr.h 173886 2007-11-24 19:45:58Z cvs2svn $
   30  */
   31 
   32 /*
   33  *      Wraparound kernel trace buffer support.
   34  */
   35 
   36 #ifndef _SYS_KTR_H_
   37 #define _SYS_KTR_H_
   38 
   39 /*
   40  * Trace classes
   41  */
   42 #define KTR_GEN         0x00000001              /* General (TR) */
   43 #define KTR_NET         0x00000002              /* Network */
   44 #define KTR_DEV         0x00000004              /* Device driver */
   45 #define KTR_LOCK        0x00000008              /* MP locking */
   46 #define KTR_SMP         0x00000010              /* MP general */
   47 #define KTR_FS          0x00000020              /* Filesystem */
   48 #define KTR_PMAP        0x00000040              /* Pmap tracing */
   49 #define KTR_MALLOC      0x00000080              /* Malloc tracing */
   50 #define KTR_TRAP        0x00000100              /* Trap processing */
   51 #define KTR_INTR        0x00000200              /* Interrupt tracing */
   52 #define KTR_SIG         0x00000400              /* Signal processing */
   53 #define KTR_CLK         0x00000800              /* hardclock verbose */
   54 #define KTR_PROC        0x00001000              /* Process scheduling */
   55 #define KTR_SYSC        0x00002000              /* System call */
   56 #define KTR_INIT        0x00004000              /* System initialization */
   57 #define KTR_KGDB        0x00008000              /* Trace kgdb internals */
   58 #define KTR_IO          0x00010000              /* Upper I/O  */
   59 #define KTR_EVH         0x00020000              /* Eventhandler */
   60 #define KTR_VFS         0x00040000              /* VFS events */
   61 #define KTR_VOP         0x00080000              /* Auto-generated vop events */
   62 #define KTR_VM          0x00100000              /* The virtual memory system */
   63 #define KTR_WITNESS     0x00200000
   64 #define KTR_RUNQ        0x00400000              /* Run queue */
   65 #define KTR_CONTENTION  0x00800000              /* Lock contention */
   66 #define KTR_UMA         0x01000000              /* UMA slab allocator */
   67 #define KTR_CALLOUT     0x02000000              /* Callouts and timeouts */
   68 #define KTR_GEOM        0x04000000              /* GEOM I/O events */
   69 #define KTR_BUSDMA      0x08000000              /* busdma(9) events */
   70 #define KTR_CRITICAL    0x10000000              /* Critical sections */
   71 #define KTR_SCHED       0x20000000              /* Machine parsed sched info. */
   72 #define KTR_BUF         0x40000000              /* Buffer cache */
   73 #define KTR_ALL         0x7fffffff
   74 
   75 /*
   76  * Trace classes which can be assigned to particular use at compile time
   77  * These must remain in high 22 as some assembly code counts on it
   78  */
   79 #define KTR_CT1         0x01000000
   80 #define KTR_CT2         0x02000000
   81 #define KTR_CT3         0x04000000
   82 #define KTR_CT4         0x08000000
   83 #define KTR_CT5         0x10000000
   84 #define KTR_CT6         0x20000000
   85 #define KTR_CT7         0x40000000
   86 #define KTR_CT8         0x80000000
   87 
   88 /* Trace classes to compile in */
   89 #ifdef KTR
   90 #ifndef KTR_COMPILE
   91 #define KTR_COMPILE     (KTR_ALL)
   92 #endif
   93 #else   /* !KTR */
   94 #undef KTR_COMPILE
   95 #define KTR_COMPILE 0
   96 #endif  /* KTR */
   97 
   98 /* Trace classes that can not be used with KTR_ALQ */
   99 #define KTR_ALQ_MASK    (KTR_WITNESS)
  100 
  101 /*
  102  * Version number for ktr_entry struct.  Increment this when you break binary
  103  * compatibility.
  104  */
  105 #define KTR_VERSION     2
  106 
  107 #define KTR_PARMS       6
  108 
  109 #ifndef LOCORE
  110 
  111 struct ktr_entry {
  112         u_int64_t ktr_timestamp;
  113         int     ktr_cpu;
  114         int     ktr_line;
  115         const   char *ktr_file;
  116         const   char *ktr_desc;
  117         struct  thread *ktr_thread;
  118         u_long  ktr_parms[KTR_PARMS];
  119 };
  120 
  121 extern int ktr_cpumask;
  122 extern int ktr_mask;
  123 extern int ktr_entries;
  124 extern int ktr_verbose;
  125 
  126 extern volatile int ktr_idx;
  127 extern struct ktr_entry ktr_buf[];
  128 
  129 #ifdef KTR
  130 
  131 void    ktr_tracepoint(u_int mask, const char *file, int line,
  132             const char *format, u_long arg1, u_long arg2, u_long arg3,
  133             u_long arg4, u_long arg5, u_long arg6);
  134 
  135 #define CTR6(m, format, p1, p2, p3, p4, p5, p6) do {                    \
  136         if (KTR_COMPILE & (m))                                          \
  137                 ktr_tracepoint((m), __FILE__, __LINE__, format,         \
  138                     (u_long)(p1), (u_long)(p2), (u_long)(p3),           \
  139                     (u_long)(p4), (u_long)(p5), (u_long)(p6));          \
  140         } while(0)
  141 #define CTR0(m, format)                 CTR6(m, format, 0, 0, 0, 0, 0, 0)
  142 #define CTR1(m, format, p1)             CTR6(m, format, p1, 0, 0, 0, 0, 0)
  143 #define CTR2(m, format, p1, p2)         CTR6(m, format, p1, p2, 0, 0, 0, 0)
  144 #define CTR3(m, format, p1, p2, p3)     CTR6(m, format, p1, p2, p3, 0, 0, 0)
  145 #define CTR4(m, format, p1, p2, p3, p4) CTR6(m, format, p1, p2, p3, p4, 0, 0)
  146 #define CTR5(m, format, p1, p2, p3, p4, p5)     CTR6(m, format, p1, p2, p3, p4, p5, 0)
  147 #else   /* KTR */
  148 #define CTR0(m, d)
  149 #define CTR1(m, d, p1)
  150 #define CTR2(m, d, p1, p2)
  151 #define CTR3(m, d, p1, p2, p3)
  152 #define CTR4(m, d, p1, p2, p3, p4)
  153 #define CTR5(m, d, p1, p2, p3, p4, p5)
  154 #define CTR6(m, d, p1, p2, p3, p4, p5, p6)
  155 #endif  /* KTR */
  156 
  157 #define TR0(d)                          CTR0(KTR_GEN, d)
  158 #define TR1(d, p1)                      CTR1(KTR_GEN, d, p1)
  159 #define TR2(d, p1, p2)                  CTR2(KTR_GEN, d, p1, p2)
  160 #define TR3(d, p1, p2, p3)              CTR3(KTR_GEN, d, p1, p2, p3)
  161 #define TR4(d, p1, p2, p3, p4)          CTR4(KTR_GEN, d, p1, p2, p3, p4)
  162 #define TR5(d, p1, p2, p3, p4, p5)      CTR5(KTR_GEN, d, p1, p2, p3, p4, p5)
  163 #define TR6(d, p1, p2, p3, p4, p5, p6)  CTR6(KTR_GEN, d, p1, p2, p3, p4, p5, p6)
  164 
  165 /*
  166  * Trace initialization events, similar to CTR with KTR_INIT, but
  167  * completely ifdef'ed out if KTR_INIT isn't in KTR_COMPILE (to
  168  * save string space, the compiler doesn't optimize out strings
  169  * for the conditional ones above).
  170  */
  171 #if (KTR_COMPILE & KTR_INIT) != 0
  172 #define ITR0(d)                         CTR0(KTR_INIT, d)
  173 #define ITR1(d, p1)                     CTR1(KTR_INIT, d, p1)
  174 #define ITR2(d, p1, p2)                 CTR2(KTR_INIT, d, p1, p2)
  175 #define ITR3(d, p1, p2, p3)             CTR3(KTR_INIT, d, p1, p2, p3)
  176 #define ITR4(d, p1, p2, p3, p4)         CTR4(KTR_INIT, d, p1, p2, p3, p4)
  177 #define ITR5(d, p1, p2, p3, p4, p5)     CTR5(KTR_INIT, d, p1, p2, p3, p4, p5)
  178 #define ITR6(d, p1, p2, p3, p4, p5, p6) CTR6(KTR_INIT, d, p1, p2, p3, p4, p5, p6)
  179 #else
  180 #define ITR0(d)
  181 #define ITR1(d, p1)
  182 #define ITR2(d, p1, p2)
  183 #define ITR3(d, p1, p2, p3)
  184 #define ITR4(d, p1, p2, p3, p4)
  185 #define ITR5(d, p1, p2, p3, p4, p5)
  186 #define ITR6(d, p1, p2, p3, p4, p5, p6)
  187 #endif
  188 
  189 #endif /* !LOCORE */
  190 
  191 #endif /* !_SYS_KTR_H_ */

Cache object: bd0ea282d76d0624e04f184ad68bf56b


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.