remove perf mode in latch & tenant_hook

This commit is contained in:
nroskill
2023-04-11 12:32:47 +08:00
committed by ob-robot
parent 4eaf9b58b0
commit ef5d6e66bb
4 changed files with 1 additions and 43 deletions

View File

@ -180,7 +180,7 @@ void ObMallocAllocator::free(void *ptr)
SANITY_DISABLE_CHECK_RANGE(); // prevent sanity_check_range SANITY_DISABLE_CHECK_RANGE(); // prevent sanity_check_range
// directly free object instead of using tenant allocator. // directly free object instead of using tenant allocator.
ObTenantCtxAllocator::common_free(ptr); ObTenantCtxAllocator::common_free(ptr);
#endif // PERF_MODE #endif // OB_USE_ASAN
} }
ObTenantCtxAllocatorGuard ObMallocAllocator::get_tenant_ctx_allocator_without_tlcache( ObTenantCtxAllocatorGuard ObMallocAllocator::get_tenant_ctx_allocator_without_tlcache(

View File

@ -46,9 +46,7 @@ public:
*/ */
ObLatchMutex::ObLatchMutex() ObLatchMutex::ObLatchMutex()
: lock_() : lock_()
#ifndef PERF_MODE
,record_stat_(true) ,record_stat_(true)
#endif
{ {
} }
@ -573,9 +571,7 @@ void ObLockDiagnose::print()
ObLatch::ObLatch() ObLatch::ObLatch()
: lock_(0) : lock_(0)
#ifndef PERF_MODE
, record_stat_(true) , record_stat_(true)
#endif
{ {
} }

View File

@ -37,7 +37,6 @@ extern bool USE_CO_LATCH;
do { \ do { \
} while(0) } while(0)
#ifndef PERF_MODE
#define TRY_LOCK_RECORD_STAT(latch_id, spin_cnt, ret) \ #define TRY_LOCK_RECORD_STAT(latch_id, spin_cnt, ret) \
do { \ do { \
if (lib::is_diagnose_info_enabled()) { \ if (lib::is_diagnose_info_enabled()) { \
@ -53,11 +52,7 @@ extern bool USE_CO_LATCH;
} \ } \
} \ } \
} while(0) } while(0)
#else
#define TRY_LOCK_RECORD_STAT(latch_id, spin_cnt, ret)
#endif
#ifndef PERF_MODE
#define LOCK_RECORD_STAT(latch_id, waited, spin_cnt, yield_cnt) \ #define LOCK_RECORD_STAT(latch_id, waited, spin_cnt, yield_cnt) \
do { \ do { \
if (lib::is_diagnose_info_enabled()) { \ if (lib::is_diagnose_info_enabled()) { \
@ -81,9 +76,6 @@ extern bool USE_CO_LATCH;
} \ } \
} \ } \
} while(0) } while(0)
#else
#define LOCK_RECORD_STAT(latch_id, waited, spin_cnt, yield_cnt)
#endif
struct ObLatchWaitMode struct ObLatchWaitMode
{ {
@ -111,13 +103,8 @@ public:
inline bool is_locked(); inline bool is_locked();
inline uint32_t get_wid(); inline uint32_t get_wid();
int64_t to_string(char* buf, const int64_t buf_len); int64_t to_string(char* buf, const int64_t buf_len);
#ifndef PERF_MODE
void enable_record_stat(bool enable) { record_stat_ = enable; } void enable_record_stat(bool enable) { record_stat_ = enable; }
bool need_record_stat() const { return record_stat_; } bool need_record_stat() const { return record_stat_; }
#else
void enable_record_stat(bool enable) { UNUSED(enable); }
bool need_record_stat() const { return false; }
#endif
private: private:
OB_INLINE uint64_t low_try_lock(const int64_t max_spin_cnt, const uint32_t lock_value); OB_INLINE uint64_t low_try_lock(const int64_t max_spin_cnt, const uint32_t lock_value);
@ -128,9 +115,7 @@ private:
static const uint32_t WAIT_MASK = 1<<31; static const uint32_t WAIT_MASK = 1<<31;
lib::ObFutex lock_; lib::ObFutex lock_;
//volatile int32_t lock_; //volatile int32_t lock_;
#ifndef PERF_MODE
bool record_stat_; bool record_stat_;
#endif
}; };
class ObLatch; class ObLatch;
@ -239,13 +224,8 @@ public:
inline bool is_wrlocked_by(const uint32_t *puid = NULL) const; inline bool is_wrlocked_by(const uint32_t *puid = NULL) const;
inline uint32_t get_wid() const; inline uint32_t get_wid() const;
int64_t to_string(char* buf, const int64_t buf_len) const; int64_t to_string(char* buf, const int64_t buf_len) const;
#ifndef PERF_MODE
void enable_record_stat(bool enable) { record_stat_ = enable; } void enable_record_stat(bool enable) { record_stat_ = enable; }
bool need_record_stat() const { return record_stat_; } bool need_record_stat() const { return record_stat_; }
#else
void enable_record_stat(bool enable) { UNUSED(enable); }
bool need_record_stat() const { return false; }
#endif
uint32_t val() const { return lock_; } uint32_t val() const { return lock_; }
static thread_local uint32_t* current_lock; static thread_local uint32_t* current_lock;
static thread_local uint32_t* current_wait; static thread_local uint32_t* current_wait;
@ -280,9 +260,7 @@ private:
static const uint32_t WAIT_MASK = 1<<31; static const uint32_t WAIT_MASK = 1<<31;
static const uint32_t MAX_READ_LOCK_CNT = 1<<24; static const uint32_t MAX_READ_LOCK_CNT = 1<<24;
volatile uint32_t lock_; volatile uint32_t lock_;
#ifndef PERF_MODE
bool record_stat_; bool record_stat_;
#endif
}; };
struct ObLDLockType struct ObLDLockType

View File

@ -1,7 +1,6 @@
#ifndef _OCEABASE_TENANT_PRELOAD_H_ #ifndef _OCEABASE_TENANT_PRELOAD_H_
#define _OCEABASE_TENANT_PRELOAD_H_ #define _OCEABASE_TENANT_PRELOAD_H_
#ifndef PERF_MODE
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#include "lib/worker.h" #include "lib/worker.h"
#include <dlfcn.h> #include <dlfcn.h>
@ -140,19 +139,4 @@ int futex_hook(uint32_t *uaddr, int futex_op, uint32_t val, const struct timespe
} /* extern "C" */ } /* extern "C" */
#else
int ob_pthread_cond_wait(pthread_cond_t *__restrict __cond,
pthread_mutex_t *__restrict __mutex)
{
return pthread_cond_wait(__cond, __mutex);
}
int ob_pthread_cond_timedwait(pthread_cond_t *__restrict __cond,
pthread_mutex_t *__restrict __mutex,
const struct timespec *__restrict __abstime)
{
return pthread_cond_timedwait(__cond, __mutex, __abstime);
}
#endif /* PERF_MODE */
#endif /* _OCEABASE_TENANT_PRELOAD_H_ */ #endif /* _OCEABASE_TENANT_PRELOAD_H_ */