suricata
threads-profile.h File Reference

Go to the source code of this file.

Data Structures

struct  ProfilingLock_
 

Macros

#define SCMutexLock_profile(mut)
 
#define SCMutex   pthread_mutex_t
 
#define SCMutexAttr   pthread_mutexattr_t
 
#define SCMutexInit(mut, mutattr)   pthread_mutex_init(mut, mutattr)
 
#define SCMutexLock(mut)   SCMutexLock_profile(mut)
 
#define SCMutexTrylock(mut)   pthread_mutex_trylock(mut)
 
#define SCMutexUnlock(mut)   pthread_mutex_unlock(mut)
 
#define SCMutexDestroy   pthread_mutex_destroy
 
#define SCMUTEX_INITIALIZER   PTHREAD_MUTEX_INITIALIZER
 
#define SCCondT   pthread_cond_t
 
#define SCCondInit   pthread_cond_init
 
#define SCCondSignal   pthread_cond_signal
 
#define SCCondDestroy   pthread_cond_destroy
 
#define SCCondWait(cond, mut)   pthread_cond_wait(cond, mut)
 
#define SCSpinLock_profile(spin)
 
#define SCSpinlock   pthread_spinlock_t
 
#define SCSpinLock(mut)   SCSpinLock_profile(mut)
 
#define SCSpinTrylock(spin)   pthread_spin_trylock(spin)
 
#define SCSpinUnlock(spin)   pthread_spin_unlock(spin)
 
#define SCSpinInit(spin, spin_attr)   pthread_spin_init(spin, spin_attr)
 
#define SCSpinDestroy(spin)   pthread_spin_destroy(spin)
 
#define SCRWLockWRLock_profile(mut)
 
#define SCRWLockRDLock_profile(mut)
 
#define SCRWLock   pthread_rwlock_t
 
#define SCRWLockInit(rwl, rwlattr)   pthread_rwlock_init(rwl, rwlattr)
 
#define SCRWLockWRLock(mut)   SCRWLockWRLock_profile(mut)
 
#define SCRWLockRDLock(mut)   SCRWLockRDLock_profile(mut)
 
#define SCRWLockTryWRLock(rwl)   pthread_rwlock_trywrlock(rwl)
 
#define SCRWLockTryRDLock(rwl)   pthread_rwlock_tryrdlock(rwl)
 
#define SCRWLockUnlock(rwl)   pthread_rwlock_unlock(rwl)
 
#define SCRWLockDestroy   pthread_rwlock_destroy
 
#define SCCtrlMutex   pthread_mutex_t
 
#define SCCtrlMutexAttr   pthread_mutexattr_t
 
#define SCCtrlMutexInit(mut, mutattr)   pthread_mutex_init(mut, mutattr)
 
#define SCCtrlMutexLock(mut)   pthread_mutex_lock(mut)
 
#define SCCtrlMutexTrylock(mut)   pthread_mutex_trylock(mut)
 
#define SCCtrlMutexUnlock(mut)   pthread_mutex_unlock(mut)
 
#define SCCtrlMutexDestroy   pthread_mutex_destroy
 
#define SCCtrlCondT   pthread_cond_t
 
#define SCCtrlCondInit   pthread_cond_init
 
#define SCCtrlCondSignal   pthread_cond_signal
 
#define SCCtrlCondTimedwait   pthread_cond_timedwait
 
#define SCCtrlCondWait   pthread_cond_wait
 
#define SCCtrlCondDestroy   pthread_cond_destroy
 

Typedefs

typedef struct ProfilingLock_ ProfilingLock
 

Variables

__thread ProfilingLock locks [PROFILING_MAX_LOCKS]
 
__thread int locks_idx
 
__thread int record_locks
 
__thread uint64_t mutex_lock_contention
 
__thread uint64_t mutex_lock_wait_ticks
 
__thread uint64_t mutex_lock_cnt
 
__thread uint64_t spin_lock_contention
 
__thread uint64_t spin_lock_wait_ticks
 
__thread uint64_t spin_lock_cnt
 
__thread uint64_t rww_lock_contention
 
__thread uint64_t rww_lock_wait_ticks
 
__thread uint64_t rww_lock_cnt
 
__thread uint64_t rwr_lock_contention
 
__thread uint64_t rwr_lock_wait_ticks
 
__thread uint64_t rwr_lock_cnt
 

Detailed Description

Author
Victor Julien victo.nosp@m.r@in.nosp@m.linia.nosp@m.c.ne.nosp@m.t

Lock profiling wrappers

Definition in file threads-profile.h.

Macro Definition Documentation

#define SCCondDestroy   pthread_cond_destroy

Definition at line 90 of file threads-profile.h.

#define SCCondInit   pthread_cond_init

Definition at line 88 of file threads-profile.h.

#define SCCondSignal   pthread_cond_signal

Definition at line 89 of file threads-profile.h.

#define SCCondT   pthread_cond_t

Definition at line 87 of file threads-profile.h.

#define SCCondWait (   cond,
  mut 
)    pthread_cond_wait(cond, mut)

Definition at line 91 of file threads-profile.h.

