mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
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.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user