summaryrefslogtreecommitdiff
path: root/mysys/my_likely.c
diff options
context:
space:
mode:
authorMichael Widenius <monty@mariadb.org>2018-04-17 00:08:03 +0300
committerMonty <monty@mariadb.org>2018-05-07 00:07:33 +0300
commit70c1110a29a430b26990861cb753843bb00198dc (patch)
treed50bf894a520c2086ddd8bd2713432622000f247 /mysys/my_likely.c
parent9d6dc39ad9a6c1b0a9dd373607fa1a2f9a24c335 (diff)
downloadmariadb-git-70c1110a29a430b26990861cb753843bb00198dc.tar.gz
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.
Diffstat (limited to 'mysys/my_likely.c')
-rw-r--r--mysys/my_likely.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mysys/my_likely.c b/mysys/my_likely.c
index 9b32c65d6a0..c6fca5b7146 100644
--- a/mysys/my_likely.c
+++ b/mysys/my_likely.c
@@ -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,