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/kernel/debug.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 #ifndef DEBUG_H
    2 #define DEBUG_H
    3 
    4 /* This header file defines all debugging constants and macros, and declares
    5  * some variables. Certain debugging features redefine standard constants
    6  * and macros. Therefore, this header file should be included after the
    7  * other kernel headers.
    8  */
    9 
   10 #include "config.h"
   11 
   12 /* It's interesting to measure the time spent withing locked regions, because
   13  * this is the time that the system is deaf to interrupts.
   14  */
   15 #if DEBUG_TIME_LOCKS
   16 
   17 #define TIMING_POINTS           20      /* timing resolution */
   18 #define TIMING_CATEGORIES       20
   19 #define TIMING_NAME             10
   20 
   21 /* Enable prints such as
   22  *  . send/receive failed due to deadlock or dead source or dead destination
   23  *  . trap not allowed
   24  *  . bogus message pointer
   25  *  . kernel call number not allowed by this process
   26  *
   27  * Of course the call still fails, but nothing is printed if these warnings
   28  * are disabled.
   29  */
   30 #define DEBUG_ENABLE_IPC_WARNINGS       0
   31 
   32 /* Definition of the data structure to store lock() timing data. */ 
   33 struct lock_timingdata {
   34         char names[TIMING_NAME];
   35         unsigned long lock_timings[TIMING_POINTS];
   36         unsigned long lock_timings_range[2];
   37         unsigned long binsize, resets, misses, measurements;
   38 };
   39 
   40 /* The data is declared here, but allocated in debug.c. */
   41 extern struct lock_timingdata timingdata[TIMING_CATEGORIES];
   42 
   43 /* Prototypes for the timing functionality. */
   44 _PROTOTYPE( void timer_start, (int cat, char *name) );
   45 _PROTOTYPE( void timer_end, (int cat) );
   46 
   47 #define locktimestart(c, v) timer_start(c, v)
   48 #define locktimeend(c) timer_end(c)
   49 #else
   50 #define locktimestart(c, v)
   51 #define locktimeend(c)
   52 #endif /* DEBUG_TIME_LOCKS */
   53 
   54 /* The locking checks counts relocking situation, which are dangerous because
   55  * the inner lock may unlock the outer one.
   56  */
   57 #if DEBUG_LOCK_CHECK
   58 #define lockcheck if (!(read_cpu_flags() & X86_FLAG_I)) kinfo.relocking++;
   59 #else
   60 #define lockcheck
   61 #endif /* DEBUG_LOCK_CHECK */
   62 
   63 /* This check makes sure that the scheduling queues are in a consistent state.
   64  * The check is run when the queues are updated with ready() and unready().
   65  */ 
   66 #if DEBUG_SCHED_CHECK                                   
   67 _PROTOTYPE( void check_runqueues, (char *when) );
   68 #endif /* DEBUG_SCHED_CHECK */
   69 
   70 /* The timing and checking of kernel locking requires a redefine of the lock()
   71  * and unlock() macros. That's done here. This redefine requires that this 
   72  * header is included after the other kernel headers.
   73  */
   74 #if (DEBUG_TIME_LOCKS || DEBUG_LOCK_CHECK)
   75 #  undef lock
   76 #  define lock(c, v)    do { lockcheck; \
   77         intr_disable(); \
   78         locktimestart(c, v); \
   79         } while(0)
   80 #  undef unlock
   81 #  define unlock(c)     do { locktimeend(c); \
   82         intr_enable();\
   83          } while(0)
   84 #endif
   85 
   86 #endif /* DEBUG_H */

Cache object: 027799a2b3ef53df0845aee7173bd878


[ 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.