7
7
**********************************************************************/
11
12
#if defined(__GNUC__) && (__GNUC__ > 2)
13
14
/* This is used to eliminate compiler warnings */
14
ulint ut_dbg_zero = 0;
15
UNIV_INTERN ulint ut_dbg_zero = 0;
17
18
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
18
19
/* If this is set to TRUE all threads will stop into the next assertion
20
ibool ut_dbg_stop_threads = FALSE;
21
UNIV_INTERN ibool ut_dbg_stop_threads = FALSE;
22
#if !defined(UT_DBG_USE_ABORT)
24
/* This is set to TRUE when on NetWare there happens an InnoDB
25
assertion failure or other fatal error condition that requires an
26
immediate shutdown. */
27
UNIV_INTERN ibool panic_shutdown = FALSE;
28
#elif !defined(UT_DBG_USE_ABORT)
23
29
/* Null pointer used to generate memory trap */
25
ulint* ut_dbg_null_ptr = NULL;
30
UNIV_INTERN ulint* ut_dbg_null_ptr = NULL;
28
33
/*****************************************************************
29
34
Report a failed assertion. */
32
37
ut_dbg_assertion_failed(
33
38
/*====================*/
69
/*****************************************************************
70
Shut down MySQL/InnoDB after assertion failure. */
76
if (!panic_shutdown) {
77
panic_shutdown = TRUE;
78
innobase_shutdown_for_mysql();
82
#else /* __NETWARE__ */
63
83
# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
64
84
/*****************************************************************
65
85
Stop a thread after assertion failure. */
68
88
ut_dbg_stop_thread(
69
89
/*===============*/
75
95
os_thread_sleep(1000000000);
98
#endif /* __NETWARE__ */
100
#ifdef UNIV_COMPILE_TEST_FUNCS
102
#include <sys/types.h>
103
#include <sys/time.h>
104
#include <sys/resource.h>
109
#define timersub(a, b, r) \
111
(r)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
112
(r)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
113
if ((r)->tv_usec < 0) { \
115
(r)->tv_usec += 1000000; \
118
#endif /* timersub */
120
/***********************************************************************
121
Resets a speedo (records the current time in it). */
126
speedo_t* speedo) /* out: speedo */
128
gettimeofday(&speedo->tv, NULL);
130
getrusage(RUSAGE_SELF, &speedo->ru);
133
/***********************************************************************
134
Shows the time elapsed and usage statistics since the last reset of a
140
const speedo_t* speedo) /* in: speedo */
142
struct rusage ru_now;
143
struct timeval tv_now;
144
struct timeval tv_diff;
146
getrusage(RUSAGE_SELF, &ru_now);
148
gettimeofday(&tv_now, NULL);
150
#define PRINT_TIMEVAL(prefix, tvp) \
151
fprintf(stderr, "%s% 5ld.%06ld sec\n", \
152
prefix, (tvp)->tv_sec, (tvp)->tv_usec)
154
timersub(&tv_now, &speedo->tv, &tv_diff);
155
PRINT_TIMEVAL("real", &tv_diff);
157
timersub(&ru_now.ru_utime, &speedo->ru.ru_utime, &tv_diff);
158
PRINT_TIMEVAL("user", &tv_diff);
160
timersub(&ru_now.ru_stime, &speedo->ru.ru_stime, &tv_diff);
161
PRINT_TIMEVAL("sys ", &tv_diff);
164
#endif /* UNIV_COMPILE_TEST_FUNCS */