From: Marc Alff Date: May 4 2011 11:14am Subject: bzr push into mysql-trunk-pfs-tuning branch (marc.alff:3369 to 3370) List-Archive: http://lists.mysql.com/commits/136634 Message-Id: <201105041114.p44BEZi7015639@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3370 Marc Alff 2011-05-04 PERFORMANCE SCHEMA performance optimization Pre requisite for PSI_CALL(), continued added: storage/perfschema/pfs_api.h modified: include/my_global.h include/my_sys.h include/mysql/psi/mysql_thread.h include/mysql/psi/psi.h mysys/CMakeLists.txt mysys/my_thr_init.c mysys/psi_noop.cc sql/CMakeLists.txt sql/handler.cc sql/mysqld.cc sql/sql_acl.cc sql/sql_base.cc sql/sql_class.cc sql/sql_class.h sql/table.cc storage/innobase/handler/ha_innodb.cc storage/perfschema/pfs.cc storage/perfschema/pfs_events_stages.cc storage/perfschema/pfs_events_statements.cc storage/perfschema/pfs_events_waits.cc storage/perfschema/pfs_instr_class.cc storage/perfschema/pfs_server.cc 3369 Marc Alff 2011-05-03 Fixed the windows link (missing _PSI_hook) modified: mysys/psi_noop.cc === modified file 'include/my_global.h' --- a/include/my_global.h 2011-04-13 19:16:45 +0000 +++ b/include/my_global.h 2011-05-04 11:13:49 +0000 @@ -1488,5 +1488,14 @@ enum loglevel { INFORMATION_LEVEL= 2 }; +#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE +#define USE_PSI_V1 + +/* EXPERIMENTAL, DO NOT USE */ +/* #define PSI_CALL(API) pfs_ ## API ## _v1 */ + +#include +#include <../storage/perfschema/pfs_api.h> +#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */ #endif /* my_global_h */ === modified file 'include/my_sys.h' --- a/include/my_sys.h 2011-03-11 09:35:38 +0000 +++ b/include/my_sys.h 2011-05-04 11:13:49 +0000 @@ -959,6 +959,7 @@ int my_win_translate_command_line_args(c #ifdef HAVE_PSI_INTERFACE extern MYSQL_PLUGIN_IMPORT struct PSI_bootstrap *PSI_hook; +extern void set_psi_server(PSI *psi); void my_init_mysys_psi_keys(void); #endif === modified file 'include/mysql/psi/mysql_thread.h' --- a/include/mysql/psi/mysql_thread.h 2011-05-04 05:02:43 +0000 +++ b/include/mysql/psi/mysql_thread.h 2011-05-04 11:13:49 +0000 @@ -606,6 +606,7 @@ static inline int inline_mysql_mutex_ini #ifdef HAVE_PSI_MUTEX_INTERFACE that->m_psi= PSI_CALL(init_mutex)(key, &that->m_mutex); #else +#warning "not using HAVE_PSI_MUTEX_INTERFACE" that->m_psi= NULL; #endif #ifdef SAFE_MUTEX === modified file 'include/mysql/psi/psi.h' --- a/include/mysql/psi/psi.h 2011-05-04 05:02:43 +0000 +++ b/include/mysql/psi/psi.h 2011-05-04 11:13:49 +0000 @@ -126,6 +126,7 @@ struct PSI_bootstrap @sa DISABLE_PSI_RWLOCK @sa DISABLE_PSI_COND @sa DISABLE_PSI_FILE + @sa DISABLE_PSI_THREAD @sa DISABLE_PSI_TABLE @sa DISABLE_PSI_STAGE @sa DISABLE_PSI_STATEMENT @@ -133,6 +134,8 @@ struct PSI_bootstrap #ifndef DISABLE_PSI_MUTEX #define HAVE_PSI_MUTEX_INTERFACE +#else +#warning "DISABLE_PSI_MUTEX" #endif /** @@ -165,9 +168,14 @@ struct PSI_bootstrap #define HAVE_PSI_FILE_INTERFACE #endif -/* No flag to disable the thread instrumentation. */ - +/** + @def DISABLE_PSI_THREAD + Compiling option to disable the thread instrumentation. + @sa DISABLE_PSI_MUTEX +*/ +#ifndef DISABLE_PSI_THREAD #define HAVE_PSI_THREAD_INTERFACE +#endif /** @def DISABLE_PSI_TABLE @@ -1959,18 +1967,9 @@ typedef struct PSI_stage_info_none PSI_s #endif /* HAVE_PSI_INTERFACE */ +#ifndef PSI_CALL extern MYSQL_PLUGIN_IMPORT PSI *PSI_server; - #define PSI_CALL(API) PSI_server->API - -/* Not implemented yet: static calls for statically compiled code */ -#ifdef LATER -#ifdef USE_PSI_1 -#define PSI_CALL(API) pfs_ ## API ## _v1 -#endif -#ifdef USE_PSI_2 -#define PSI_CALL(API) pfs_ ## API ## _v2 -#endif #endif /** @} */ === modified file 'mysys/CMakeLists.txt' --- a/mysys/CMakeLists.txt 2011-05-03 23:49:32 +0000 +++ b/mysys/CMakeLists.txt 2011-05-04 11:13:49 +0000 @@ -77,3 +77,18 @@ ADD_EXECUTABLE(queues queues.c) TARGET_LINK_LIBRARIES(queues mysys) SET_TARGET_PROPERTIES(queues PROPERTIES COMPILE_FLAGS "-DMAIN") ADD_TEST(queues_test queues) + +##### + +# ADD_DEFINITIONS( -DDISABLE_PSI_MUTEX) +# ADD_DEFINITIONS( -DDISABLE_PSI_RWLOCK) +# ADD_DEFINITIONS( -DDISABLE_PSI_COND) +# ADD_DEFINITIONS( -DDISABLE_PSI_FILE) +# ADD_DEFINITIONS( -DDISABLE_PSI_THREAD) +# ADD_DEFINITIONS( -DDISABLE_PSI_TABLE) +# ADD_DEFINITIONS( -DDISABLE_PSI_STAGE) +# ADD_DEFINITIONS( -DDISABLE_PSI_STATEMENT) +# ADD_CONVENIENCE_LIBRARY(mysys_nopsi ${MYSYS_SOURCES}) +# TARGET_LINK_LIBRARIES(mysys_nopsi dbug strings ${ZLIB_LIBRARY} +# ${LIBNSL} ${LIBM} ${LIBRT}) + === modified file 'mysys/my_thr_init.c' --- a/mysys/my_thr_init.c 2011-04-13 19:16:45 +0000 +++ b/mysys/my_thr_init.c 2011-05-04 11:13:49 +0000 @@ -18,6 +18,7 @@ thread variables. */ +#include "my_global.h" #include "mysys_priv.h" #include #include @@ -376,14 +377,13 @@ void my_thread_end(void) (long) tmp, (long) pthread_self(), tmp ? (long) tmp->id : 0L); #endif -#ifdef HAVE_PSI_INTERFACE +#ifdef HAVE_PSI_THREAD_INTERFACE /* Remove the instrumentation for this thread. This must be done before trashing st_my_thread_var, because the LF_HASH depends on it. */ - if (PSI_server) - PSI_server->delete_current_thread(); + PSI_CALL(delete_current_thread)(); #endif if (tmp && tmp->init) === modified file 'mysys/psi_noop.cc' --- a/mysys/psi_noop.cc 2011-05-04 05:12:55 +0000 +++ b/mysys/psi_noop.cc 2011-05-04 11:13:49 +0000 @@ -616,7 +616,7 @@ static PSI PSI_noop= }; #endif -extern "C" { +C_MODE_START /** Hook for the instrumentation interface. @@ -635,5 +635,10 @@ struct PSI_bootstrap *PSI_hook= NULL; */ PSI *PSI_server= & PSI_noop; +void set_psi_server(PSI *psi) +{ + PSI_server= psi; } +C_MODE_END + === modified file 'sql/CMakeLists.txt' --- a/sql/CMakeLists.txt 2011-04-15 09:04:21 +0000 +++ b/sql/CMakeLists.txt 2011-05-04 11:13:49 +0000 @@ -310,7 +310,7 @@ ADD_CUSTOM_COMMAND( MYSQL_ADD_EXECUTABLE(mysql_tzinfo_to_sql tztime.cc) SET_TARGET_PROPERTIES(mysql_tzinfo_to_sql PROPERTIES COMPILE_FLAGS "-DTZINFO2SQL") -TARGET_LINK_LIBRARIES(mysql_tzinfo_to_sql mysys) +TARGET_LINK_LIBRARIES(mysql_tzinfo_to_sql mysys perfschema) ADD_CUSTOM_TARGET( GenServerSource === modified file 'sql/handler.cc' --- a/sql/handler.cc 2011-04-28 08:28:18 +0000 +++ b/sql/handler.cc 2011-05-04 11:13:49 +0000 @@ -2081,8 +2081,8 @@ int ha_delete_table(THD *thd, handlerton delete file; #ifdef HAVE_PSI_TABLE_INTERFACE - if (likely((error == 0) && (PSI_server != NULL))) - PSI_server->drop_table_share(db, strlen(db), alias, strlen(alias)); + if (likely(error == 0)) + PSI_CALL(drop_table_share)(db, strlen(db), alias, strlen(alias)); #endif DBUG_RETURN(error); @@ -2181,12 +2181,8 @@ int handler::ha_open(TABLE *table_arg, c DBUG_ASSERT(m_psi == NULL); DBUG_ASSERT(table_share != NULL); #ifdef HAVE_PSI_TABLE_INTERFACE - if (likely(PSI_server != NULL)) - { - PSI_table_share *share_psi= ha_table_share_psi(table_share); - if (likely(share_psi != NULL)) - m_psi= PSI_server->open_table(share_psi, this); - } + PSI_table_share *share_psi= ha_table_share_psi(table_share); + m_psi= PSI_CALL(open_table)(share_psi, this); #endif if (table->s->db_options_in_use & HA_OPTION_READ_ONLY_DATA) @@ -2210,11 +2206,8 @@ int handler::ha_open(TABLE *table_arg, c int handler::ha_close(void) { #ifdef HAVE_PSI_TABLE_INTERFACE - if (likely(PSI_server && m_psi)) - { - PSI_server->close_table(m_psi); - m_psi= NULL; /* instrumentation handle, invalid after close_table() */ - } + PSI_CALL(close_table)(m_psi); + m_psi= NULL; /* instrumentation handle, invalid after close_table() */ #endif DBUG_ASSERT(m_psi == NULL); DBUG_ASSERT(m_lock_type == F_UNLCK); @@ -3902,10 +3895,9 @@ int ha_create_table(THD *thd, const char goto err; #ifdef HAVE_PSI_TABLE_INTERFACE - if (likely(PSI_server != NULL)) { my_bool temp= (create_info->options & HA_LEX_CREATE_TMP_TABLE ? TRUE : FALSE); - share.m_psi= PSI_server->get_table_share(temp, &share); + share.m_psi= PSI_CALL(get_table_share)(temp, &share); } #endif === modified file 'sql/mysqld.cc' --- a/sql/mysqld.cc 2011-04-28 16:50:10 +0000 +++ b/sql/mysqld.cc 2011-05-04 11:13:49 +0000 @@ -2078,8 +2078,7 @@ static bool cache_thread() Delete the instrumentation for the job that just completed, before parking this pthread in the cache (blocked on COND_thread_cache). */ - if (likely(PSI_server != NULL)) - PSI_server->delete_current_thread(); + PSI_CALL(delete_current_thread)(); #endif while (!abort_loop && ! wake_thread && ! kill_cached_threads) @@ -2100,13 +2099,10 @@ static bool cache_thread() Create new instrumentation for the new THD job, and attach it to this running pthread. */ - if (likely(PSI_server != NULL)) - { - PSI_thread *psi= PSI_server->new_thread(key_thread_one_connection, - thd, thd->thread_id); - if (likely(psi != NULL)) - PSI_server->set_thread(psi); - } + PSI_thread *psi= PSI_CALL(new_thread)(key_thread_one_connection, + thd, thd->thread_id); + if (likely(psi != NULL)) + PSI_CALL(set_thread)(psi); #endif /* @@ -2736,8 +2732,7 @@ pthread_handler_t signal_hand(void *arg abort_loop=1; // mark abort for threads #ifdef HAVE_PSI_THREAD_INTERFACE /* Delete the instrumentation for the signal thread */ - if (likely(PSI_server != NULL)) - PSI_server->delete_current_thread(); + PSI_CALL(delete_current_thread)(); #endif #ifdef USE_ONE_SIGNAL_HAND pthread_t tmp; @@ -4623,27 +4618,30 @@ int mysqld_main(int argc, char **argv) if available. */ if (PSI_hook) - PSI_server= (PSI*) PSI_hook->get_interface(PSI_CURRENT_VERSION); - - if (PSI_server) { - /* - Now that we have parsed the command line arguments, and have initialized - the performance schema itself, the next step is to register all the - server instruments. - */ - init_server_psi_keys(); - /* Instrument the main thread */ - PSI_thread *psi= PSI_server->new_thread(key_thread_main, NULL, 0); - if (psi) - PSI_server->set_thread(psi); + PSI *psi_server= (PSI*) PSI_hook->get_interface(PSI_CURRENT_VERSION); + if (likely(psi_server != NULL)) + { + set_psi_server(psi_server); - /* - Now that some instrumentation is in place, - recreate objects which were initialised early, - so that they are instrumented as well. - */ - my_thread_global_reinit(); + /* + Now that we have parsed the command line arguments, and have initialized + the performance schema itself, the next step is to register all the + server instruments. + */ + init_server_psi_keys(); + /* Instrument the main thread */ + PSI_thread *psi= PSI_CALL(new_thread)(key_thread_main, NULL, 0); + if (likely(psi != NULL)) + PSI_CALL(set_thread)(psi); + + /* + Now that some instrumentation is in place, + recreate objects which were initialised early, + so that they are instrumented as well. + */ + my_thread_global_reinit(); + } } #endif /* HAVE_PSI_INTERFACE */ @@ -4944,8 +4942,7 @@ int mysqld_main(int argc, char **argv) Disable the main thread instrumentation, to avoid recording events during the shutdown. */ - if (PSI_server) - PSI_server->delete_current_thread(); + PSI_CALL(delete_current_thread)(); #endif /* Wait until cleanup is done */ === modified file 'sql/sql_acl.cc' --- a/sql/sql_acl.cc 2011-04-19 03:29:06 +0000 +++ b/sql/sql_acl.cc 2011-05-04 11:13:49 +0000 @@ -9465,13 +9465,10 @@ acl_authenticate(THD *thd, uint connect_ #endif #ifdef HAVE_PSI_THREAD_INTERFACE - if (likely(PSI_server != NULL)) - { - PSI_server->set_thread_user_host(thd->main_security_ctx.user, - strlen(thd->main_security_ctx.user), - thd->main_security_ctx.host_or_ip, - strlen(thd->main_security_ctx.host_or_ip)); - } + PSI_CALL(set_thread_user_host)(thd->main_security_ctx.user, + strlen(thd->main_security_ctx.user), + thd->main_security_ctx.host_or_ip, + strlen(thd->main_security_ctx.host_or_ip)); #endif /* Ready to handle queries */ === modified file 'sql/sql_base.cc' --- a/sql/sql_base.cc 2011-04-19 03:29:06 +0000 +++ b/sql/sql_base.cc 2011-05-04 11:13:49 +0000 @@ -547,8 +547,9 @@ TABLE_SHARE *get_table_share(THD *thd, T share->ref_count++; // Mark in use #ifdef HAVE_PSI_TABLE_INTERFACE - if (likely(PSI_server != NULL)) - share->m_psi= PSI_server->get_table_share(false, share); + share->m_psi= PSI_CALL(get_table_share)(false, share); +#else + share->m_psi= NULL; #endif DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u", @@ -5894,8 +5895,9 @@ TABLE *open_table_uncached(THD *thd, con } #ifdef HAVE_PSI_TABLE_INTERFACE - if (likely(PSI_server != NULL)) - share->m_psi= PSI_server->get_table_share(true, share); + share->m_psi= PSI_CALL(get_table_share)(true, share); +#else + share->m_psi= NULL; #endif if (open_table_from_share(thd, share, table_name, === modified file 'sql/sql_class.cc' --- a/sql/sql_class.cc 2011-04-26 20:35:24 +0000 +++ b/sql/sql_class.cc 2011-05-04 11:13:49 +0000 @@ -261,8 +261,7 @@ const char *set_thd_proc_info(void *thd_ #endif thd->proc_info= info; #ifdef HAVE_PSI_THREAD_INTERFACE - if (likely(PSI_server != NULL)) - PSI_server->set_thread_state(info); + PSI_CALL(set_thread_state)(info); #endif return old_info; } @@ -3541,8 +3540,7 @@ void THD::inc_status_created_tmp_disk_ta { status_var_increment(status_var.created_tmp_disk_tables); #ifdef HAVE_PSI_STATEMENT_INTERFACE - if (likely(PSI_server && m_statement_psi)) - PSI_server->inc_statement_created_tmp_disk_tables(m_statement_psi, 1); + PSI_CALL(inc_statement_created_tmp_disk_tables)(m_statement_psi, 1); #endif } @@ -3550,8 +3548,7 @@ void THD::inc_status_created_tmp_tables( { status_var_increment(status_var.created_tmp_tables); #ifdef HAVE_PSI_STATEMENT_INTERFACE - if (likely(PSI_server && m_statement_psi)) - PSI_server->inc_statement_created_tmp_tables(m_statement_psi, 1); + PSI_CALL(inc_statement_created_tmp_tables)(m_statement_psi, 1); #endif } @@ -3559,8 +3556,7 @@ void THD::inc_status_select_full_join() { status_var_increment(status_var.select_full_join_count); #ifdef HAVE_PSI_STATEMENT_INTERFACE - if (likely(PSI_server && m_statement_psi)) - PSI_server->inc_statement_select_full_join(m_statement_psi, 1); + PSI_CALL(inc_statement_select_full_join)(m_statement_psi, 1); #endif } @@ -3568,8 +3564,7 @@ void THD::inc_status_select_full_range_j { status_var_increment(status_var.select_full_range_join_count); #ifdef HAVE_PSI_STATEMENT_INTERFACE - if (likely(PSI_server && m_statement_psi)) - PSI_server->inc_statement_select_full_range_join(m_statement_psi, 1); + PSI_CALL(inc_statement_select_full_range_join)(m_statement_psi, 1); #endif } @@ -3577,8 +3572,7 @@ void THD::inc_status_select_range() { status_var_increment(status_var.select_range_count); #ifdef HAVE_PSI_STATEMENT_INTERFACE - if (likely(PSI_server && m_statement_psi)) - PSI_server->inc_statement_select_range(m_statement_psi, 1); + PSI_CALL(inc_statement_select_range)(m_statement_psi, 1); #endif } @@ -3586,8 +3580,7 @@ void THD::inc_status_select_range_check( { status_var_increment(status_var.select_range_check_count); #ifdef HAVE_PSI_STATEMENT_INTERFACE - if (likely(PSI_server && m_statement_psi)) - PSI_server->inc_statement_select_range_check(m_statement_psi, 1); + PSI_CALL(inc_statement_select_range_check)(m_statement_psi, 1); #endif } @@ -3595,8 +3588,7 @@ void THD::inc_status_select_scan() { status_var_increment(status_var.select_scan_count); #ifdef HAVE_PSI_STATEMENT_INTERFACE - if (likely(PSI_server && m_statement_psi)) - PSI_server->inc_statement_select_scan(m_statement_psi, 1); + PSI_CALL(inc_statement_select_scan)(m_statement_psi, 1); #endif } @@ -3604,8 +3596,7 @@ void THD::inc_status_sort_merge_passes() { status_var_increment(status_var.filesort_merge_passes); #ifdef HAVE_PSI_STATEMENT_INTERFACE - if (likely(PSI_server && m_statement_psi)) - PSI_server->inc_statement_sort_merge_passes(m_statement_psi, 1); + PSI_CALL(inc_statement_sort_merge_passes)(m_statement_psi, 1); #endif } @@ -3613,8 +3604,7 @@ void THD::inc_status_sort_range() { status_var_increment(status_var.filesort_range_count); #ifdef HAVE_PSI_STATEMENT_INTERFACE - if (likely(PSI_server && m_statement_psi)) - PSI_server->inc_statement_sort_range(m_statement_psi, 1); + PSI_CALL(inc_statement_sort_range)(m_statement_psi, 1); #endif } @@ -3622,8 +3612,7 @@ void THD::inc_status_sort_rows(ha_rows c { statistic_add(status_var.filesort_rows, count, &LOCK_status); #ifdef HAVE_PSI_STATEMENT_INTERFACE - if (likely(PSI_server && m_statement_psi)) - PSI_server->inc_statement_sort_rows(m_statement_psi, count); + PSI_CALL(inc_statement_sort_rows)(m_statement_psi, count); #endif } @@ -3631,8 +3620,7 @@ void THD::inc_status_sort_scan() { status_var_increment(status_var.filesort_scan_count); #ifdef HAVE_PSI_STATEMENT_INTERFACE - if (likely(PSI_server && m_statement_psi)) - PSI_server->inc_statement_sort_scan(m_statement_psi, 1); + PSI_CALL(inc_statement_sort_scan)(m_statement_psi, 1); #endif } @@ -3640,8 +3628,7 @@ void THD::set_status_no_index_used() { server_status|= SERVER_QUERY_NO_INDEX_USED; #ifdef HAVE_PSI_STATEMENT_INTERFACE - if (likely(PSI_server && m_statement_psi)) - PSI_server->set_statement_no_index_used(m_statement_psi); + PSI_CALL(set_statement_no_index_used)(m_statement_psi); #endif } @@ -3649,8 +3636,7 @@ void THD::set_status_no_good_index_used( { server_status|= SERVER_QUERY_NO_GOOD_INDEX_USED; #ifdef HAVE_PSI_STATEMENT_INTERFACE - if (likely(PSI_server && m_statement_psi)) - PSI_server->set_statement_no_good_index_used(m_statement_psi); + PSI_CALL(set_statement_no_good_index_used)(m_statement_psi); #endif } @@ -3658,8 +3644,7 @@ void THD::set_command(enum enum_server_c { m_command= command; #ifdef HAVE_PSI_THREAD_INTERFACE - if (likely(PSI_server != NULL)) - PSI_server->set_thread_command(m_command); + PSI_CALL(set_thread_command)(m_command); #endif } @@ -3673,8 +3658,7 @@ void THD::set_query(const CSET_STRING &s mysql_mutex_unlock(&LOCK_thd_data); #ifdef HAVE_PSI_THREAD_INTERFACE - if (likely(PSI_server != NULL)) - PSI_server->set_thread_info(query(), query_length()); + PSI_CALL(set_thread_info)(query(), query_length()); #endif } === modified file 'sql/sql_class.h' --- a/sql/sql_class.h 2011-04-15 12:14:35 +0000 +++ b/sql/sql_class.h 2011-05-04 11:13:49 +0000 @@ -2400,26 +2400,23 @@ public: else start_utime= utime_after_lock= my_micro_time_and_time(&start_time); -#ifdef HAVE_PSI_INTERFACE - if (PSI_server) - PSI_server->set_thread_start_time(start_time); +#ifdef HAVE_PSI_THREAD_INTERFACE + PSI_CALL(set_thread_start_time)(start_time); #endif } inline void set_current_time() { start_time= my_time(MY_WME); -#ifdef HAVE_PSI_INTERFACE - if (PSI_server) - PSI_server->set_thread_start_time(start_time); +#ifdef HAVE_PSI_THREAD_INTERFACE + PSI_CALL(set_thread_start_time)(start_time); #endif } inline void set_time(time_t t) { start_time= user_time= t; start_utime= utime_after_lock= my_micro_time(); -#ifdef HAVE_PSI_INTERFACE - if (PSI_server) - PSI_server->set_thread_start_time(start_time); +#ifdef HAVE_PSI_THREAD_INTERFACE + PSI_CALL(set_thread_start_time)(start_time); #endif } /*TODO: this will be obsolete when we have support for 64 bit my_time_t */ @@ -2775,9 +2772,9 @@ public: } db_length= db ? new_db_len : 0; result= new_db && !db; -#ifdef HAVE_PSI_INTERFACE - if (result && PSI_server) - PSI_server->set_thread_db(new_db, new_db_len); +#ifdef HAVE_PSI_THREAD_INTERFACE + if (result) + PSI_CALL(set_thread_db)(new_db, new_db_len); #endif return result; } @@ -2797,9 +2794,8 @@ public: { db= new_db; db_length= new_db_len; -#ifdef HAVE_PSI_INTERFACE - if (PSI_server) - PSI_server->set_thread_db(new_db, new_db_len); +#ifdef HAVE_PSI_THREAD_INTERFACE + PSI_CALL(set_thread_db)(new_db, new_db_len); #endif } /* === modified file 'sql/table.cc' --- a/sql/table.cc 2011-04-26 20:35:24 +0000 +++ b/sql/table.cc 2011-05-04 11:13:49 +0000 @@ -471,8 +471,7 @@ void TABLE_SHARE::destroy() #endif /* WITH_PARTITION_STORAGE_ENGINE */ #ifdef HAVE_PSI_TABLE_INTERFACE - if (likely(PSI_server && m_psi)) - PSI_server->release_table_share(m_psi); + PSI_CALL(release_table_share)(m_psi); #endif /* === modified file 'storage/innobase/handler/ha_innodb.cc' --- a/storage/innobase/handler/ha_innodb.cc 2011-04-28 04:42:06 +0000 +++ b/storage/innobase/handler/ha_innodb.cc 2011-05-04 11:13:49 +0000 @@ -2676,42 +2676,34 @@ innobase_change_buffering_inited_ok: #ifdef HAVE_PSI_INTERFACE /* Register keys with MySQL performance schema */ - if (PSI_server) { - int count; + int count; - count = array_elements(all_pthread_mutexes); + count = array_elements(all_pthread_mutexes); - mysql_mutex_register( - "innodb", all_pthread_mutexes, count); + mysql_mutex_register("innodb", all_pthread_mutexes, count); # ifdef UNIV_PFS_MUTEX - count = array_elements(all_innodb_mutexes); - mysql_mutex_register("innodb", - all_innodb_mutexes, count); + count = array_elements(all_innodb_mutexes); + mysql_mutex_register("innodb", all_innodb_mutexes, count); # endif /* UNIV_PFS_MUTEX */ # ifdef UNIV_PFS_RWLOCK - count = array_elements(all_innodb_rwlocks); - mysql_rwlock_register("innodb", - all_innodb_rwlocks, count); + count = array_elements(all_innodb_rwlocks); + mysql_rwlock_register("innodb", all_innodb_rwlocks, count); # endif /* UNIV_PFS_MUTEX */ # ifdef UNIV_PFS_THREAD - count = array_elements(all_innodb_threads); - mysql_thread_register("innodb", - all_innodb_threads, count); + count = array_elements(all_innodb_threads); + mysql_thread_register("innodb", all_innodb_threads, count); # endif /* UNIV_PFS_THREAD */ # ifdef UNIV_PFS_IO - count = array_elements(all_innodb_files); - mysql_file_register("innodb", - all_innodb_files, count); + count = array_elements(all_innodb_files); + mysql_file_register("innodb", all_innodb_files, count); # endif /* UNIV_PFS_IO */ - count = array_elements(all_innodb_conds); - mysql_cond_register("innodb", - all_innodb_conds, count); - } + count = array_elements(all_innodb_conds); + mysql_cond_register("innodb", all_innodb_conds, count); #endif /* HAVE_PSI_INTERFACE */ /* Since we in this module access directly the fields of a trx === modified file 'storage/perfschema/pfs.cc' --- a/storage/perfschema/pfs.cc 2011-05-04 03:17:46 +0000 +++ b/storage/perfschema/pfs.cc 2011-05-04 11:13:49 +0000 @@ -21,6 +21,7 @@ #include "my_global.h" #include "thr_lock.h" #include "mysql/psi/psi.h" +#include "pfs_api.h" #include "my_pthread.h" #include "sql_const.h" #include "pfs.h" @@ -1181,7 +1182,7 @@ C_MODE_START Implementation of the mutex instrumentation interface. @sa PSI_v1::register_mutex. */ -static void register_mutex_v1(const char *category, +void pfs_register_mutex_v1(const char *category, PSI_mutex_info_v1 *info, int count) { @@ -1194,7 +1195,7 @@ static void register_mutex_v1(const char Implementation of the rwlock instrumentation interface. @sa PSI_v1::register_rwlock. */ -static void register_rwlock_v1(const char *category, +void pfs_register_rwlock_v1(const char *category, PSI_rwlock_info_v1 *info, int count) { @@ -1207,7 +1208,7 @@ static void register_rwlock_v1(const cha Implementation of the cond instrumentation interface. @sa PSI_v1::register_cond. */ -static void register_cond_v1(const char *category, +void pfs_register_cond_v1(const char *category, PSI_cond_info_v1 *info, int count) { @@ -1220,7 +1221,7 @@ static void register_cond_v1(const char Implementation of the thread instrumentation interface. @sa PSI_v1::register_thread. */ -static void register_thread_v1(const char *category, +void pfs_register_thread_v1(const char *category, PSI_thread_info_v1 *info, int count) { @@ -1233,7 +1234,7 @@ static void register_thread_v1(const cha Implementation of the file instrumentation interface. @sa PSI_v1::register_file. */ -static void register_file_v1(const char *category, +void pfs_register_file_v1(const char *category, PSI_file_info_v1 *info, int count) { @@ -1242,7 +1243,7 @@ static void register_file_v1(const char register_file_class) } -static void register_stage_v1(const char *category, +void pfs_register_stage_v1(const char *category, PSI_stage_info_v1 **info_array, int count) { @@ -1285,7 +1286,7 @@ static void register_stage_v1(const char return; } -static void register_statement_v1(const char *category, +void pfs_register_statement_v1(const char *category, PSI_statement_info_v1 *info, int count) { @@ -1339,8 +1340,8 @@ static void register_statement_v1(const Implementation of the mutex instrumentation interface. @sa PSI_v1::init_mutex. */ -static PSI_mutex* -init_mutex_v1(PSI_mutex_key key, const void *identity) +PSI_mutex* +pfs_init_mutex_v1(PSI_mutex_key key, const void *identity) { INIT_BODY_V1(mutex, key, identity); } @@ -1349,7 +1350,7 @@ init_mutex_v1(PSI_mutex_key key, const v Implementation of the mutex instrumentation interface. @sa PSI_v1::destroy_mutex. */ -static void destroy_mutex_v1(PSI_mutex* mutex) +void pfs_destroy_mutex_v1(PSI_mutex* mutex) { PFS_mutex *pfs= reinterpret_cast (mutex); @@ -1363,8 +1364,8 @@ static void destroy_mutex_v1(PSI_mutex* Implementation of the rwlock instrumentation interface. @sa PSI_v1::init_rwlock. */ -static PSI_rwlock* -init_rwlock_v1(PSI_rwlock_key key, const void *identity) +PSI_rwlock* +pfs_init_rwlock_v1(PSI_rwlock_key key, const void *identity) { INIT_BODY_V1(rwlock, key, identity); } @@ -1373,7 +1374,7 @@ init_rwlock_v1(PSI_rwlock_key key, const Implementation of the rwlock instrumentation interface. @sa PSI_v1::destroy_rwlock. */ -static void destroy_rwlock_v1(PSI_rwlock* rwlock) +void pfs_destroy_rwlock_v1(PSI_rwlock* rwlock) { PFS_rwlock *pfs= reinterpret_cast (rwlock); @@ -1387,8 +1388,8 @@ static void destroy_rwlock_v1(PSI_rwlock Implementation of the cond instrumentation interface. @sa PSI_v1::init_cond. */ -static PSI_cond* -init_cond_v1(PSI_cond_key key, const void *identity) +PSI_cond* +pfs_init_cond_v1(PSI_cond_key key, const void *identity) { INIT_BODY_V1(cond, key, identity); } @@ -1397,7 +1398,7 @@ init_cond_v1(PSI_cond_key key, const voi Implementation of the cond instrumentation interface. @sa PSI_v1::destroy_cond. */ -static void destroy_cond_v1(PSI_cond* cond) +void pfs_destroy_cond_v1(PSI_cond* cond) { PFS_cond *pfs= reinterpret_cast (cond); @@ -1411,8 +1412,8 @@ static void destroy_cond_v1(PSI_cond* co Implementation of the table instrumentation interface. @sa PSI_v1::get_table_share. */ -static PSI_table_share* -get_table_share_v1(my_bool temporary, TABLE_SHARE *share) +PSI_table_share* +pfs_get_table_share_v1(my_bool temporary, TABLE_SHARE *share) { /* Do not instrument this table is all table instruments are disabled. */ if (! global_table_io_class.m_enabled && ! global_table_lock_class.m_enabled) @@ -1430,11 +1431,13 @@ get_table_share_v1(my_bool temporary, TA Implementation of the table instrumentation interface. @sa PSI_v1::release_table_share. */ -static void release_table_share_v1(PSI_table_share* share) +void pfs_release_table_share_v1(PSI_table_share* share) { - DBUG_ASSERT(share != NULL); - PFS_table_share* pfs; - pfs= reinterpret_cast (share); + PFS_table_share* pfs= reinterpret_cast (share); + + if (unlikely(pfs == NULL)) + return; + release_table_share(pfs); } @@ -1442,8 +1445,8 @@ static void release_table_share_v1(PSI_t Implementation of the table instrumentation interface. @sa PSI_v1::drop_table_share. */ -static void -drop_table_share_v1(const char *schema_name, int schema_name_length, +void +pfs_drop_table_share_v1(const char *schema_name, int schema_name_length, const char *table_name, int table_name_length) { PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); @@ -1458,11 +1461,14 @@ drop_table_share_v1(const char *schema_n Implementation of the table instrumentation interface. @sa PSI_v1::open_table. */ -static PSI_table* -open_table_v1(PSI_table_share *share, const void *identity) +PSI_table* +pfs_open_table_v1(PSI_table_share *share, const void *identity) { PFS_table_share *pfs_table_share= reinterpret_cast (share); - DBUG_ASSERT(pfs_table_share); + + if (unlikely(pfs_table_share == NULL)) + return NULL; + PFS_thread *thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); if (unlikely(thread == NULL)) return NULL; @@ -1474,10 +1480,13 @@ open_table_v1(PSI_table_share *share, co Implementation of the table instrumentation interface. @sa PSI_v1::close_table. */ -static void close_table_v1(PSI_table *table) +void pfs_close_table_v1(PSI_table *table) { PFS_table *pfs= reinterpret_cast (table); - DBUG_ASSERT(pfs); + + if (unlikely(pfs == NULL)) + return; + pfs->aggregate(); destroy_table(pfs); } @@ -1486,7 +1495,7 @@ static void close_table_v1(PSI_table *ta Implementation of the file instrumentation interface. @sa PSI_v1::create_file. */ -static void create_file_v1(PSI_file_key key, const char *name, File file) +void pfs_create_file_v1(PSI_file_key key, const char *name, File file) { if (! flag_global_instrumentation) return; @@ -1589,7 +1598,7 @@ void* pfs_spawn_thread(void *arg) Implementation of the thread instrumentation interface. @sa PSI_v1::spawn_thread. */ -static int spawn_thread_v1(PSI_thread_key key, +int pfs_spawn_thread_v1(PSI_thread_key key, pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg) { @@ -1617,8 +1626,8 @@ static int spawn_thread_v1(PSI_thread_ke Implementation of the thread instrumentation interface. @sa PSI_v1::new_thread. */ -static PSI_thread* -new_thread_v1(PSI_thread_key key, const void *identity, ulong thread_id) +PSI_thread* +pfs_new_thread_v1(PSI_thread_key key, const void *identity, ulong thread_id) { PFS_thread *pfs; @@ -1635,7 +1644,7 @@ new_thread_v1(PSI_thread_key key, const Implementation of the thread instrumentation interface. @sa PSI_v1::set_thread_id. */ -static void set_thread_id_v1(PSI_thread *thread, unsigned long id) +void pfs_set_thread_id_v1(PSI_thread *thread, unsigned long id) { DBUG_ASSERT(thread); PFS_thread *pfs= reinterpret_cast (thread); @@ -1646,8 +1655,8 @@ static void set_thread_id_v1(PSI_thread Implementation of the thread instrumentation interface. @sa PSI_v1::get_thread_id. */ -static PSI_thread* -get_thread_v1(void) +PSI_thread* +pfs_get_thread_v1(void) { PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); return reinterpret_cast (pfs); @@ -1657,7 +1666,7 @@ get_thread_v1(void) Implementation of the thread instrumentation interface. @sa PSI_v1::set_thread_user. */ -static void set_thread_user_v1(const char *user, int user_len) +void pfs_set_thread_user_v1(const char *user, int user_len) { PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); @@ -1703,7 +1712,7 @@ static void set_thread_user_v1(const cha Implementation of the thread instrumentation interface. @sa PSI_v1::set_thread_user_host. */ -static void set_thread_user_host_v1(const char *user, int user_len, +void pfs_set_thread_user_host_v1(const char *user, int user_len, const char *host, int host_len) { PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); @@ -1754,7 +1763,7 @@ static void set_thread_user_host_v1(cons Implementation of the thread instrumentation interface. @sa PSI_v1::set_thread_db. */ -static void set_thread_db_v1(const char* db, int db_len) +void pfs_set_thread_db_v1(const char* db, int db_len) { PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); @@ -1776,7 +1785,7 @@ static void set_thread_db_v1(const char* Implementation of the thread instrumentation interface. @sa PSI_v1::set_thread_command. */ -static void set_thread_command_v1(int command) +void pfs_set_thread_command_v1(int command) { PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); @@ -1795,7 +1804,7 @@ static void set_thread_command_v1(int co Implementation of the thread instrumentation interface. @sa PSI_v1::set_thread_start_time. */ -static void set_thread_start_time_v1(time_t start_time) +void pfs_set_thread_start_time_v1(time_t start_time) { PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); @@ -1811,7 +1820,7 @@ static void set_thread_start_time_v1(tim Implementation of the thread instrumentation interface. @sa PSI_v1::set_thread_state. */ -static void set_thread_state_v1(const char* state) +void pfs_set_thread_state_v1(const char* state) { PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); @@ -1830,7 +1839,7 @@ static void set_thread_state_v1(const ch Implementation of the thread instrumentation interface. @sa PSI_v1::set_thread_info. */ -static void set_thread_info_v1(const char* info, int info_len) +void pfs_set_thread_info_v1(const char* info, int info_len) { PFS_thread *pfs= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); @@ -1847,7 +1856,7 @@ static void set_thread_info_v1(const cha Implementation of the thread instrumentation interface. @sa PSI_v1::set_thread. */ -static void set_thread_v1(PSI_thread* thread) +void pfs_set_thread_v1(PSI_thread* thread) { PFS_thread *pfs= reinterpret_cast (thread); my_pthread_setspecific_ptr(THR_PFS, pfs); @@ -1857,7 +1866,7 @@ static void set_thread_v1(PSI_thread* th Implementation of the thread instrumentation interface. @sa PSI_v1::delete_current_thread. */ -static void delete_current_thread_v1(void) +void pfs_delete_current_thread_v1(void) { PFS_thread *thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS); if (thread != NULL) @@ -1872,7 +1881,7 @@ static void delete_current_thread_v1(voi Implementation of the thread instrumentation interface. @sa PSI_v1::delete_thread. */ -static void delete_thread_v1(PSI_thread *thread) +void pfs_delete_thread_v1(PSI_thread *thread) { PFS_thread *pfs= reinterpret_cast (thread); @@ -1887,8 +1896,8 @@ static void delete_thread_v1(PSI_thread Implementation of the mutex instrumentation interface. @sa PSI_v1::get_thread_mutex_locker. */ -static PSI_mutex_locker* -get_thread_mutex_locker_v1(PSI_mutex_locker_state *state, +PSI_mutex_locker* +pfs_get_thread_mutex_locker_v1(PSI_mutex_locker_state *state, PSI_mutex *mutex, PSI_mutex_operation op) { DBUG_ASSERT((int) op >= 0); @@ -1979,8 +1988,8 @@ get_thread_mutex_locker_v1(PSI_mutex_loc Implementation of the rwlock instrumentation interface. @sa PSI_v1::get_thread_rwlock_locker. */ -static PSI_rwlock_locker* -get_thread_rwlock_locker_v1(PSI_rwlock_locker_state *state, +PSI_rwlock_locker* +pfs_get_thread_rwlock_locker_v1(PSI_rwlock_locker_state *state, PSI_rwlock *rwlock, PSI_rwlock_operation op) { DBUG_ASSERT(static_cast (op) >= 0); @@ -2071,8 +2080,8 @@ get_thread_rwlock_locker_v1(PSI_rwlock_l Implementation of the cond instrumentation interface. @sa PSI_v1::get_thread_cond_locker. */ -static PSI_cond_locker* -get_thread_cond_locker_v1(PSI_cond_locker_state *state, +PSI_cond_locker* +pfs_get_thread_cond_locker_v1(PSI_cond_locker_state *state, PSI_cond *cond, PSI_mutex *mutex, PSI_cond_operation op) { @@ -2222,8 +2231,8 @@ static inline PFS_TL_LOCK_TYPE external_ Implementation of the table instrumentation interface. @sa PSI_v1::get_thread_table_io_locker. */ -static PSI_table_locker* -get_thread_table_io_locker_v1(PSI_table_locker_state *state, +PSI_table_locker* +pfs_get_thread_table_io_locker_v1(PSI_table_locker_state *state, PSI_table *table, PSI_table_io_operation op, uint index) { DBUG_ASSERT(static_cast (op) >= 0); @@ -2334,8 +2343,8 @@ get_thread_table_io_locker_v1(PSI_table_ Implementation of the table instrumentation interface. @sa PSI_v1::get_thread_table_lock_locker. */ -static PSI_table_locker* -get_thread_table_lock_locker_v1(PSI_table_locker_state *state, +PSI_table_locker* +pfs_get_thread_table_lock_locker_v1(PSI_table_locker_state *state, PSI_table *table, PSI_table_lock_operation op, ulong op_flags) { DBUG_ASSERT(state != NULL); @@ -2344,9 +2353,6 @@ get_thread_table_lock_locker_v1(PSI_tabl if (! flag_global_instrumentation) return NULL; - if (! global_table_lock_class.m_enabled) - return NULL; - PFS_table *pfs_table= reinterpret_cast (table); if (unlikely(pfs_table == NULL)) @@ -2354,6 +2360,9 @@ get_thread_table_lock_locker_v1(PSI_tabl DBUG_ASSERT(pfs_table->m_share != NULL); + if (! global_table_lock_class.m_enabled) + return NULL; + PFS_table_share *share= pfs_table->m_share; if (unlikely(setup_objects_version != share->m_setup_objects_version)) { @@ -2466,8 +2475,8 @@ get_thread_table_lock_locker_v1(PSI_tabl Implementation of the file instrumentation interface. @sa PSI_v1::get_thread_file_name_locker. */ -static PSI_file_locker* -get_thread_file_name_locker_v1(PSI_file_locker_state *state, +PSI_file_locker* +pfs_get_thread_file_name_locker_v1(PSI_file_locker_state *state, PSI_file_key key, PSI_file_operation op, const char *name, const void *identity) @@ -2545,8 +2554,8 @@ get_thread_file_name_locker_v1(PSI_file_ Implementation of the file instrumentation interface. @sa PSI_v1::get_thread_file_stream_locker. */ -static PSI_file_locker* -get_thread_file_stream_locker_v1(PSI_file_locker_state *state, +PSI_file_locker* +pfs_get_thread_file_stream_locker_v1(PSI_file_locker_state *state, PSI_file *file, PSI_file_operation op) { DBUG_ASSERT(static_cast (op) >= 0); @@ -2635,8 +2644,8 @@ get_thread_file_stream_locker_v1(PSI_fil Implementation of the file instrumentation interface. @sa PSI_v1::get_thread_file_descriptor_locker. */ -static PSI_file_locker* -get_thread_file_descriptor_locker_v1(PSI_file_locker_state *state, +PSI_file_locker* +pfs_get_thread_file_descriptor_locker_v1(PSI_file_locker_state *state, File file, PSI_file_operation op) { int index= static_cast (file); @@ -2739,7 +2748,7 @@ get_thread_file_descriptor_locker_v1(PSI Implementation of the mutex instrumentation interface. @sa PSI_v1::unlock_mutex. */ -static void unlock_mutex_v1(PSI_mutex *mutex) +void pfs_unlock_mutex_v1(PSI_mutex *mutex) { PFS_mutex *pfs_mutex= reinterpret_cast (mutex); @@ -2784,7 +2793,7 @@ static void unlock_mutex_v1(PSI_mutex *m Implementation of the rwlock instrumentation interface. @sa PSI_v1::unlock_rwlock. */ -static void unlock_rwlock_v1(PSI_rwlock *rwlock) +void pfs_unlock_rwlock_v1(PSI_rwlock *rwlock) { PFS_rwlock *pfs_rwlock= reinterpret_cast (rwlock); @@ -2867,7 +2876,7 @@ static void unlock_rwlock_v1(PSI_rwlock Implementation of the cond instrumentation interface. @sa PSI_v1::signal_cond. */ -static void signal_cond_v1(PSI_cond* cond) +void pfs_signal_cond_v1(PSI_cond* cond) { PFS_cond *pfs_cond= reinterpret_cast (cond); @@ -2881,7 +2890,7 @@ static void signal_cond_v1(PSI_cond* con Implementation of the cond instrumentation interface. @sa PSI_v1::broadcast_cond. */ -static void broadcast_cond_v1(PSI_cond* cond) +void pfs_broadcast_cond_v1(PSI_cond* cond) { PFS_cond *pfs_cond= reinterpret_cast (cond); @@ -2895,7 +2904,7 @@ static void broadcast_cond_v1(PSI_cond* Implementation of the mutex instrumentation interface. @sa PSI_v1::start_mutex_wait. */ -static void start_mutex_wait_v1(PSI_mutex_locker* locker, +void pfs_start_mutex_wait_v1(PSI_mutex_locker* locker, const char *src_file, uint src_line) { PSI_mutex_locker_state *state= reinterpret_cast (locker); @@ -2925,7 +2934,7 @@ static void start_mutex_wait_v1(PSI_mute Implementation of the mutex instrumentation interface. @sa PSI_v1::end_mutex_wait. */ -static void end_mutex_wait_v1(PSI_mutex_locker* locker, int rc) +void pfs_end_mutex_wait_v1(PSI_mutex_locker* locker, int rc) { PSI_mutex_locker_state *state= reinterpret_cast (locker); DBUG_ASSERT(state != NULL); @@ -2993,7 +3002,7 @@ static void end_mutex_wait_v1(PSI_mutex_ Implementation of the rwlock instrumentation interface. @sa PSI_v1::start_rwlock_rdwait. */ -static void start_rwlock_rdwait_v1(PSI_rwlock_locker* locker, +void pfs_start_rwlock_rdwait_v1(PSI_rwlock_locker* locker, const char *src_file, uint src_line) { ulonglong timer_start= 0; @@ -3021,7 +3030,7 @@ static void start_rwlock_rdwait_v1(PSI_r Implementation of the rwlock instrumentation interface. @sa PSI_v1::end_rwlock_rdwait. */ -static void end_rwlock_rdwait_v1(PSI_rwlock_locker* locker, int rc) +void pfs_end_rwlock_rdwait_v1(PSI_rwlock_locker* locker, int rc) { PSI_rwlock_locker_state *state= reinterpret_cast (locker); DBUG_ASSERT(state != NULL); @@ -3097,7 +3106,7 @@ static void end_rwlock_rdwait_v1(PSI_rwl Implementation of the rwlock instrumentation interface. @sa PSI_v1::start_rwlock_wrwait. */ -static void start_rwlock_wrwait_v1(PSI_rwlock_locker* locker, +void pfs_start_rwlock_wrwait_v1(PSI_rwlock_locker* locker, const char *src_file, uint src_line) { ulonglong timer_start= 0; @@ -3125,7 +3134,7 @@ static void start_rwlock_wrwait_v1(PSI_r Implementation of the rwlock instrumentation interface. @sa PSI_v1::end_rwlock_wrwait. */ -static void end_rwlock_wrwait_v1(PSI_rwlock_locker* locker, int rc) +void pfs_end_rwlock_wrwait_v1(PSI_rwlock_locker* locker, int rc) { PSI_rwlock_locker_state *state= reinterpret_cast (locker); DBUG_ASSERT(state != NULL); @@ -3194,7 +3203,7 @@ static void end_rwlock_wrwait_v1(PSI_rwl Implementation of the cond instrumentation interface. @sa PSI_v1::start_cond_wait. */ -static void start_cond_wait_v1(PSI_cond_locker* locker, +void pfs_start_cond_wait_v1(PSI_cond_locker* locker, const char *src_file, uint src_line) { ulonglong timer_start= 0; @@ -3222,7 +3231,7 @@ static void start_cond_wait_v1(PSI_cond_ Implementation of the cond instrumentation interface. @sa PSI_v1::end_cond_wait. */ -static void end_cond_wait_v1(PSI_cond_locker* locker, int rc) +void pfs_end_cond_wait_v1(PSI_cond_locker* locker, int rc) { PSI_cond_locker_state *state= reinterpret_cast (locker); DBUG_ASSERT(state != NULL); @@ -3284,7 +3293,7 @@ static void end_cond_wait_v1(PSI_cond_lo Implementation of the table instrumentation interface. @sa PSI_v1::start_table_io_wait. */ -static void start_table_io_wait_v1(PSI_table_locker* locker, +void pfs_start_table_io_wait_v1(PSI_table_locker* locker, const char *src_file, uint src_line) { ulonglong timer_start= 0; @@ -3314,7 +3323,7 @@ static void start_table_io_wait_v1(PSI_t Implementation of the table instrumentation interface. @sa PSI_v1::end_table_io_wait. */ -static void end_table_io_wait_v1(PSI_table_locker* locker) +void pfs_end_table_io_wait_v1(PSI_table_locker* locker) { PSI_table_locker_state *state= reinterpret_cast (locker); DBUG_ASSERT(state != NULL); @@ -3384,7 +3393,7 @@ static void end_table_io_wait_v1(PSI_tab Implementation of the table instrumentation interface. @sa PSI_v1::start_table_lock_wait. */ -static void start_table_lock_wait_v1(PSI_table_locker* locker, +void pfs_start_table_lock_wait_v1(PSI_table_locker* locker, const char *src_file, uint src_line) { ulonglong timer_start= 0; @@ -3414,7 +3423,7 @@ static void start_table_lock_wait_v1(PSI Implementation of the table instrumentation interface. @sa PSI_v1::end_table_lock_wait. */ -static void end_table_lock_wait_v1(PSI_table_locker* locker) +void pfs_end_table_lock_wait_v1(PSI_table_locker* locker) { PSI_table_locker_state *state= reinterpret_cast (locker); DBUG_ASSERT(state != NULL); @@ -3457,26 +3466,26 @@ static void end_table_lock_wait_v1(PSI_t } } -static void start_file_wait_v1(PSI_file_locker *locker, +void pfs_start_file_wait_v1(PSI_file_locker *locker, size_t count, const char *src_file, uint src_line); -static void end_file_wait_v1(PSI_file_locker *locker, +void pfs_end_file_wait_v1(PSI_file_locker *locker, size_t count); /** Implementation of the file instrumentation interface. @sa PSI_v1::start_file_open_wait. */ -static PSI_file* start_file_open_wait_v1(PSI_file_locker *locker, +PSI_file* pfs_start_file_open_wait_v1(PSI_file_locker *locker, const char *src_file, uint src_line) { PSI_file_locker_state *state= reinterpret_cast (locker); DBUG_ASSERT(state != NULL); - start_file_wait_v1(locker, 0, src_file, src_line); + pfs_start_file_wait_v1(locker, 0, src_file, src_line); return state->m_file; } @@ -3485,23 +3494,23 @@ static PSI_file* start_file_open_wait_v1 Implementation of the file instrumentation interface. @sa PSI_v1::end_file_open_wait. */ -static void end_file_open_wait_v1(PSI_file_locker *locker) +void pfs_end_file_open_wait_v1(PSI_file_locker *locker) { - end_file_wait_v1(locker, 0); + pfs_end_file_wait_v1(locker, 0); } /** Implementation of the file instrumentation interface. @sa PSI_v1::end_file_open_wait_and_bind_to_descriptor. */ -static void end_file_open_wait_and_bind_to_descriptor_v1 +void pfs_end_file_open_wait_and_bind_to_descriptor_v1 (PSI_file_locker *locker, File file) { int index= (int) file; PSI_file_locker_state *state= reinterpret_cast (locker); DBUG_ASSERT(state != NULL); - end_file_wait_v1(locker, 0); + pfs_end_file_wait_v1(locker, 0); PFS_file *pfs_file= reinterpret_cast (state->m_file); DBUG_ASSERT(pfs_file != NULL); @@ -3523,7 +3532,7 @@ static void end_file_open_wait_and_bind_ Implementation of the file instrumentation interface. @sa PSI_v1::start_file_wait. */ -static void start_file_wait_v1(PSI_file_locker *locker, +void pfs_start_file_wait_v1(PSI_file_locker *locker, size_t count, const char *src_file, uint src_line) @@ -3556,7 +3565,7 @@ static void start_file_wait_v1(PSI_file_ Implementation of the file instrumentation interface. @sa PSI_v1::end_file_wait. */ -static void end_file_wait_v1(PSI_file_locker *locker, +void pfs_end_file_wait_v1(PSI_file_locker *locker, size_t count) { PSI_file_locker_state *state= reinterpret_cast (locker); @@ -3641,7 +3650,7 @@ static void end_file_wait_v1(PSI_file_lo } -static void start_stage_v1(PSI_stage_key key, const char *src_file, int src_line) +void pfs_start_stage_v1(PSI_stage_key key, const char *src_file, int src_line) { ulonglong timer_value= 0; @@ -3734,7 +3743,7 @@ static void start_stage_v1(PSI_stage_key } } -static void end_stage_v1() +void pfs_end_stage_v1() { ulonglong timer_value= 0; @@ -3792,8 +3801,8 @@ static void end_stage_v1() } } -static PSI_statement_locker* -get_thread_statement_locker_v1(PSI_statement_locker_state *state, +PSI_statement_locker* +pfs_get_thread_statement_locker_v1(PSI_statement_locker_state *state, PSI_statement_key key) { DBUG_ASSERT(state != NULL); @@ -3911,13 +3920,15 @@ get_thread_statement_locker_v1(PSI_state return reinterpret_cast (state); } -static PSI_statement_locker* -refine_statement_v1(PSI_statement_locker *locker, +PSI_statement_locker* +pfs_refine_statement_v1(PSI_statement_locker *locker, PSI_statement_key key) { PSI_statement_locker_state *state= reinterpret_cast (locker); - if (state == NULL) + + if (unlikely(state == NULL)) return NULL; + DBUG_ASSERT(state->m_class != NULL); PFS_statement_class *klass; /* Only refine statements for mutable instrumentation */ @@ -3956,12 +3967,14 @@ refine_statement_v1(PSI_statement_locker return reinterpret_cast (state); } -static void start_statement_v1(PSI_statement_locker *locker, +void pfs_start_statement_v1(PSI_statement_locker *locker, const char *db, uint db_len, const char *src_file, uint src_line) { PSI_statement_locker_state *state= reinterpret_cast (locker); - DBUG_ASSERT(state != NULL); + + if (unlikely(state == NULL)) + return; register uint flags= state->m_flags; ulonglong timer_start= 0; @@ -3988,11 +4001,13 @@ static void start_statement_v1(PSI_state } } -static void set_statement_text_v1(PSI_statement_locker *locker, +void pfs_set_statement_text_v1(PSI_statement_locker *locker, const char *text, uint text_len) { PSI_statement_locker_state *state= reinterpret_cast (locker); - DBUG_ASSERT(state != NULL); + + if (unlikely(state == NULL)) + return; if (state->m_discarded) return; @@ -4014,7 +4029,8 @@ static void set_statement_text_v1(PSI_st #define SET_STATEMENT_ATTR_BODY(LOCKER, ATTR, VALUE) \ PSI_statement_locker_state *state; \ state= reinterpret_cast (LOCKER); \ - DBUG_ASSERT(state != NULL); \ + if (unlikely(state == NULL)) \ + return; \ if (state->m_discarded) \ return; \ state->ATTR= VALUE; \ @@ -4030,7 +4046,8 @@ static void set_statement_text_v1(PSI_st #define INC_STATEMENT_ATTR_BODY(LOCKER, ATTR, VALUE) \ PSI_statement_locker_state *state; \ state= reinterpret_cast (LOCKER); \ - DBUG_ASSERT(state != NULL); \ + if (unlikely(state == NULL)) \ + return; \ if (state->m_discarded) \ return; \ state->ATTR+= VALUE; \ @@ -4043,105 +4060,108 @@ static void set_statement_text_v1(PSI_st } \ return; -static void set_statement_lock_time_v1(PSI_statement_locker *locker, +void pfs_set_statement_lock_time_v1(PSI_statement_locker *locker, ulonglong count) { SET_STATEMENT_ATTR_BODY(locker, m_lock_time, count); } -static void set_statement_rows_sent_v1(PSI_statement_locker *locker, +void pfs_set_statement_rows_sent_v1(PSI_statement_locker *locker, ulonglong count) { SET_STATEMENT_ATTR_BODY(locker, m_rows_sent, count); } -static void set_statement_rows_examined_v1(PSI_statement_locker *locker, +void pfs_set_statement_rows_examined_v1(PSI_statement_locker *locker, ulonglong count) { SET_STATEMENT_ATTR_BODY(locker, m_rows_examined, count); } -static void inc_statement_created_tmp_disk_tables_v1(PSI_statement_locker *locker, +void pfs_inc_statement_created_tmp_disk_tables_v1(PSI_statement_locker *locker, ulonglong count) { INC_STATEMENT_ATTR_BODY(locker, m_created_tmp_disk_tables, count); } -static void inc_statement_created_tmp_tables_v1(PSI_statement_locker *locker, +void pfs_inc_statement_created_tmp_tables_v1(PSI_statement_locker *locker, ulonglong count) { INC_STATEMENT_ATTR_BODY(locker, m_created_tmp_tables, count); } -static void inc_statement_select_full_join_v1(PSI_statement_locker *locker, +void pfs_inc_statement_select_full_join_v1(PSI_statement_locker *locker, ulonglong count) { INC_STATEMENT_ATTR_BODY(locker, m_select_full_join, count); } -static void inc_statement_select_full_range_join_v1(PSI_statement_locker *locker, +void pfs_inc_statement_select_full_range_join_v1(PSI_statement_locker *locker, ulonglong count) { INC_STATEMENT_ATTR_BODY(locker, m_select_full_range_join, count); } -static void inc_statement_select_range_v1(PSI_statement_locker *locker, +void pfs_inc_statement_select_range_v1(PSI_statement_locker *locker, ulonglong count) { INC_STATEMENT_ATTR_BODY(locker, m_select_range, count); } -static void inc_statement_select_range_check_v1(PSI_statement_locker *locker, +void pfs_inc_statement_select_range_check_v1(PSI_statement_locker *locker, ulonglong count) { INC_STATEMENT_ATTR_BODY(locker, m_select_range_check, count); } -static void inc_statement_select_scan_v1(PSI_statement_locker *locker, +void pfs_inc_statement_select_scan_v1(PSI_statement_locker *locker, ulonglong count) { INC_STATEMENT_ATTR_BODY(locker, m_select_scan, count); } -static void inc_statement_sort_merge_passes_v1(PSI_statement_locker *locker, +void pfs_inc_statement_sort_merge_passes_v1(PSI_statement_locker *locker, ulonglong count) { INC_STATEMENT_ATTR_BODY(locker, m_sort_merge_passes, count); } -static void inc_statement_sort_range_v1(PSI_statement_locker *locker, +void pfs_inc_statement_sort_range_v1(PSI_statement_locker *locker, ulonglong count) { INC_STATEMENT_ATTR_BODY(locker, m_sort_range, count); } -static void inc_statement_sort_rows_v1(PSI_statement_locker *locker, +void pfs_inc_statement_sort_rows_v1(PSI_statement_locker *locker, ulonglong count) { INC_STATEMENT_ATTR_BODY(locker, m_sort_rows, count); } -static void inc_statement_sort_scan_v1(PSI_statement_locker *locker, +void pfs_inc_statement_sort_scan_v1(PSI_statement_locker *locker, ulonglong count) { INC_STATEMENT_ATTR_BODY(locker, m_sort_scan, count); } -static void set_statement_no_index_used_v1(PSI_statement_locker *locker) +void pfs_set_statement_no_index_used_v1(PSI_statement_locker *locker) { SET_STATEMENT_ATTR_BODY(locker, m_no_index_used, 1); } -static void set_statement_no_good_index_used_v1(PSI_statement_locker *locker) +void pfs_set_statement_no_good_index_used_v1(PSI_statement_locker *locker) { SET_STATEMENT_ATTR_BODY(locker, m_no_good_index_used, 1); } -static void end_statement_v1(PSI_statement_locker *locker, void *stmt_da) +void pfs_end_statement_v1(PSI_statement_locker *locker, void *stmt_da) { PSI_statement_locker_state *state= reinterpret_cast (locker); + + if (unlikely(state == NULL)) + return; + Diagnostics_area *da= reinterpret_cast (stmt_da); - DBUG_ASSERT(state != NULL); DBUG_ASSERT(da != NULL); if (state->m_discarded) @@ -4269,91 +4289,91 @@ static void end_statement_v1(PSI_stateme */ PSI_v1 PFS_v1= { - register_mutex_v1, - register_rwlock_v1, - register_cond_v1, - register_thread_v1, - register_file_v1, - register_stage_v1, - register_statement_v1, - init_mutex_v1, - destroy_mutex_v1, - init_rwlock_v1, - destroy_rwlock_v1, - init_cond_v1, - destroy_cond_v1, - get_table_share_v1, - release_table_share_v1, - drop_table_share_v1, - open_table_v1, - close_table_v1, - create_file_v1, - spawn_thread_v1, - new_thread_v1, - set_thread_id_v1, - get_thread_v1, - set_thread_user_v1, - set_thread_user_host_v1, - set_thread_db_v1, - set_thread_command_v1, - set_thread_start_time_v1, - set_thread_state_v1, - set_thread_info_v1, - set_thread_v1, - delete_current_thread_v1, - delete_thread_v1, - get_thread_mutex_locker_v1, - get_thread_rwlock_locker_v1, - get_thread_cond_locker_v1, - get_thread_table_io_locker_v1, - get_thread_table_lock_locker_v1, - get_thread_file_name_locker_v1, - get_thread_file_stream_locker_v1, - get_thread_file_descriptor_locker_v1, - unlock_mutex_v1, - unlock_rwlock_v1, - signal_cond_v1, - broadcast_cond_v1, - start_mutex_wait_v1, - end_mutex_wait_v1, - start_rwlock_rdwait_v1, - end_rwlock_rdwait_v1, - start_rwlock_wrwait_v1, - end_rwlock_wrwait_v1, - start_cond_wait_v1, - end_cond_wait_v1, - start_table_io_wait_v1, - end_table_io_wait_v1, - start_table_lock_wait_v1, - end_table_lock_wait_v1, - start_file_open_wait_v1, - end_file_open_wait_v1, - end_file_open_wait_and_bind_to_descriptor_v1, - start_file_wait_v1, - end_file_wait_v1, - start_stage_v1, - end_stage_v1, - get_thread_statement_locker_v1, - refine_statement_v1, - start_statement_v1, - set_statement_text_v1, - set_statement_lock_time_v1, - set_statement_rows_sent_v1, - set_statement_rows_examined_v1, - inc_statement_created_tmp_disk_tables_v1, - inc_statement_created_tmp_tables_v1, - inc_statement_select_full_join_v1, - inc_statement_select_full_range_join_v1, - inc_statement_select_range_v1, - inc_statement_select_range_check_v1, - inc_statement_select_scan_v1, - inc_statement_sort_merge_passes_v1, - inc_statement_sort_range_v1, - inc_statement_sort_rows_v1, - inc_statement_sort_scan_v1, - set_statement_no_index_used_v1, - set_statement_no_good_index_used_v1, - end_statement_v1 + pfs_register_mutex_v1, + pfs_register_rwlock_v1, + pfs_register_cond_v1, + pfs_register_thread_v1, + pfs_register_file_v1, + pfs_register_stage_v1, + pfs_register_statement_v1, + pfs_init_mutex_v1, + pfs_destroy_mutex_v1, + pfs_init_rwlock_v1, + pfs_destroy_rwlock_v1, + pfs_init_cond_v1, + pfs_destroy_cond_v1, + pfs_get_table_share_v1, + pfs_release_table_share_v1, + pfs_drop_table_share_v1, + pfs_open_table_v1, + pfs_close_table_v1, + pfs_create_file_v1, + pfs_spawn_thread_v1, + pfs_new_thread_v1, + pfs_set_thread_id_v1, + pfs_get_thread_v1, + pfs_set_thread_user_v1, + pfs_set_thread_user_host_v1, + pfs_set_thread_db_v1, + pfs_set_thread_command_v1, + pfs_set_thread_start_time_v1, + pfs_set_thread_state_v1, + pfs_set_thread_info_v1, + pfs_set_thread_v1, + pfs_delete_current_thread_v1, + pfs_delete_thread_v1, + pfs_get_thread_mutex_locker_v1, + pfs_get_thread_rwlock_locker_v1, + pfs_get_thread_cond_locker_v1, + pfs_get_thread_table_io_locker_v1, + pfs_get_thread_table_lock_locker_v1, + pfs_get_thread_file_name_locker_v1, + pfs_get_thread_file_stream_locker_v1, + pfs_get_thread_file_descriptor_locker_v1, + pfs_unlock_mutex_v1, + pfs_unlock_rwlock_v1, + pfs_signal_cond_v1, + pfs_broadcast_cond_v1, + pfs_start_mutex_wait_v1, + pfs_end_mutex_wait_v1, + pfs_start_rwlock_rdwait_v1, + pfs_end_rwlock_rdwait_v1, + pfs_start_rwlock_wrwait_v1, + pfs_end_rwlock_wrwait_v1, + pfs_start_cond_wait_v1, + pfs_end_cond_wait_v1, + pfs_start_table_io_wait_v1, + pfs_end_table_io_wait_v1, + pfs_start_table_lock_wait_v1, + pfs_end_table_lock_wait_v1, + pfs_start_file_open_wait_v1, + pfs_end_file_open_wait_v1, + pfs_end_file_open_wait_and_bind_to_descriptor_v1, + pfs_start_file_wait_v1, + pfs_end_file_wait_v1, + pfs_start_stage_v1, + pfs_end_stage_v1, + pfs_get_thread_statement_locker_v1, + pfs_refine_statement_v1, + pfs_start_statement_v1, + pfs_set_statement_text_v1, + pfs_set_statement_lock_time_v1, + pfs_set_statement_rows_sent_v1, + pfs_set_statement_rows_examined_v1, + pfs_inc_statement_created_tmp_disk_tables_v1, + pfs_inc_statement_created_tmp_tables_v1, + pfs_inc_statement_select_full_join_v1, + pfs_inc_statement_select_full_range_join_v1, + pfs_inc_statement_select_range_v1, + pfs_inc_statement_select_range_check_v1, + pfs_inc_statement_select_scan_v1, + pfs_inc_statement_sort_merge_passes_v1, + pfs_inc_statement_sort_range_v1, + pfs_inc_statement_sort_rows_v1, + pfs_inc_statement_sort_scan_v1, + pfs_set_statement_no_index_used_v1, + pfs_set_statement_no_good_index_used_v1, + pfs_end_statement_v1 }; static void* get_interface(int version) === added file 'storage/perfschema/pfs_api.h' --- a/storage/perfschema/pfs_api.h 1970-01-01 00:00:00 +0000 +++ b/storage/perfschema/pfs_api.h 2011-05-04 11:13:49 +0000 @@ -0,0 +1,232 @@ + +C_MODE_START + +void pfs_register_mutex_v1(const char *category, struct PSI_mutex_info_v1 *info, int count); + +void pfs_register_rwlock_v1(const char *category, struct PSI_rwlock_info_v1 *info, int count); + +void pfs_register_cond_v1(const char *category, struct PSI_cond_info_v1 *info, int count); + +void pfs_register_thread_v1(const char *category, struct PSI_thread_info_v1 *info, int count); + +void pfs_register_file_v1(const char *category, struct PSI_file_info_v1 *info, int count); + +void pfs_register_stage_v1(const char *category, struct PSI_stage_info_v1 **info_array, int count); + +void pfs_register_statement_v1(const char *category, struct PSI_statement_info_v1 *info, int count); + +struct PSI_mutex* pfs_init_mutex_v1(PSI_mutex_key key, const void *identity); + +void pfs_destroy_mutex_v1(struct PSI_mutex* mutex); + +struct PSI_rwlock* pfs_init_rwlock_v1(PSI_rwlock_key key, const void *identity); + +void pfs_destroy_rwlock_v1(struct PSI_rwlock* rwlock); + +struct PSI_cond* pfs_init_cond_v1(PSI_cond_key key, const void *identity); + +void pfs_destroy_cond_v1(struct PSI_cond* cond); + +struct PSI_table_share* pfs_get_table_share_v1(my_bool temporary, struct TABLE_SHARE *share); + +void pfs_release_table_share_v1(struct PSI_table_share* share); + +void pfs_drop_table_share_v1(const char *schema_name, int schema_name_length, + const char *table_name, int table_name_length); + +struct PSI_table* pfs_open_table_v1(struct PSI_table_share *share, const void *identity); + +void pfs_close_table_v1(struct PSI_table *table); + +void pfs_create_file_v1(PSI_file_key key, const char *name, File file); + +int pfs_spawn_thread_v1(PSI_thread_key key, + pthread_t *thread, const pthread_attr_t *attr, + void *(*start_routine)(void*), void *arg); + +struct PSI_thread* pfs_new_thread_v1(PSI_thread_key key, const void *identity, ulong thread_id); + +void pfs_set_thread_id_v1(struct PSI_thread *thread, unsigned long id); + +struct PSI_thread* pfs_get_thread_v1(void); + +void pfs_set_thread_user_v1(const char *user, int user_len); + +void pfs_set_thread_user_host_v1(const char *user, int user_len, + const char *host, int host_len); + +void pfs_set_thread_db_v1(const char* db, int db_len); + +void pfs_set_thread_command_v1(int command); + +void pfs_set_thread_start_time_v1(time_t start_time); + +void pfs_set_thread_state_v1(const char* state); + +void pfs_set_thread_info_v1(const char* info, int info_len); + +void pfs_set_thread_v1(struct PSI_thread* thread); + +void pfs_delete_current_thread_v1(void); + +void pfs_delete_thread_v1(struct PSI_thread *thread); + +struct PSI_mutex_locker* +pfs_get_thread_mutex_locker_v1(PSI_mutex_locker_state *state, + struct PSI_mutex *mutex, enum PSI_mutex_operation op); + +struct PSI_rwlock_locker* +pfs_get_thread_rwlock_locker_v1(PSI_rwlock_locker_state *state, + struct PSI_rwlock *rwlock, enum PSI_rwlock_operation op); + +struct PSI_cond_locker* +pfs_get_thread_cond_locker_v1(PSI_cond_locker_state *state, + struct PSI_cond *cond, struct PSI_mutex *mutex, + enum PSI_cond_operation op); + +struct PSI_table_locker* +pfs_get_thread_table_io_locker_v1(PSI_table_locker_state *state, + struct PSI_table *table, enum PSI_table_io_operation op, uint index); + +struct PSI_table_locker* +pfs_get_thread_table_lock_locker_v1(PSI_table_locker_state *state, + struct PSI_table *table, enum PSI_table_lock_operation op, ulong op_flags); + +struct PSI_file_locker* +pfs_get_thread_file_name_locker_v1(PSI_file_locker_state *state, + PSI_file_key key, + enum PSI_file_operation op, + const char *name, const void *identity); + + +struct PSI_file_locker* +pfs_get_thread_file_stream_locker_v1(PSI_file_locker_state *state, + struct PSI_file *file, enum PSI_file_operation op); + +struct PSI_file_locker* +pfs_get_thread_file_descriptor_locker_v1(PSI_file_locker_state *state, + File file, enum PSI_file_operation op); + +void pfs_unlock_mutex_v1(struct PSI_mutex *mutex); + +void pfs_unlock_rwlock_v1(struct PSI_rwlock *rwlock); + +void pfs_signal_cond_v1(struct PSI_cond* cond); + +void pfs_broadcast_cond_v1(struct PSI_cond* cond); + +void pfs_start_mutex_wait_v1(struct PSI_mutex_locker* locker, + const char *src_file, uint src_line); + +void pfs_end_mutex_wait_v1(struct PSI_mutex_locker* locker, int rc); + +void pfs_start_rwlock_rdwait_v1(struct PSI_rwlock_locker* locker, + const char *src_file, uint src_line); + +void pfs_end_rwlock_rdwait_v1(struct PSI_rwlock_locker* locker, int rc); + +void pfs_start_rwlock_wrwait_v1(struct PSI_rwlock_locker* locker, + const char *src_file, uint src_line); + +void pfs_end_rwlock_wrwait_v1(struct PSI_rwlock_locker* locker, int rc); + +void pfs_start_cond_wait_v1(struct PSI_cond_locker* locker, + const char *src_file, uint src_line); + +void pfs_end_cond_wait_v1(struct PSI_cond_locker* locker, int rc); + +void pfs_start_table_io_wait_v1(struct PSI_table_locker* locker, + const char *src_file, uint src_line); + +void pfs_end_table_io_wait_v1(struct PSI_table_locker* locker); + +void pfs_start_table_lock_wait_v1(struct PSI_table_locker* locker, + const char *src_file, uint src_line); + +void pfs_end_table_lock_wait_v1(struct PSI_table_locker* locker); + +struct PSI_file* pfs_start_file_open_wait_v1(struct PSI_file_locker *locker, + const char *src_file, + uint src_line); + +void pfs_end_file_open_wait_v1(struct PSI_file_locker *locker); + +void pfs_end_file_open_wait_and_bind_to_descriptor_v1 + (struct PSI_file_locker *locker, File file); + +void pfs_start_file_wait_v1(struct PSI_file_locker *locker, + size_t count, + const char *src_file, + uint src_line); + +void pfs_end_file_wait_v1(struct PSI_file_locker *locker, + size_t count); + +void pfs_start_stage_v1(PSI_stage_key key, const char *src_file, int src_line); + +void pfs_end_stage_v1(); + +struct PSI_statement_locker* +pfs_get_thread_statement_locker_v1(PSI_statement_locker_state *state, + PSI_statement_key key); + +struct PSI_statement_locker* +pfs_refine_statement_v1(struct PSI_statement_locker *locker, + PSI_statement_key key); + +void pfs_start_statement_v1(struct PSI_statement_locker *locker, + const char *db, uint db_len, + const char *src_file, uint src_line); + +void pfs_set_statement_text_v1(struct PSI_statement_locker *locker, + const char *text, uint text_len); + +void pfs_set_statement_lock_time_v1(struct PSI_statement_locker *locker, + ulonglong count); + +void pfs_set_statement_rows_sent_v1(struct PSI_statement_locker *locker, + ulonglong count); + +void pfs_set_statement_rows_examined_v1(struct PSI_statement_locker *locker, + ulonglong count); + +void pfs_inc_statement_created_tmp_disk_tables_v1(struct PSI_statement_locker *locker, + ulonglong count); + +void pfs_inc_statement_created_tmp_tables_v1(struct PSI_statement_locker *locker, + ulonglong count); + +void pfs_inc_statement_select_full_join_v1(struct PSI_statement_locker *locker, + ulonglong count); + +void pfs_inc_statement_select_full_range_join_v1(struct PSI_statement_locker *locker, + ulonglong count); + +void pfs_inc_statement_select_range_v1(struct PSI_statement_locker *locker, + ulonglong count); + +void pfs_inc_statement_select_range_check_v1(struct PSI_statement_locker *locker, + ulonglong count); + +void pfs_inc_statement_select_scan_v1(struct PSI_statement_locker *locker, + ulonglong count); + +void pfs_inc_statement_sort_merge_passes_v1(struct PSI_statement_locker *locker, + ulonglong count); + +void pfs_inc_statement_sort_range_v1(struct PSI_statement_locker *locker, + ulonglong count); + +void pfs_inc_statement_sort_rows_v1(struct PSI_statement_locker *locker, + ulonglong count); + +void pfs_inc_statement_sort_scan_v1(struct PSI_statement_locker *locker, + ulonglong count); + +void pfs_set_statement_no_index_used_v1(struct PSI_statement_locker *locker); + +void pfs_set_statement_no_good_index_used_v1(struct PSI_statement_locker *locker); + +void pfs_end_statement_v1(struct PSI_statement_locker *locker, void *stmt_da); + +C_MODE_END === modified file 'storage/perfschema/pfs_events_stages.cc' --- a/storage/perfschema/pfs_events_stages.cc 2011-02-17 18:10:56 +0000 +++ b/storage/perfschema/pfs_events_stages.cc 2011-05-04 11:13:49 +0000 @@ -29,11 +29,11 @@ ulong events_stages_history_long_size= 0; /** Consumer flag for table EVENTS_STAGES_CURRENT. */ -bool flag_events_stages_current= true; +bool flag_events_stages_current= false; /** Consumer flag for table EVENTS_STAGES_HISTORY. */ -bool flag_events_stages_history= true; +bool flag_events_stages_history= false; /** Consumer flag for table EVENTS_STAGES_HISTORY_LONG. */ -bool flag_events_stages_history_long= true; +bool flag_events_stages_history_long= false; /** True if EVENTS_STAGES_HISTORY_LONG circular buffer is full. */ bool events_stages_history_long_full= false; === modified file 'storage/perfschema/pfs_events_statements.cc' --- a/storage/perfschema/pfs_events_statements.cc 2011-02-17 18:10:56 +0000 +++ b/storage/perfschema/pfs_events_statements.cc 2011-05-04 11:13:49 +0000 @@ -29,11 +29,11 @@ ulong events_statements_history_long_size= 0; /** Consumer flag for table EVENTS_STATEMENTS_CURRENT. */ -bool flag_events_statements_current= true; +bool flag_events_statements_current= false; /** Consumer flag for table EVENTS_STATEMENTS_HISTORY. */ -bool flag_events_statements_history= true; +bool flag_events_statements_history= false; /** Consumer flag for table EVENTS_STATEMENTS_HISTORY_LONG. */ -bool flag_events_statements_history_long= true; +bool flag_events_statements_history_long= false; /** True if EVENTS_STATEMENTS_HISTORY_LONG circular buffer is full. */ bool events_statements_history_long_full= false; === modified file 'storage/perfschema/pfs_events_waits.cc' --- a/storage/perfschema/pfs_events_waits.cc 2011-02-14 14:23:55 +0000 +++ b/storage/perfschema/pfs_events_waits.cc 2011-05-04 11:13:49 +0000 @@ -28,15 +28,15 @@ ulong events_waits_history_long_size= 0; /** Consumer flag for table EVENTS_WAITS_CURRENT. */ -bool flag_events_waits_current= true; +bool flag_events_waits_current= false; /** Consumer flag for table EVENTS_WAITS_HISTORY. */ -bool flag_events_waits_history= true; +bool flag_events_waits_history= false; /** Consumer flag for table EVENTS_WAITS_HISTORY_LONG. */ -bool flag_events_waits_history_long= true; +bool flag_events_waits_history_long= false; /** Consumer flag for the global instrumentation. */ -bool flag_global_instrumentation= true; +bool flag_global_instrumentation= false; /** Consumer flag for the per thread instrumentation. */ -bool flag_thread_instrumentation= true; +bool flag_thread_instrumentation= false; /** True if EVENTS_WAITS_HISTORY_LONG circular buffer is full. */ bool events_waits_history_long_full= false; === modified file 'storage/perfschema/pfs_instr_class.cc' --- a/storage/perfschema/pfs_instr_class.cc 2011-02-14 14:23:55 +0000 +++ b/storage/perfschema/pfs_instr_class.cc 2011-05-04 11:13:49 +0000 @@ -402,11 +402,13 @@ static void set_table_share_key(PFS_tabl ptr++; key->m_key_length= ptr - &key->m_hash_key[0]; +#ifdef LATER if (lower_case_table_names) { my_casedn_str(files_charset_info, saved_schema_name); my_casedn_str(files_charset_info, saved_table_name); } +#endif } /** === modified file 'storage/perfschema/pfs_server.cc' --- a/storage/perfschema/pfs_server.cc 2011-02-14 14:23:55 +0000 +++ b/storage/perfschema/pfs_server.cc 2011-05-04 11:13:49 +0000 @@ -96,6 +96,19 @@ initialize_performance_schema(const PFS_ } pfs_initialized= true; + + flag_global_instrumentation= true; + flag_thread_instrumentation= true; + flag_events_waits_current= true; + flag_events_waits_history= true; + flag_events_waits_history_long= true; + flag_events_stages_current= true; + flag_events_stages_history= true; + flag_events_stages_history_long= true; + flag_events_statements_current= true; + flag_events_statements_history= true; + flag_events_statements_history_long= true; + install_default_setup(&PFS_bootstrap); return &PFS_bootstrap; } No bundle (reason: useless for push emails).