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 | /* Enable prints such as
|
---|
13 | * . send/receive failed due to deadlock or dead source or dead destination
|
---|
14 | * . trap not allowed
|
---|
15 | * . bogus message pointer
|
---|
16 | * . kernel call number not allowed by this process
|
---|
17 | *
|
---|
18 | * Of course the call still fails, but nothing is printed if these warnings
|
---|
19 | * are disabled.
|
---|
20 | */
|
---|
21 | #define DEBUG_ENABLE_IPC_WARNINGS 0
|
---|
22 |
|
---|
23 | /* It's interesting to measure the time spent withing locked regions, because
|
---|
24 | * this is the time that the system is deaf to interrupts.
|
---|
25 | */
|
---|
26 | #if DEBUG_TIME_LOCKS
|
---|
27 |
|
---|
28 | #define TIMING_POINTS 20 /* timing resolution */
|
---|
29 | #define TIMING_CATEGORIES 20
|
---|
30 | #define TIMING_NAME 10
|
---|
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 | /* This check makes sure that the scheduling queues are in a consistent state.
|
---|
55 | * The check is run when the queues are updated with ready() and unready().
|
---|
56 | */
|
---|
57 | #if DEBUG_SCHED_CHECK
|
---|
58 | _PROTOTYPE( void check_runqueues, (char *when) );
|
---|
59 | #endif /* DEBUG_SCHED_CHECK */
|
---|
60 |
|
---|
61 | /* The timing and checking of kernel locking requires a redefine of the lock()
|
---|
62 | * and unlock() macros. That's done here. This redefine requires that this
|
---|
63 | * header is included after the other kernel headers.
|
---|
64 | */
|
---|
65 | #if (DEBUG_TIME_LOCKS || DEBUG_LOCK_CHECK)
|
---|
66 | # undef lock
|
---|
67 | # define lock(c, v) do { reallock(c, v); locktimestart(c, v); } while(0)
|
---|
68 | # undef unlock
|
---|
69 | # define unlock(c) do { locktimeend(c); realunlock(c); } while(0)
|
---|
70 | #endif
|
---|
71 |
|
---|
72 | #endif /* DEBUG_H */
|
---|