#define SCCtrlCondDestroy   pthread_cond_destroy

Definition at line 216 of file threads-profile.h.

#define SCCtrlCondInit   pthread_cond_init

Definition at line 212 of file threads-profile.h.

#define SCCtrlCondSignal   pthread_cond_signal

Definition at line 213 of file threads-profile.h.

#define SCCtrlCondT   pthread_cond_t

Definition at line 211 of file threads-profile.h.

#define SCCtrlCondTimedwait   pthread_cond_timedwait

Definition at line 214 of file threads-profile.h.

#define SCCtrlCondWait   pthread_cond_wait

Definition at line 215 of file threads-profile.h.

#define SCCtrlMutex   pthread_mutex_t

Definition at line 202 of file threads-profile.h.

#define SCCtrlMutexAttr   pthread_mutexattr_t

Definition at line 203 of file threads-profile.h.

#define SCCtrlMutexDestroy   pthread_mutex_destroy

Definition at line 208 of file threads-profile.h.

#define SCCtrlMutexInit (   mut,
  mutattr 
)    pthread_mutex_init(mut, mutattr)

Definition at line 204 of file threads-profile.h.

#define SCCtrlMutexLock (   mut)    pthread_mutex_lock(mut)

Definition at line 205 of file threads-profile.h.

#define SCCtrlMutexTrylock (   mut)    pthread_mutex_trylock(mut)

Definition at line 206 of file threads-profile.h.

#define SCCtrlMutexUnlock (   mut)    pthread_mutex_unlock(mut)

Definition at line 207 of file threads-profile.h.

#define SCMutex   pthread_mutex_t

Definition at line 76 of file threads-profile.h.

#define SCMUTEX_INITIALIZER   PTHREAD_MUTEX_INITIALIZER

Definition at line 83 of file threads-profile.h.

#define SCMutexAttr   pthread_mutexattr_t

Definition at line 77 of file threads-profile.h.

#define SCMutexDestroy   pthread_mutex_destroy

Definition at line 82 of file threads-profile.h.

#define SCMutexInit (   mut,
  mutattr 
)    pthread_mutex_init(mut, mutattr)

Definition at line 78 of file threads-profile.h.

#define SCMutexLock (   mut)    SCMutexLock_profile(mut)

Definition at line 79 of file threads-profile.h.

#define SCMutexLock_profile (   mut)
Value:
({ \
int retl = 0; \
int cont = 0; \
uint64_t mutex_lock_start = UtilCpuGetTicks(); \
if (pthread_mutex_trylock((mut)) != 0) { \
cont = 1; \
retl = pthread_mutex_lock(mut); \
} \
uint64_t mutex_lock_end = UtilCpuGetTicks(); \
mutex_lock_wait_ticks += (uint64_t)(mutex_lock_end - mutex_lock_start); \
\
locks[locks_idx].file = (char *)__FILE__; \
locks[locks_idx].func = (char *)__func__; \
locks[locks_idx].line = (int)__LINE__; \
locks[locks_idx].ticks = (uint64_t)(mutex_lock_end - mutex_lock_start); \
} \
retl; \
})
uint64_t UtilCpuGetTicks(void)
Definition: util-cpu.c:183
__thread int record_locks
__thread ProfilingLock locks[PROFILING_MAX_LOCKS]
__thread int locks_idx
__thread uint64_t mutex_lock_wait_ticks
__thread uint64_t mutex_lock_contention
__thread uint64_t mutex_lock_cnt
#define PROFILING_MAX_LOCKS

Definition at line 51 of file threads-profile.h.

#define SCMutexTrylock (   mut)    pthread_mutex_trylock(mut)

Definition at line 80 of file threads-profile.h.

#define SCMutexUnlock (   mut)    pthread_mutex_unlock(mut)

Definition at line 81 of file threads-profile.h.

#define SCRWLock   pthread_rwlock_t

Definition at line 192 of file threads-profile.h.

#define SCRWLockDestroy   pthread_rwlock_destroy

Definition at line 199 of file threads-profile.h.

#define SCRWLockInit (   rwl,
  rwlattr 
)    pthread_rwlock_init(rwl, rwlattr)

Definition at line 193 of file threads-profile.h.

#define SCRWLockRDLock (   mut)    SCRWLockRDLock_profile(mut)

Definition at line 195 of file threads-profile.h.

#define SCRWLockRDLock_profile (   mut)
Value:
({ \
int retl = 0; \
int cont = 0; \
uint64_t rwr_lock_start = UtilCpuGetTicks(); \
if (pthread_rwlock_tryrdlock((mut)) != 0) { \
cont = 1; \
retl = pthread_rwlock_rdlock(mut); \
} \
uint64_t rwr_lock_end = UtilCpuGetTicks(); \
rwr_lock_wait_ticks += (uint64_t)(rwr_lock_end - rwr_lock_start); \
\
locks[locks_idx].file = (char *)__FILE__; \
locks[locks_idx].func = (char *)__func__; \
locks[locks_idx].line = (int)__LINE__; \
locks[locks_idx].ticks = (uint64_t)(rwr_lock_end - rwr_lock_start); \
} \
retl; \
})
uint64_t UtilCpuGetTicks(void)
Definition: util-cpu.c:183
__thread uint64_t rwr_lock_wait_ticks
__thread int record_locks
__thread ProfilingLock locks[PROFILING_MAX_LOCKS]
__thread int locks_idx
__thread uint64_t rwr_lock_cnt
__thread uint64_t rwr_lock_contention
#define PROFILING_MAX_LOCKS

