Commit 70c1110a authored by Michael Widenius's avatar Michael Widenius Committed by Monty

Optimize performance schema likely/unlikely

Performance schema likely/unlikely assume that performance schema
is enabled by default, which causes a performance degradation for
default installations that doesn't have performance schema enabled.

Fixed by changing the likely/unlikely in PS to assume it's
not enabled. This can be changed by compiling with
-DPSI_ON_BY_DEFAULT

Other changes:
- Added psi_likely/psi_unlikely that is depending on
  PSI_ON_BY_DEFAULT. psi_likely() is assumed to be true
  if PS is enabled.
- Added likely/unlikely to some PS interface code.
- Moved pfs_enabled to mysys (was initialized but not used before)
- Added "if (pfs_likely(pfs_enabled))" around calls to PS to avoid
  an extra call if PS is not enabled.
- Moved checking flag_global_instrumention before other flags
  to speed up the case when PS is not enabled.
parent 9d6dc39a
This diff is collapsed.
......@@ -82,7 +82,7 @@ inline_mysql_start_idle_wait(PSI_idle_locker_state *state,
static inline void
inline_mysql_end_idle_wait(struct PSI_idle_locker *locker)
{
if (likely(locker != NULL))
if (psi_likely(locker != NULL))
PSI_IDLE_CALL(end_idle_wait)(locker);
}
#endif
......
......@@ -245,7 +245,7 @@ inline_mysql_start_socket_wait(PSI_socket_locker_state *state,
const char *src_file, uint src_line)
{
struct PSI_socket_locker *locker;
if (mysql_socket.m_psi != NULL)
if (psi_likely(mysql_socket.m_psi != NULL))
{
locker= PSI_SOCKET_CALL(start_socket_wait)
(state, mysql_socket.m_psi, op, byte_count, src_file, src_line);
......@@ -262,7 +262,7 @@ inline_mysql_start_socket_wait(PSI_socket_locker_state *state,
static inline void
inline_mysql_end_socket_wait(struct PSI_socket_locker *locker, size_t byte_count)
{
if (locker != NULL)
if (psi_likely(locker != NULL))
PSI_SOCKET_CALL(end_socket_wait)(locker, byte_count);
}
......@@ -577,7 +577,7 @@ inline_mysql_socket_bind
int result;
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi != NULL)
if (psi_likely(mysql_socket.m_psi != NULL))
{
/* Instrumentation start */
PSI_socket_locker_state state;
......@@ -617,7 +617,7 @@ inline_mysql_socket_getsockname
int result;
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi != NULL)
if (psi_likely(mysql_socket.m_psi != NULL))
{
/* Instrumentation start */
PSI_socket_locker *locker;
......@@ -655,7 +655,7 @@ inline_mysql_socket_connect
int result;
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi != NULL)
if (psi_likely(mysql_socket.m_psi != NULL))
{
/* Instrumentation start */
PSI_socket_locker *locker;
......@@ -693,7 +693,7 @@ inline_mysql_socket_getpeername
int result;
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi != NULL)
if (psi_likely(mysql_socket.m_psi != NULL))
{
/* Instrumentation start */
PSI_socket_locker *locker;
......@@ -731,7 +731,7 @@ inline_mysql_socket_send
ssize_t result;
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi != NULL)
if (psi_likely(mysql_socket.m_psi != NULL))
{
/* Instrumentation start */
PSI_socket_locker *locker;
......@@ -772,7 +772,7 @@ inline_mysql_socket_recv
ssize_t result;
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi != NULL)
if (psi_likely(mysql_socket.m_psi != NULL))
{
/* Instrumentation start */
PSI_socket_locker *locker;
......@@ -813,7 +813,7 @@ inline_mysql_socket_sendto
ssize_t result;
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi != NULL)
if (psi_likely(mysql_socket.m_psi != NULL))
{
/* Instrumentation start */
PSI_socket_locker *locker;
......@@ -855,7 +855,7 @@ inline_mysql_socket_recvfrom
ssize_t result;
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi != NULL)
if (psi_likely(mysql_socket.m_psi != NULL))
{
/* Instrumentation start */
PSI_socket_locker *locker;
......@@ -896,7 +896,7 @@ inline_mysql_socket_getsockopt
int result;
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi != NULL)
if (psi_likely(mysql_socket.m_psi != NULL))
{
/* Instrumentation start */
PSI_socket_locker *locker;
......@@ -935,7 +935,7 @@ inline_mysql_socket_setsockopt
int result;
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi)
if (psi_likely(mysql_socket.m_psi))
{
/* Instrumentation start */
PSI_socket_locker *locker;
......@@ -973,7 +973,7 @@ inline_mysql_socket_listen
int result;
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi != NULL)
if (psi_likely(mysql_socket.m_psi != NULL))
{
/* Instrumentation start */
PSI_socket_locker *locker;
......@@ -1087,7 +1087,7 @@ inline_mysql_socket_close
int result;
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi != NULL)
if (psi_likely(mysql_socket.m_psi != NULL))
{
/* Instrumentation start */
PSI_socket_locker *locker;
......@@ -1142,7 +1142,7 @@ inline_mysql_socket_shutdown
/* Instrumentation start */
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi != NULL)
if (psi_likely(mysql_socket.m_psi != NULL))
{
PSI_socket_locker *locker;
PSI_socket_locker_state state;
......
......@@ -127,7 +127,7 @@ inline_mysql_digest_start(PSI_statement_locker *locker)
{
PSI_digest_locker* digest_locker= NULL;
if (likely(locker != NULL))
if (psi_likely(locker != NULL))
digest_locker= PSI_DIGEST_CALL(digest_start)(locker);
return digest_locker;
}
......@@ -137,7 +137,7 @@ inline_mysql_digest_start(PSI_statement_locker *locker)
static inline void
inline_mysql_digest_end(PSI_digest_locker *locker, const sql_digest_storage *digest)
{
if (likely(locker != NULL))
if (psi_likely(locker != NULL))
PSI_DIGEST_CALL(digest_end)(locker, digest);
}
#endif
......@@ -151,7 +151,7 @@ inline_mysql_start_statement(PSI_statement_locker_state *state,
{
PSI_statement_locker *locker;
locker= PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset);
if (likely(locker != NULL))
if (psi_likely(locker != NULL))
PSI_STATEMENT_CALL(start_statement)(locker, db, (uint)db_len, src_file, src_line);
return locker;
}
......@@ -160,7 +160,7 @@ static inline struct PSI_statement_locker *
inline_mysql_refine_statement(PSI_statement_locker *locker,
PSI_statement_key key)
{
if (likely(locker != NULL))
if (psi_likely(locker != NULL))
{
locker= PSI_STATEMENT_CALL(refine_statement)(locker, key);
}
......@@ -171,7 +171,7 @@ static inline void
inline_mysql_set_statement_text(PSI_statement_locker *locker,
const char *text, uint text_len)
{
if (likely(locker != NULL))
if (psi_likely(locker != NULL))
{
PSI_STATEMENT_CALL(set_statement_text)(locker, text, text_len);
}
......@@ -181,7 +181,7 @@ static inline void
inline_mysql_set_statement_lock_time(PSI_statement_locker *locker,
ulonglong count)
{
if (likely(locker != NULL))
if (psi_likely(locker != NULL))
{
PSI_STATEMENT_CALL(set_statement_lock_time)(locker, count);
}
......@@ -191,7 +191,7 @@ static inline void
inline_mysql_set_statement_rows_sent(PSI_statement_locker *locker,
ulonglong count)
{
if (likely(locker != NULL))
if (psi_likely(locker != NULL))
{
PSI_STATEMENT_CALL(set_statement_rows_sent)(locker, count);
}
......@@ -201,7 +201,7 @@ static inline void
inline_mysql_set_statement_rows_examined(PSI_statement_locker *locker,
ulonglong count)
{
if (likely(locker != NULL))
if (psi_likely(locker != NULL))
{
PSI_STATEMENT_CALL(set_statement_rows_examined)(locker, count);
}
......@@ -212,7 +212,7 @@ inline_mysql_end_statement(struct PSI_statement_locker *locker,
Diagnostics_area *stmt_da)
{
PSI_STAGE_CALL(end_stage)();
if (likely(locker != NULL))
if (psi_likely(locker != NULL))
PSI_STATEMENT_CALL(end_statement)(locker, stmt_da);
}
#endif
......
......@@ -87,7 +87,7 @@
#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD) \
{ \
if (PSI != NULL) \
if (psi_likely(PSI != NULL)) \
{ \
PSI_table_locker *locker; \
PSI_table_locker_state state; \
......@@ -120,7 +120,7 @@
#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_TABLE_LOCK_WAIT(PSI, OP, FLAGS, PAYLOAD) \
{ \
if (PSI != NULL) \
if (psi_likely(PSI != NULL)) \
{ \
PSI_table_locker *locker; \
PSI_table_locker_state state; \
......@@ -186,7 +186,7 @@ inline_mysql_start_table_lock_wait(PSI_table_locker_state *state,
enum PSI_table_lock_operation op,
ulong flags, const char *src_file, uint src_line)
{
if (psi != NULL)
if (psi_likely(psi != NULL))
{
struct PSI_table_locker *locker;
locker= PSI_TABLE_CALL(start_table_lock_wait)
......@@ -203,7 +203,7 @@ inline_mysql_start_table_lock_wait(PSI_table_locker_state *state,
static inline void
inline_mysql_end_table_lock_wait(struct PSI_table_locker *locker)
{
if (locker != NULL)
if (psi_likely(locker != NULL))
PSI_TABLE_CALL(end_table_lock_wait)(locker);
}
#endif
......
......@@ -682,7 +682,7 @@ static inline int inline_mysql_mutex_lock(
int result;
#ifdef HAVE_PSI_MUTEX_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
{
/* Instrumentation start */
PSI_mutex_locker *locker;
......@@ -725,7 +725,7 @@ static inline int inline_mysql_mutex_trylock(
int result;
#ifdef HAVE_PSI_MUTEX_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
{
/* Instrumentation start */
PSI_mutex_locker *locker;
......@@ -768,7 +768,7 @@ static inline int inline_mysql_mutex_unlock(
int result;
#ifdef HAVE_PSI_MUTEX_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
PSI_MUTEX_CALL(unlock_mutex)(that->m_psi);
#endif
......@@ -835,7 +835,7 @@ static inline int inline_mysql_rwlock_destroy(
mysql_rwlock_t *that)
{
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
{
PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi);
that->m_psi= NULL;
......@@ -849,7 +849,7 @@ static inline int inline_mysql_prlock_destroy(
mysql_prlock_t *that)
{
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
{
PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi);
that->m_psi= NULL;
......@@ -869,7 +869,7 @@ static inline int inline_mysql_rwlock_rdlock(
int result;
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
{
/* Instrumentation start */
PSI_rwlock_locker *locker;
......@@ -905,7 +905,7 @@ static inline int inline_mysql_prlock_rdlock(
int result;
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
{
/* Instrumentation start */
PSI_rwlock_locker *locker;
......@@ -941,7 +941,7 @@ static inline int inline_mysql_rwlock_wrlock(
int result;
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
{
/* Instrumentation start */
PSI_rwlock_locker *locker;
......@@ -977,7 +977,7 @@ static inline int inline_mysql_prlock_wrlock(
int result;
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
{
/* Instrumentation start */
PSI_rwlock_locker *locker;
......@@ -1013,7 +1013,7 @@ static inline int inline_mysql_rwlock_tryrdlock(
int result;
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
{
/* Instrumentation start */
PSI_rwlock_locker *locker;
......@@ -1048,7 +1048,7 @@ static inline int inline_mysql_rwlock_trywrlock(
int result;
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
{
/* Instrumentation start */
PSI_rwlock_locker *locker;
......@@ -1078,7 +1078,7 @@ static inline int inline_mysql_rwlock_unlock(
{
int result;
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi);
#endif
result= rw_unlock(&that->m_rwlock);
......@@ -1091,7 +1091,7 @@ static inline int inline_mysql_prlock_unlock(
{
int result;
#ifdef HAVE_PSI_RWLOCK_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi);
#endif
result= rw_pr_unlock(&that->m_prlock);
......@@ -1135,7 +1135,7 @@ static inline int inline_mysql_cond_destroy(
mysql_cond_t *that)
{
#ifdef HAVE_PSI_COND_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
{
PSI_COND_CALL(destroy_cond)(that->m_psi);
that->m_psi= NULL;
......@@ -1155,7 +1155,7 @@ static inline int inline_mysql_cond_wait(
int result;
#ifdef HAVE_PSI_COND_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
{
/* Instrumentation start */
PSI_cond_locker *locker;
......@@ -1192,7 +1192,7 @@ static inline int inline_mysql_cond_timedwait(
int result;
#ifdef HAVE_PSI_COND_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
{
/* Instrumentation start */
PSI_cond_locker *locker;
......@@ -1204,7 +1204,7 @@ static inline int inline_mysql_cond_timedwait(
result= my_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime);
/* Instrumentation end */
if (locker != NULL)
if (psi_likely(locker != NULL))
PSI_COND_CALL(end_cond_wait)(locker, result);
return result;
......@@ -1222,7 +1222,7 @@ static inline int inline_mysql_cond_signal(
{
int result;
#ifdef HAVE_PSI_COND_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
PSI_COND_CALL(signal_cond)(that->m_psi);
#endif
result= pthread_cond_signal(&that->m_cond);
......@@ -1234,7 +1234,7 @@ static inline int inline_mysql_cond_broadcast(
{
int result;
#ifdef HAVE_PSI_COND_INTERFACE
if (that->m_psi != NULL)
if (psi_likely(that->m_psi != NULL))
PSI_COND_CALL(broadcast_cond)(that->m_psi);
#endif
result= pthread_cond_broadcast(&that->m_cond);
......
......@@ -40,6 +40,21 @@
#error "You must include my_global.h in the code for the build to be correct."
#endif
/*
If PSI_ON_BY_DFAULT is defined, assume PSI will be enabled by default and
optimize jumps testing for PSI this case. If not, optimize the binary for
that PSI is not enabled
*/
#ifdef PSI_ON_BY_DEFAULT
#define psi_likely(A) likely(A)
#define psi_unlikely(A) unlikely(A)
#else
#define psi_likely(A) unlikely(A)
#define psi_unlikely(A) likely(A)
#endif
C_MODE_START
struct TABLE_SHARE;
......@@ -2346,6 +2361,7 @@ typedef struct PSI_stage_info_none PSI_stage_info;
#endif /* HAVE_PSI_INTERFACE */
extern MYSQL_PLUGIN_IMPORT my_bool pfs_enabled;
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
/*
......
......@@ -616,5 +616,6 @@ typedef struct PSI_file_locker_state_v1 PSI_file_locker_state;
typedef struct PSI_table_locker_state_v1 PSI_table_locker_state;
typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state;
typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state;
extern MYSQL_PLUGIN_IMPORT my_bool pfs_enabled;
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
C_MODE_END
......@@ -209,5 +209,6 @@ typedef struct PSI_file_locker_state_v2 PSI_file_locker_state;
typedef struct PSI_table_locker_state_v2 PSI_table_locker_state;
typedef struct PSI_statement_locker_state_v2 PSI_statement_locker_state;
typedef struct PSI_socket_locker_state_v2 PSI_socket_locker_state;
extern MYSQL_PLUGIN_IMPORT my_bool pfs_enabled;
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
C_MODE_END
......@@ -227,7 +227,7 @@ int logger_printf(LOGGER_HANDLE *log, const char *fmt, ...)
void logger_init_mutexes()
{
#ifdef HAVE_PSI_INTERFACE
if (PSI_server)
if (unlikely(PSI_server))
PSI_server->register_mutex("sql_logger", mutex_list, 1);
#endif
}
......
......@@ -121,14 +121,14 @@ static LIKELY_ENTRY *my_likely_find(const char *file_name, uint line)
{
char key[80], *pos;
LIKELY_ENTRY *entry;
uint length;
size_t length;
if (!likely_inited)
return 0;
pos= strnmov(key, file_name, sizeof(key)-4);
int3store(pos+1, line);
length= (pos-key)+4;
length= (size_t) (pos-key)+4;
pthread_mutex_lock(&likely_mutex);
if (!(entry= (LIKELY_ENTRY*) my_hash_search(&likely_hash, (uchar*) key,
......
......@@ -763,6 +763,13 @@ struct PSI_bootstrap *PSI_hook= NULL;
PSI *PSI_server= & PSI_noop;
/**
Global performance schema flag.
Indicate if the performance schema is enabled.
This flag is set at startup, and never changes.
*/
my_bool pfs_enabled= FALSE;
void set_psi_server(PSI *psi)
{
PSI_server= psi;
......
......@@ -1615,6 +1615,14 @@ open_table_v1(PSI_table_share *share, const void *identity)
{
PFS_table_share *pfs_table_share= reinterpret_cast<PFS_table_share*> (share);
/*
When the performance schema is off, do not instrument anything.
Table handles have short life cycle, instrumentation will happen
again if needed during the next open().
*/
if (psi_unlikely(! flag_global_instrumentation))
return NULL;
if (unlikely(pfs_table_share == NULL))
return NULL;
......@@ -1626,14 +1634,6 @@ open_table_v1(PSI_table_share *share, const void *identity)
if (! global_table_io_class.m_enabled && ! global_table_lock_class.m_enabled)
return NULL;
/*
When the performance schema is off, do not instrument anything.
Table handles have short life cycle, instrumentation will happen
again if needed during the next open().
*/
if (! flag_global_instrumentation)
return NULL;
PFS_thread *thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
if (unlikely(thread == NULL))
return NULL;
......@@ -1668,22 +1668,22 @@ rebind_table_v1(PSI_table_share *share, const void *identity, PSI_table *table)
PFS_thread *thread;
DBUG_ASSERT(pfs->m_thread_owner == NULL);
/* The table handle was already instrumented, reuse it for this thread. */
thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
if (unlikely(! pfs->m_share->m_enabled))
if (psi_unlikely(! flag_global_instrumentation))
{
destroy_table(pfs);
return NULL;
}
if (unlikely(! global_table_io_class.m_enabled && ! global_table_lock_class.m_enabled))
/* The table handle was already instrumented, reuse it for this thread. */
thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
if (unlikely(! pfs->m_share->m_enabled))
{
destroy_table(pfs);
return NULL;
}
if (unlikely(! flag_global_instrumentation))
if (unlikely(! global_table_io_class.m_enabled && ! global_table_lock_class.m_enabled))
{
destroy_table(pfs);
return NULL;
......@@ -1693,6 +1693,9 @@ rebind_table_v1(PSI_table_share *share, const void *identity, PSI_table *table)
return table;
}
if (psi_unlikely(! flag_global_instrumentation))
return NULL;
/* See open_table_v1() */
PFS_table_share *pfs_table_share= reinterpret_cast<PFS_table_share*> (share);
......@@ -1706,9 +1709,6 @@ rebind_table_v1(PSI_table_share *share, const void *identity, PSI_table *table)
if (! global_table_io_class.m_enabled && ! global_table_lock_class.m_enabled)
return NULL;
if (! flag_global_instrumentation)
return NULL;
PFS_thread *thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
if (unlikely(thread == NULL))
return NULL;
......@@ -1760,7 +1760,7 @@ static void destroy_socket_v1(PSI_socket *socket)
*/
static void create_file_v1(PSI_file_key key, const char *name, File file)
{
if (! flag_global_instrumentation)
if (psi_unlikely(! flag_global_instrumentation))
return;
int index= (int) file;
if (unlikely(index < 0))
......@@ -2783,7 +2783,7 @@ get_thread_file_name_locker_v1(PSI_file_locker_state *state,
DBUG_ASSERT(static_cast<uint> (op) < array_elements(file_operation_map));
DBUG_ASSERT(state != NULL);
if (! flag_global_instrumentation)
if (psi_unlikely(! flag_global_instrumentation))
return NULL;
PFS_file_class *klass= find_file_class(key);
if (unlikely(klass == NULL))
......@@ -3316,7 +3316,7 @@ start_idle_wait_v1(PSI_idle_locker_state* state, const char *src_file, uint src_
{
DBUG_ASSERT(state != NULL);
if (!flag_global_instrumentation)
if (psi_unlikely(! flag_global_instrumentation))
return NULL;
if (!global_idle_class.m_enabled)
......@@ -4253,7 +4253,7 @@ static void start_stage_v1(PSI_stage_key key, const char *src_file, int src_line
/* Always update column threads.processlist_state. */
pfs_thread->m_stage= key;
if (! flag_global_instrumentation)
if (psi_unlikely(! flag_global_instrumentation))
return;
if (flag_thread_instrumentation && ! pfs_thread->m_enabled)
......@@ -4353,7 +4353,7 @@ static void end_stage_v1()
pfs_thread->m_stage= 0;
if (! flag_global_instrumentation)
if (psi_unlikely(! flag_global_instrumentation))
return;
if (flag_thread_instrumentation && ! pfs_thread->m_enabled)
......@@ -4412,7 +4412,7 @@ get_thread_statement_locker_v1(PSI_statement_locker_state *state,
DBUG_ASSERT(state != NULL);
DBUG_ASSERT(charset != NULL);
if (! flag_global_instrumentation)
if (psi_unlikely(! flag_global_instrumentation))
return NULL;
PFS_statement_class *klass= find_statement_class(key);
if (unlikely(klass == NULL))
......
......@@ -40,13 +40,6 @@
@{
*/
/**
Global performance schema flag.
Indicate if the performance schema is enabled.
This flag is set at startup, and never changes.
*/
my_bool pfs_enabled= TRUE;
/**
PFS_INSTRUMENT option settings array and associated state variable to
serialize access during shutdown.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment