MINOR: threads: prepare DEBUG_THREAD to receive more values
We now default the value to zero and make sure all tests properly take care of values above zero. This is in preparation for supporting several degrees of debugging.
This commit is contained in:
parent
aa49965d4e
commit
903a6b14ef
2
Makefile
2
Makefile
@ -261,7 +261,7 @@ endif
|
||||
# without appearing here. Currently defined DEBUG macros include DEBUG_FULL,
|
||||
# DEBUG_MEM_STATS, DEBUG_DONT_SHARE_POOLS, DEBUG_FD, DEBUG_POOL_INTEGRITY,
|
||||
# DEBUG_NO_POOLS, DEBUG_FAIL_ALLOC, DEBUG_STRICT_ACTION=[0-3], DEBUG_HPACK,
|
||||
# DEBUG_AUTH, DEBUG_SPOE, DEBUG_UAF, DEBUG_THREAD, DEBUG_STRICT, DEBUG_DEV,
|
||||
# DEBUG_AUTH, DEBUG_SPOE, DEBUG_UAF, DEBUG_THREAD=0-2, DEBUG_STRICT, DEBUG_DEV,
|
||||
# DEBUG_TASK, DEBUG_MEMORY_POOLS, DEBUG_POOL_TRACING, DEBUG_QPACK, DEBUG_LIST,
|
||||
# DEBUG_COUNTERS=[0-2], DEBUG_STRESS, DEBUG_UNIT.
|
||||
DEBUG =
|
||||
|
@ -594,6 +594,11 @@
|
||||
# define DEBUG_STRICT 1
|
||||
#endif
|
||||
|
||||
/* Let's make DEBUG_THREAD default to 0, and make sure it has a value */
|
||||
#ifndef DEBUG_THREAD
|
||||
# define DEBUG_THREAD 0
|
||||
#endif
|
||||
|
||||
/* Let's make DEBUG_COUNTERS default to 1 to have glitches counters by default */
|
||||
#ifndef DEBUG_COUNTERS
|
||||
# define DEBUG_COUNTERS 1
|
||||
|
@ -41,7 +41,7 @@
|
||||
#define __decl_rwlock(lock)
|
||||
#define __decl_aligned_rwlock(lock)
|
||||
|
||||
#elif !defined(DEBUG_THREAD) && !defined(DEBUG_FULL)
|
||||
#elif (DEBUG_THREAD < 1) && !defined(DEBUG_FULL)
|
||||
|
||||
/************** THREADS ENABLED WITHOUT DEBUGGING **************/
|
||||
|
||||
@ -98,7 +98,7 @@
|
||||
/* When thread debugging is enabled, we remap HA_SPINLOCK_T and HA_RWLOCK_T to
|
||||
* complex structures which embed debugging info.
|
||||
*/
|
||||
#if !defined(DEBUG_THREAD) && !defined(DEBUG_FULL)
|
||||
#if (DEBUG_THREAD < 1) && !defined(DEBUG_FULL)
|
||||
|
||||
#define HA_SPINLOCK_T __HA_SPINLOCK_T
|
||||
#define HA_RWLOCK_T __HA_RWLOCK_T
|
||||
|
@ -305,7 +305,7 @@ static inline unsigned long thread_isolated()
|
||||
return _HA_ATOMIC_LOAD(&isolated_thread) == tid;
|
||||
}
|
||||
|
||||
#if !defined(DEBUG_THREAD) && !defined(DEBUG_FULL)
|
||||
#if (DEBUG_THREAD < 1) && !defined(DEBUG_FULL)
|
||||
|
||||
/* Thread debugging is DISABLED, these are the regular locking functions */
|
||||
|
||||
@ -335,7 +335,7 @@ static inline unsigned long thread_isolated()
|
||||
#define HA_RWLOCK_TRYRDTOSK(lbl,l) (!pl_try_rtos(l)) /* R -?> S */
|
||||
#define HA_RWLOCK_TRYRDTOWR(lbl, l) (!pl_try_rtow(l)) /* R -?> W */
|
||||
|
||||
#else /* !defined(DEBUG_THREAD) && !defined(DEBUG_FULL) */
|
||||
#else /* (DEBUG_THREAD < 1) && !defined(DEBUG_FULL) */
|
||||
|
||||
/* Thread debugging is ENABLED, these are the instrumented functions */
|
||||
|
||||
|
@ -260,7 +260,7 @@ void wait_for_threads_completion()
|
||||
for (i = 1; i < global.nbthread; i++)
|
||||
pthread_join(ha_pthread[i], NULL);
|
||||
|
||||
#if defined(DEBUG_THREAD) || defined(DEBUG_FULL)
|
||||
#if (DEBUG_THREAD > 0) || defined(DEBUG_FULL)
|
||||
show_lock_stats();
|
||||
#endif
|
||||
}
|
||||
@ -392,7 +392,7 @@ static int thread_cpus_enabled()
|
||||
|
||||
/* Below come the lock-debugging functions */
|
||||
|
||||
#if defined(DEBUG_THREAD) || defined(DEBUG_FULL)
|
||||
#if (DEBUG_THREAD > 0) || defined(DEBUG_FULL)
|
||||
|
||||
struct lock_stat lock_stats_rd[LOCK_LABELS] = { };
|
||||
struct lock_stat lock_stats_sk[LOCK_LABELS] = { };
|
||||
@ -1140,7 +1140,7 @@ void __spin_unlock(enum lock_label lbl, struct ha_spinlock *l,
|
||||
HA_ATOMIC_INC(&lock_stats_sk[lbl].num_unlocked);
|
||||
}
|
||||
|
||||
#endif // defined(DEBUG_THREAD) || defined(DEBUG_FULL)
|
||||
#endif // (DEBUG_THREAD > 0) || defined(DEBUG_FULL)
|
||||
|
||||
|
||||
#if defined(USE_PTHREAD_EMULATION)
|
||||
|
Loading…
x
Reference in New Issue
Block a user