Skip to content

Commit

Permalink
Bug#12346211 PERF IMPACT OF PERFORMANCE-SCHEMA WITH DISABLED INSTRUME…
Browse files Browse the repository at this point in the history
…NTS/CONSUMERS

Not a fix.

Instrumentation patch, to help investigations.

The code can now be compiled with the added #defines:
DISABLE_PSI_MUTEX
DISABLE_PSI_RWLOCK
DISABLE_PSI_COND
DISABLE_PSI_FILE
DISABLE_PSI_TABLE
DISABLE_PSI_STAGE
DISABLE_PSI_STATEMENT

to avoid building with a given instrumentation.

For example,
to disable mutexes, add -DDISABLE_PSI_MUTEX to CFLAGS.
  • Loading branch information
marcalff committed Apr 19, 2011
1 parent 74a6b0b commit 9b40d87
Show file tree
Hide file tree
Showing 38 changed files with 561 additions and 395 deletions.
275 changes: 150 additions & 125 deletions include/mysql/psi/mysql_file.h

Large diffs are not rendered by default.

25 changes: 23 additions & 2 deletions include/mysql/psi/mysql_stage.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,36 @@
@{
*/

#ifdef HAVE_PSI_INTERFACE
/**
@def mysql_stage_register(P1, P2, P3)
Stage registration.
*/
#ifdef HAVE_PSI_STAGE_INTERFACE
#define mysql_stage_register(P1, P2, P3) \
inline_mysql_stage_register(P1, P2, P3)
#else
#define mysql_stage_register(P1, P2, P3) \
do {} while (0)
#endif

#ifdef HAVE_PSI_STAGE_INTERFACE
#define MYSQL_SET_STAGE(K, F, L) \
inline_mysql_set_stage(K, F, L)
#else
#define MYSQL_SET_STAGE(K, F, L) \
do {} while (0)
#endif

#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_STAGE_INTERFACE
static inline void inline_mysql_stage_register(
const char *category, PSI_stage_info **info, int count)
{
if (likely(PSI_server != NULL))
PSI_server->register_stage(category, info, count);
}
#endif

#ifdef HAVE_PSI_STAGE_INTERFACE
static inline void
inline_mysql_set_stage(PSI_stage_key key,
const char *src_file, int src_line)
Expand Down
35 changes: 27 additions & 8 deletions include/mysql/psi/mysql_statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,63 +29,82 @@
@{
*/

#ifdef HAVE_PSI_INTERFACE
/**
@def mysql_statement_register(P1, P2, P3)
Statement registration.
*/
#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define mysql_statement_register(P1, P2, P3) \
inline_mysql_statement_register(P1, P2, P3)
#else
#define mysql_statement_register(P1, P2, P3) \
do {} while (0)
#endif

#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN) \
inline_mysql_start_statement(STATE, K, DB, DB_LEN, __FILE__, __LINE__)
#else
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN) \
NULL
#endif

#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_REFINE_STATEMENT(LOCKER, K) \
inline_mysql_refine_statement(LOCKER, K)
#else
#define MYSQL_REFINE_STATEMENT(LOCKER, K) \
NULL
#endif

#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \
inline_mysql_set_statement_text(LOCKER, P1, P2)
#else
#define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \
do {} while (0)
#endif

#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \
inline_mysql_set_statement_lock_time(LOCKER, P1)
#else
#define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \
do {} while (0)
#endif

#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \
inline_mysql_set_statement_rows_sent(LOCKER, P1)
#else
#define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \
do {} while (0)
#endif

#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \
inline_mysql_set_statement_rows_examined(LOCKER, P1)
#else
#define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \
do {} while (0)
#endif

#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_END_STATEMENT(LOCKER, DA) \
inline_mysql_end_statement(LOCKER, DA)
#else
#define MYSQL_END_STATEMENT(LOCKER, DA) \
do {} while (0)
#endif

#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_STATEMENT_INTERFACE
static inline void inline_mysql_statement_register(
const char *category, PSI_statement_info *info, int count)
{
if (likely(PSI_server != NULL))
PSI_server->register_statement(category, info, count);
}

static inline struct PSI_statement_locker *
inline_mysql_start_statement(PSI_statement_locker_state *state,
PSI_statement_key key,
Expand Down
14 changes: 7 additions & 7 deletions include/mysql/psi/mysql_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
@sa MYSQL_START_TABLE_LOCK_WAIT.
@sa MYSQL_END_TABLE_LOCK_WAIT.
*/
#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE) \
struct PSI_table_locker* LOCKER; \
PSI_table_locker_state STATE;
Expand All @@ -61,7 +61,7 @@
@param FLAGS per table operation flags.
@sa MYSQL_END_TABLE_WAIT.
*/
#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_START_TABLE_IO_WAIT(LOCKER, STATE, PSI, OP, INDEX, FLAGS) \
LOCKER= inline_mysql_start_table_io_wait(STATE, PSI, \
OP, INDEX, __FILE__, __LINE__)
Expand All @@ -77,15 +77,15 @@
@param LOCKER the locker
@sa MYSQL_START_TABLE_IO_WAIT.
*/
#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_END_TABLE_IO_WAIT(LOCKER) \
inline_mysql_end_table_io_wait(LOCKER)
#else
#define MYSQL_END_TABLE_IO_WAIT(LOCKER) \
do {} while (0)
#endif

#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_TABLE_INTERFACE
/**
Instrumentation calls for MYSQL_START_TABLE_IO_WAIT.
@sa MYSQL_END_TABLE_IO_WAIT.
Expand Down Expand Up @@ -130,7 +130,7 @@ inline_mysql_end_table_io_wait(struct PSI_table_locker *locker)
@param FLAGS per table operation flags.
@sa MYSQL_END_TABLE_LOCK_WAIT.
*/
#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_START_TABLE_LOCK_WAIT(LOCKER, STATE, PSI, OP, FLAGS) \
LOCKER= inline_mysql_start_table_lock_wait(STATE, PSI, \
OP, FLAGS, __FILE__, __LINE__)
Expand All @@ -146,15 +146,15 @@ inline_mysql_end_table_io_wait(struct PSI_table_locker *locker)
@param LOCKER the locker
@sa MYSQL_START_TABLE_LOCK_WAIT.
*/
#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \
inline_mysql_end_table_lock_wait(LOCKER)
#else
#define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \
do {} while (0)
#endif

#ifdef HAVE_PSI_INTERFACE
#ifdef HAVE_PSI_TABLE_INTERFACE
/**
Instrumentation calls for MYSQL_START_TABLE_LOCK_WAIT.
@sa MYSQL_END_TABLE_LOCK_WAIT.
Expand Down
Loading

0 comments on commit 9b40d87

Please sign in to comment.