Definition at line 167 of file threads-profile.h.

#define SCRWLockTryRDLock (   rwl)    pthread_rwlock_tryrdlock(rwl)

Definition at line 197 of file threads-profile.h.

#define SCRWLockTryWRLock (   rwl)    pthread_rwlock_trywrlock(rwl)

Definition at line 196 of file threads-profile.h.

#define SCRWLockUnlock (   rwl)    pthread_rwlock_unlock(rwl)

Definition at line 198 of file threads-profile.h.

#define SCRWLockWRLock (   mut)    SCRWLockWRLock_profile(mut)

Definition at line 194 of file threads-profile.h.

#define SCRWLockWRLock_profile (   mut)
Value:
({ \
int retl = 0; \
int cont = 0; \
uint64_t rww_lock_start = UtilCpuGetTicks(); \
if (pthread_rwlock_trywrlock((mut)) != 0) { \
cont = 1; \
retl = pthread_rwlock_wrlock(mut); \
} \
uint64_t rww_lock_end = UtilCpuGetTicks(); \
rww_lock_wait_ticks += (uint64_t)(rww_lock_end - rww_lock_start); \
\
locks[locks_idx].file = (char *)__FILE__; \
locks[locks_idx].func = (char *)__func__; \
locks[locks_idx].line = (int)__LINE__; \
locks[locks_idx].ticks = (uint64_t)(rww_lock_end - rww_lock_start); \
} \
retl; \
})
__thread uint64_t rww_lock_contention
uint64_t UtilCpuGetTicks(void)
Definition: util-cpu.c:183
__thread int record_locks
__thread ProfilingLock locks[PROFILING_MAX_LOCKS]
__thread int locks_idx
__thread uint64_t rww_lock_cnt
__thread uint64_t rww_lock_wait_ticks
#define PROFILING_MAX_LOCKS

Definition at line 138 of file threads-profile.h.

#define SCSpinDestroy (   spin)    pthread_spin_destroy(spin)

Definition at line 130 of file threads-profile.h.

#define SCSpinInit (   spin,
  spin_attr 
)    pthread_spin_init(spin, spin_attr)

Definition at line 129 of file threads-profile.h.

#define SCSpinlock   pthread_spinlock_t

Definition at line 125 of file threads-profile.h.

#define SCSpinLock (   mut)    SCSpinLock_profile(mut)

Definition at line 126 of file threads-profile.h.

#define SCSpinLock_profile (   spin)
Value:
({ \
int retl = 0; \
int cont = 0; \
uint64_t spin_lock_start = UtilCpuGetTicks(); \
if (pthread_spin_trylock((spin)) != 0) { \
cont = 1; \
retl = pthread_spin_lock((spin)); \
} \
uint64_t spin_lock_end = UtilCpuGetTicks(); \
spin_lock_wait_ticks += (uint64_t)(spin_lock_end - spin_lock_start); \
\
locks[locks_idx].file = (char *)__FILE__; \
locks[locks_idx].func = (char *)__func__; \
locks[locks_idx].line = (int)__LINE__; \
locks[locks_idx].ticks = (uint64_t)(spin_lock_end - spin_lock_start); \
} \
retl; \
})
uint64_t UtilCpuGetTicks(void)
Definition: util-cpu.c:183
__thread uint64_t spin_lock_wait_ticks
__thread uint64_t spin_lock_contention
__thread int record_locks
__thread ProfilingLock locks[PROFILING_MAX_LOCKS]
__thread int locks_idx
#define PROFILING_MAX_LOCKS
__thread uint64_t spin_lock_cnt

Definition at line 100 of file threads-profile.h.

#define SCSpinTrylock (   spin)    pthread_spin_trylock(spin)

Definition at line 127 of file threads-profile.h.

#define SCSpinUnlock (   spin)    pthread_spin_unlock(spin)

Definition at line 128 of file threads-profile.h.

Typedef Documentation

typedef struct ProfilingLock_ ProfilingLock

Variable Documentation

__thread int locks_idx
__thread uint64_t mutex_lock_cnt
__thread uint64_t mutex_lock_contention
__thread uint64_t mutex_lock_wait_ticks
__thread int record_locks
__thread uint64_t rwr_lock_cnt
__thread uint64_t rwr_lock_contention
__thread uint64_t rwr_lock_wait_ticks
__thread uint64_t rww_lock_cnt
__thread uint64_t rww_lock_contention
__thread uint64_t rww_lock_wait_ticks
__thread uint64_t spin_lock_cnt
__thread uint64_t spin_lock_contention
__thread uint64_t spin_lock_wait_ticks