summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-08-20 19:33:33 +0300
committerMonty <monty@mariadb.org>2020-08-20 19:34:11 +0300
commit3ef65f27839c0896e28dc37c1d3d3340f571b79c (patch)
treec5b56d7c97ea7f4f3ca9926a73b88ecd231dd6f0
parentb1ba3a199cf00b9e4e39d73710a89a80964b7eef (diff)
downloadmariadb-git-3ef65f27839c0896e28dc37c1d3d3340f571b79c.tar.gz
Added DBUG_PUSH_EMPTY and DBUG_POP_EMPTY to speed up DBUG
-rw-r--r--include/my_dbug.h5
-rw-r--r--mysys/thr_mutex.c4
-rw-r--r--sql/filesort.cc4
3 files changed, 9 insertions, 4 deletions
diff --git a/include/my_dbug.h b/include/my_dbug.h
index f0c74ab485c..fa5b4c126d1 100644
--- a/include/my_dbug.h
+++ b/include/my_dbug.h
@@ -106,6 +106,9 @@ extern int (*dbug_sanity)(void);
(_db_keyword_(0,(keyword), 1) ? (a1) : (a2))
#define DBUG_PRINT(keyword,arglist) \
do if (_db_pargs_(__LINE__,keyword)) _db_doprnt_ arglist; while(0)
+
+#define DBUG_PUSH_EMPTY if (_dbug_on_) { DBUG_PUSH(""); }
+#define DBUG_POP_EMPTY if (_dbug_on_) { DBUG_POP(); }
#define DBUG_PUSH(a1) _db_push_ (a1)
#define DBUG_POP() _db_pop_ ()
#define DBUG_SET(a1) _db_set_ (a1)
@@ -172,6 +175,8 @@ extern void _db_suicide_(void);
#define DBUG_EVALUATE(keyword,a1,a2) (a2)
#define DBUG_EVALUATE_IF(keyword,a1,a2) (a2)
#define DBUG_PRINT(keyword,arglist) do { } while(0)
+#define DBUG_PUSH_EMPTY do { } while(0)
+#define DBUG_POP_EMPTY do { } while(0)
#define DBUG_PUSH(a1) do { } while(0)
#define DBUG_SET(a1) do { } while(0)
#define DBUG_SET_INITIAL(a1) do { } while(0)
diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c
index 9db1e0efabf..2a8e54621c0 100644
--- a/mysys/thr_mutex.c
+++ b/mysys/thr_mutex.c
@@ -233,7 +233,7 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
int error;
DBUG_PRINT("mutex", ("%s (0x%lx) locking", mp->name ? mp->name : "Null",
(ulong) mp));
- DBUG_PUSH("");
+ DBUG_PUSH_EMPTY;
pthread_mutex_lock(&mp->global);
if (!mp->file)
@@ -395,7 +395,7 @@ int safe_mutex_lock(safe_mutex_t *mp, myf my_flags, const char *file,
}
end:
- DBUG_POP();
+ DBUG_POP_EMPTY;
if (!error)
DBUG_PRINT("mutex", ("%s (0x%lx) locked", mp->name, (ulong) mp));
return error;
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 90fbde6f6c8..2ce532308a2 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -215,7 +215,7 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort,
DBUG_EXECUTE("info",TEST_filesort(filesort->sortorder, s_length););
#ifdef SKIP_DBUG_IN_FILESORT
- DBUG_PUSH(""); /* No DBUG here */
+ DBUG_PUSH_EMPTY; /* No DBUG here */
#endif
SORT_INFO *sort;
TABLE_LIST *tab= table->pos_in_table_list;
@@ -493,7 +493,7 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort,
sort->examined_rows= param.examined_rows;
sort->return_rows= num_rows;
#ifdef SKIP_DBUG_IN_FILESORT
- DBUG_POP(); /* Ok to DBUG */
+ DBUG_POP_EMPTY; /* Ok to DBUG */
#endif
DBUG_PRINT("exit",