mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
MDEV-11713 Optimize DBUG_PRINT and introduce DBUG_LOG
MariaDB Server is unnecessarily evaluating the arguments of
DBUG_PRINT() macros when the label is not defined.
The macro DBUG_LOG() for C++ operator<< output which was added for
InnoDB diagnostics in MySQL 5.7 is missing from MariaDB. Unlike the
MySQL 5.7 implementation, MariaDB will avoid allocating and
initializing the output string when the label is not defined.
Introduce DBUG_OUT("crypt") and DBUG_OUT("checksum") for some InnoDB
diagnostics, replacing some use of ib::info().
This commit is contained in:
parent
4e7b382d31
commit
bf35deda09
6 changed files with 77 additions and 88 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates.
|
||||
Copyright (C) 2000-2011 Monty Program Ab
|
||||
Copyright (C) 2000, 2017, MariaDB Corporation Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -50,7 +50,7 @@ extern void _db_set_init_(const char *control);
|
|||
extern void _db_enter_(const char *_func_, const char *_file_, uint _line_,
|
||||
struct _db_stack_frame_ *_stack_frame_);
|
||||
extern void _db_return_(struct _db_stack_frame_ *_stack_frame_);
|
||||
extern void _db_pargs_(uint _line_,const char *keyword);
|
||||
extern int _db_pargs_(uint _line_,const char *keyword);
|
||||
extern void _db_doprnt_(const char *format,...)
|
||||
ATTRIBUTE_FORMAT(printf, 1, 2);
|
||||
extern void _db_dump_(uint _line_,const char *keyword,
|
||||
|
|
@ -91,7 +91,7 @@ extern const char* _db_get_func_(void);
|
|||
#define DBUG_EVALUATE_IF(keyword,a1,a2) \
|
||||
(_db_keyword_(0,(keyword), 1) ? (a1) : (a2))
|
||||
#define DBUG_PRINT(keyword,arglist) \
|
||||
do {_db_pargs_(__LINE__,keyword); _db_doprnt_ arglist;} while(0)
|
||||
do if (_db_pargs_(__LINE__,keyword)) _db_doprnt_ arglist; while(0)
|
||||
#define DBUG_PUSH(a1) _db_push_ (a1)
|
||||
#define DBUG_POP() _db_pop_ ()
|
||||
#define DBUG_SET(a1) _db_set_ (a1)
|
||||
|
|
@ -193,8 +193,18 @@ void debug_sync_point(const char* lock_name, uint lock_timeout);
|
|||
#define DBUG_SYNC_POINT(lock_name,lock_timeout)
|
||||
#endif /* EXTRA_DEBUG */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
# ifdef DBUG_OFF
|
||||
# define DBUG_LOG(keyword, v) do {} while (0)
|
||||
# else
|
||||
# include <sstream>
|
||||
# define DBUG_LOG(keyword, v) do { \
|
||||
if (_db_pargs_(__LINE__, keyword)) { \
|
||||
std::ostringstream _db_s; _db_s << v; \
|
||||
_db_doprnt_("%s", _db_s.str().c_str()); \
|
||||
}} while (0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* _my_dbug_h */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue