List:Commits« Previous MessageNext Message »
From:Marc Alff Date:June 6 2011 8:08pm
Subject:bzr push into mysql-trunk-pfs-tuning branch (marc.alff:3380 to 3381)
View as plain text  
 3381 Marc Alff	2011-06-06
      performance tuning: de normalized instrumentation flags

    modified:
      mysql-test/suite/perfschema/t/func_file_io.test
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      storage/perfschema/table_setup_consumers.cc
      storage/perfschema/table_setup_instruments.cc
      storage/perfschema/unittest/pfs-t.cc
      storage/perfschema/unittest/pfs_instr_class-t.cc
 3380 Marc Alff	2011-06-03 [merge]
      Merge mysql-trunk --> mysql-trunk-pfs-tuning

    added:
      extra/yassl/include/openssl/transport_types.h
      mysql-test/suite/binlog/r/binlog_reset_master.result
      mysql-test/suite/binlog/t/binlog_reset_master.test
      mysql-test/suite/innodb/r/innodb_index_large_prefix.result
      mysql-test/suite/innodb/r/innodb_prefix_index_liftedlimit.result
      mysql-test/suite/innodb/r/innodb_prefix_index_restart_server.result
      mysql-test/suite/innodb/t/innodb_index_large_prefix.test
      mysql-test/suite/innodb/t/innodb_prefix_index_liftedlimit.test
      mysql-test/suite/innodb/t/innodb_prefix_index_restart_server.test
      vio/viopipe.c
      vio/vioshm.c
    modified:
      client/completion_hash.cc
      client/mysql.cc
      client/mysql_upgrade.c
      client/mysqlbinlog.cc
      client/mysqldump.c
      client/mysqlslap.c
      client/mysqltest.cc
      client/sql_string.cc
      cmake/install_layout.cmake
      cmake/os/Windows.cmake
      cmake/os/WindowsCache.cmake
      cmake/plugin.cmake
      config.h.cmake
      configure.cmake
      dbug/dbug.c
      extra/comp_err.c
      extra/replace.c
      extra/yassl/include/openssl/ssl.h
      extra/yassl/include/socket_wrapper.hpp
      extra/yassl/src/handshake.cpp
      extra/yassl/src/socket_wrapper.cpp
      extra/yassl/src/ssl.cpp
      include/hash.h
      include/m_string.h
      include/my_base.h
      include/my_global.h
      include/my_sys.h
      include/myisampack.h
      include/mysql.h.pp
      include/mysql_com.h
      include/violite.h
      libmysql/errmsg.c
      libmysql/libmysql.c
      libmysqld/lib_sql.cc
      mysql-test/collections/default.experimental
      mysql-test/extra/binlog_tests/binlog_cache_stat.test
      mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
      mysql-test/include/mysqlhotcopy.inc
      mysql-test/include/plugin.defs
      mysql-test/include/subquery.inc
      mysql-test/mysql-test-run.pl
      mysql-test/r/events_bugs.result
      mysql-test/r/func_math.result
      mysql-test/r/func_str.result
      mysql-test/r/innodb_mysql_lock.result
      mysql-test/r/innodb_mysql_sync.result
      mysql-test/r/myisam_debug.result
      mysql-test/r/openssl_1.result
      mysql-test/r/query_cache_debug.result
      mysql-test/r/ssl.result
      mysql-test/r/subquery_nomat_nosj.result
      mysql-test/r/subquery_none.result
      mysql-test/r/wait_timeout.result
      mysql-test/suite/binlog/r/binlog_mixed_cache_stat.result
      mysql-test/suite/binlog/r/binlog_row_cache_stat.result
      mysql-test/suite/binlog/r/binlog_stm_cache_stat.result
      mysql-test/suite/innodb/include/innodb_stats.inc
      mysql-test/suite/innodb/include/innodb_stats_bootstrap.inc
      mysql-test/suite/innodb/r/innodb-index.result
      mysql-test/suite/innodb/r/innodb_mysql.result
      mysql-test/suite/innodb/r/innodb_stats.result
      mysql-test/suite/innodb/r/innodb_stats_drop_locked.result
      mysql-test/suite/innodb/t/innodb-index.test
      mysql-test/suite/innodb/t/innodb_bug11933790.test
      mysql-test/suite/innodb/t/innodb_mysql.test
      mysql-test/suite/innodb/t/innodb_stats.test
      mysql-test/suite/innodb/t/innodb_stats_drop_locked.test
      mysql-test/suite/rpl/r/rpl_crash_safe_master.result
      mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result
      mysql-test/suite/rpl/t/rpl_crash_safe_master.test
      mysql-test/suite/sys_vars/r/all_vars.result
      mysql-test/suite/sys_vars/r/innodb_purge_batch_size_basic.result
      mysql-test/t/events_bugs.test
      mysql-test/t/func_math.test
      mysql-test/t/func_str.test
      mysql-test/t/innodb_mysql_lock.test
      mysql-test/t/innodb_mysql_sync.test
      mysql-test/t/myisam_debug.test
      mysql-test/t/query_cache_debug.test
      mysql-test/t/ssl.test
      mysql-test/t/wait_timeout.test
      mysql-test/t/xa.test
      mysys/array.c
      mysys/charset.c
      mysys/default.c
      mysys/lf_dynarray.c
      mysys/mf_iocache.c
      mysys/mf_keycache.c
      mysys/mf_radix.c
      mysys/my_aes.c
      mysys/my_alloc.c
      mysys/my_bitmap.c
      mysys/my_chsize.c
      mysys/my_file.c
      mysys/my_gethwaddr.c
      mysys/my_handler_errors.h
      mysys/my_init.c
      mysys/my_lib.c
      mysys/my_malloc.c
      mysys/my_once.c
      mysys/my_wincond.c
      mysys/my_windac.c
      mysys/sha1.c
      mysys/testhash.c
      mysys/thr_alarm.c
      mysys/thr_lock.c
      mysys/thr_mutex.c
      mysys/tree.c
      mysys/waiting_threads.c
      regex/regexp.c
      regex/reginit.c
      sql-common/client.c
      sql-common/client_plugin.c
      sql-common/my_time.c
      sql/binlog.cc
      sql/binlog.h
      sql/debug_sync.cc
      sql/des_key_file.cc
      sql/event_data_objects.cc
      sql/event_db_repository.cc
      sql/event_db_repository.h
      sql/events.cc
      sql/field.cc
      sql/field.h
      sql/field_conv.cc
      sql/filesort.cc
      sql/gcalc_tools.h
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster_binlog.cc
      sql/ha_partition.cc
      sql/ha_partition.h
      sql/handler.cc
      sql/handler.h
      sql/hash_filo.h
      sql/item.cc
      sql/item.h
      sql/item_cmpfunc.h
      sql/item_func.cc
      sql/item_inetfunc.cc
      sql/item_strfunc.cc
      sql/item_sum.cc
      sql/item_timefunc.cc
      sql/item_xmlfunc.cc
      sql/key.cc
      sql/log.cc
      sql/log_event.cc
      sql/log_event.h
      sql/log_event_old.cc
      sql/mysqld.cc
      sql/net_serv.cc
      sql/opt_range.cc
      sql/partition_info.cc
      sql/password.c
      sql/protocol.cc
      sql/records.cc
      sql/rpl_info_file.cc
      sql/rpl_injector.cc
      sql/rpl_master.cc
      sql/rpl_rli.cc
      sql/rpl_utility.cc
      sql/rpl_utility.h
      sql/set_var.cc
      sql/share/errmsg-utf8.txt
      sql/sp.cc
      sql/sp_head.cc
      sql/sql_acl.cc
      sql/sql_alter.cc
      sql/sql_analyse.cc
      sql/sql_audit.cc
      sql/sql_base.cc
      sql/sql_cache.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_connect.cc
      sql/sql_db.cc
      sql/sql_delete.cc
      sql/sql_error.cc
      sql/sql_insert.cc
      sql/sql_join_cache.cc
      sql/sql_lex.cc
      sql/sql_list.h
      sql/sql_load.cc
      sql/sql_parse.cc
      sql/sql_partition_admin.cc
      sql/sql_plugin.cc
      sql/sql_prepare.cc
      sql/sql_select.cc
      sql/sql_select.h
      sql/sql_show.cc
      sql/sql_string.cc
      sql/sql_table.cc
      sql/sql_trigger.cc
      sql/sql_trigger.h
      sql/sql_udf.cc
      sql/sql_union.cc
      sql/sql_update.cc
      sql/sql_view.cc
      sql/sql_yacc.yy
      sql/table.cc
      sql/table.h
      sql/thr_malloc.cc
      sql/tztime.cc
      sql/udf_example.c
      sql/unireg.cc
      sql/unireg.h
      storage/blackhole/ha_blackhole.cc
      storage/federated/ha_federated.cc
      storage/heap/ha_heap.cc
      storage/heap/hp_create.c
      storage/heap/hp_hash.c
      storage/heap/hp_test1.c
      storage/heap/hp_test2.c
      storage/innobase/data/data0data.c
      storage/innobase/dict/dict0dict.c
      storage/innobase/dict/dict0mem.c
      storage/innobase/dict/dict0stats.c
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/ha_innodb.h
      storage/innobase/handler/handler0alter.cc
      storage/innobase/include/db0err.h
      storage/innobase/include/dict0dict.h
      storage/innobase/include/dict0dict.ic
      storage/innobase/include/dict0mem.h
      storage/innobase/include/mtr0mtr.ic
      storage/innobase/include/rem0types.h
      storage/innobase/include/row0ext.h
      storage/innobase/include/row0ext.ic
      storage/innobase/include/sync0sync.h
      storage/innobase/include/sync0sync.ic
      storage/innobase/include/trx0purge.h
      storage/innobase/lock/lock0lock.c
      storage/innobase/mtr/mtr0mtr.c
      storage/innobase/page/page0zip.c
      storage/innobase/rem/rem0rec.c
      storage/innobase/row/row0ext.c
      storage/innobase/row/row0mysql.c
      storage/innobase/row/row0row.c
      storage/innobase/row/row0sel.c
      storage/innobase/row/row0upd.c
      storage/innobase/scripts/persistent_storage.sql
      storage/innobase/srv/srv0srv.c
      storage/innobase/trx/trx0purge.c
      storage/innobase/trx/trx0rec.c
      storage/innobase/ut/ut0ut.c
      storage/myisam/ft_boolean_search.c
      storage/myisam/ft_nlq_search.c
      storage/myisam/ft_update.c
      storage/myisam/ha_myisam.cc
      storage/myisam/mi_cache.c
      storage/myisam/mi_check.c
      storage/myisam/mi_create.c
      storage/myisam/mi_dynrec.c
      storage/myisam/mi_key.c
      storage/myisam/mi_log.c
      storage/myisam/mi_open.c
      storage/myisam/mi_packrec.c
      storage/myisam/mi_rkey.c
      storage/myisam/mi_statrec.c
      storage/myisam/mi_test1.c
      storage/myisam/mi_test2.c
      storage/myisam/mi_test3.c
      storage/myisam/myisamchk.c
      storage/myisam/myisamlog.c
      storage/myisam/myisampack.c
      storage/myisam/rt_test.c
      storage/myisam/sort.c
      storage/myisam/sp_key.c
      storage/myisam/sp_test.c
      storage/myisammrg/ha_myisammrg.cc
      storage/myisammrg/myrg_open.c
      storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
      storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
      storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp
      storage/ndb/src/kernel/blocks/tsman.cpp
      storage/ndb/src/kernel/vm/RWPool.cpp
      storage/ndb/src/kernel/vm/WOPool.cpp
      storage/ndb/src/kernel/vm/bench_pool.cpp
      storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp
      storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
      storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
      storage/ndb/test/ndbapi/testNodeRestart.cpp
      storage/ndb/test/run-test/setup.cpp
      storage/ndb/test/src/DbUtil.cpp
      strings/conf_to_src.c
      strings/ctype-czech.c
      strings/ctype-mb.c
      strings/ctype-simple.c
      strings/ctype-uca.c
      strings/ctype-win1250ch.c
      strings/ctype.c
      strings/decimal.c
      strings/dump_map.c
      strings/my_vsnprintf.c
      strings/uca-dump.c
      strings/uctypedump.c
      strings/xml.c
      support-files/build-tags
      tests/mysql_client_test.c
      unittest/gunit/item-t.cc
      unittest/gunit/test_utils.h
      unittest/mysys/waiting_threads-t.c
      vio/CMakeLists.txt
      vio/test-ssl.c
      vio/test-sslclient.c
      vio/test-sslserver.c
      vio/vio.c
      vio/vio_priv.h
      vio/viosocket.c
      vio/viossl.c
      vio/viosslfactories.c
      vio/viotest-ssl.c
=== modified file 'mysql-test/suite/perfschema/t/func_file_io.test'
--- a/mysql-test/suite/perfschema/t/func_file_io.test	2010-11-18 16:34:56 +0000
+++ b/mysql-test/suite/perfschema/t/func_file_io.test	2011-06-06 20:07:48 +0000
@@ -69,6 +69,7 @@ SET @after_count = (SELECT SUM(TIMER_WAI
                       AND (OBJECT_NAME LIKE '%t1.MYD') AND (1 = 1));
 
 SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_ff1_timed;
+select @before_count, @after_count;
 
 UPDATE performance_schema.setup_instruments SET enabled='NO';
 

=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc	2011-06-03 16:15:01 +0000
+++ b/storage/perfschema/pfs.cc	2011-06-06 20:07:48 +0000
@@ -38,7 +38,14 @@
 #include "pfs_internal_stat.h"
 #include "sql_error.h"
 
-#define PFS_NOTHING
+#undef PFS_NOTHING_MUTEX
+#undef PFS_NOTHING_RWLOCK
+#undef PFS_NOTHING_COND
+#undef PFS_NOTHING_FILE
+#undef PFS_NOTHING_THREAD
+#undef PFS_NOTHING_TABLE
+#undef PFS_NOTHING_STAGE
+#undef PFS_NOTHING_STATEMENT
 
 /**
   @page PAGE_PERFORMANCE_SCHEMA The Performance Schema main page
@@ -1199,7 +1206,7 @@ void pfs_register_mutex_v1(const char *c
 {
   PFS_INTERNAL_INC(pfs_internal_register_mutex_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_MUTEX
   return;
 #else
   REGISTER_BODY_V1(PSI_mutex_key,
@@ -1218,7 +1225,7 @@ void pfs_register_rwlock_v1(const char *
 {
   PFS_INTERNAL_INC(pfs_internal_register_rwlock_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_RWLOCK
   return;
 #else
   REGISTER_BODY_V1(PSI_rwlock_key,
@@ -1237,7 +1244,7 @@ void pfs_register_cond_v1(const char *ca
 {
   PFS_INTERNAL_INC(pfs_internal_register_cond_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_COND
   return;
 #else
   REGISTER_BODY_V1(PSI_cond_key,
@@ -1256,7 +1263,7 @@ void pfs_register_thread_v1(const char *
 {
   PFS_INTERNAL_INC(pfs_internal_register_thread_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_THREAD
   return;
 #else
   REGISTER_BODY_V1(PSI_thread_key,
@@ -1275,7 +1282,7 @@ void pfs_register_file_v1(const char *ca
 {
   PFS_INTERNAL_INC(pfs_internal_register_file_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_FILE
   return;
 #else
   REGISTER_BODY_V1(PSI_file_key,
@@ -1290,7 +1297,7 @@ void pfs_register_stage_v1(const char *c
 {
   PFS_INTERNAL_INC(pfs_internal_register_stage_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STAGE
   return;
 #else
   char formatted_name[PFS_MAX_INFO_NAME_LENGTH];
@@ -1339,7 +1346,7 @@ void pfs_register_statement_v1(const cha
 {
   PFS_INTERNAL_INC(pfs_internal_register_statement_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   char formatted_name[PFS_MAX_INFO_NAME_LENGTH];
@@ -1398,7 +1405,7 @@ pfs_init_mutex_v1(PSI_mutex_key key, con
 {
   PFS_INTERNAL_INC(pfs_internal_init_mutex_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_MUTEX
   return NULL;
 #else
   INIT_BODY_V1(mutex, key, identity);
@@ -1413,7 +1420,7 @@ void pfs_destroy_mutex_v1(PSI_mutex* mut
 {
   PFS_INTERNAL_INC(pfs_internal_destroy_mutex_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_MUTEX
   return;
 #else
   PFS_mutex *pfs= reinterpret_cast<PFS_mutex*> (mutex);
@@ -1434,7 +1441,7 @@ pfs_init_rwlock_v1(PSI_rwlock_key key, c
 {
   PFS_INTERNAL_INC(pfs_internal_init_rwlock_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_RWLOCK
   return NULL;
 #else
   INIT_BODY_V1(rwlock, key, identity);
@@ -1449,7 +1456,7 @@ void pfs_destroy_rwlock_v1(PSI_rwlock* r
 {
   PFS_INTERNAL_INC(pfs_internal_destroy_rwlock_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_RWLOCK
   return;
 #else
   PFS_rwlock *pfs= reinterpret_cast<PFS_rwlock*> (rwlock);
@@ -1470,7 +1477,7 @@ pfs_init_cond_v1(PSI_cond_key key, const
 {
   PFS_INTERNAL_INC(pfs_internal_init_cond_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_COND
   return NULL;
 #else
   INIT_BODY_V1(cond, key, identity);
@@ -1485,7 +1492,7 @@ void pfs_destroy_cond_v1(PSI_cond* cond)
 {
   PFS_INTERNAL_INC(pfs_internal_destroy_cond_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_COND
   return;
 #else
   PFS_cond *pfs= reinterpret_cast<PFS_cond*> (cond);
@@ -1506,7 +1513,7 @@ pfs_get_table_share_v1(my_bool temporary
 {
   PFS_INTERNAL_INC(pfs_internal_get_table_share_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_TABLE
   return NULL;
 #else
   /* An instrumented thread is required, for LF_PINS. */
@@ -1527,7 +1534,7 @@ void pfs_release_table_share_v1(PSI_tabl
 {
   PFS_INTERNAL_INC(pfs_internal_release_table_share_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_TABLE
   return;
 #else
   PFS_table_share* pfs= reinterpret_cast<PFS_table_share*> (share);
@@ -1549,7 +1556,7 @@ pfs_drop_table_share_v1(const char *sche
 {
   PFS_INTERNAL_INC(pfs_internal_drop_table_share_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_TABLE
   return;
 #else
   PFS_thread *pfs_thread= get_pfs_thread();
@@ -1570,7 +1577,7 @@ pfs_open_table_v1(PSI_table_share *share
 {
   PFS_INTERNAL_INC(pfs_internal_open_table_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_TABLE
   return NULL;
 #else
   PFS_table_share *pfs_table_share= reinterpret_cast<PFS_table_share*> (share);
@@ -1604,7 +1611,7 @@ void pfs_close_table_v1(PSI_table *table
 {
   PFS_INTERNAL_INC(pfs_internal_close_table_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_TABLE
   return;
 #else
   PFS_table *pfs= reinterpret_cast<PFS_table*> (table);
@@ -1625,7 +1632,7 @@ void pfs_create_file_v1(PSI_file_key key
 {
   PFS_INTERNAL_INC(pfs_internal_create_file_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_FILE
   return;
 #else
   if (! flag_global_instrumentation)
@@ -1766,7 +1773,7 @@ pfs_new_thread_v1(PSI_thread_key key, co
 {
   PFS_INTERNAL_INC(pfs_internal_new_thread_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_THREAD
   return NULL;
 #else
   PFS_thread *pfs;
@@ -1789,7 +1796,7 @@ void pfs_set_thread_id_v1(PSI_thread *th
 {
   PFS_INTERNAL_INC(pfs_internal_set_thread_id_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_THREAD
   return;
 #else
   DBUG_ASSERT(thread);
@@ -1807,7 +1814,7 @@ pfs_get_thread_v1(void)
 {
   PFS_INTERNAL_INC(pfs_internal_get_thread_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_THREAD
   return NULL;
 #else
   if (unlikely(! THR_PFS_initialized))
@@ -1825,7 +1832,7 @@ void pfs_set_thread_user_v1(const char *
 {
   PFS_INTERNAL_INC(pfs_internal_set_thread_user_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_THREAD
   return;
 #else
   PFS_thread *pfs= get_pfs_thread();
@@ -1878,7 +1885,7 @@ void pfs_set_thread_user_host_v1(const c
 {
   PFS_INTERNAL_INC(pfs_internal_set_thread_user_host_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_THREAD
   return;
 #else
   PFS_thread *pfs= get_pfs_thread();
@@ -1934,7 +1941,7 @@ void pfs_set_thread_db_v1(const char* db
 {
   PFS_INTERNAL_INC(pfs_internal_set_thread_db_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_THREAD
   return;
 #else
   PFS_thread *pfs= get_pfs_thread();
@@ -1962,7 +1969,7 @@ void pfs_set_thread_command_v1(int comma
 {
   PFS_INTERNAL_INC(pfs_internal_set_thread_command_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_THREAD
   return;
 #else
   PFS_thread *pfs= get_pfs_thread();
@@ -1987,7 +1994,7 @@ void pfs_set_thread_start_time_v1(time_t
 {
   PFS_INTERNAL_INC(pfs_internal_set_thread_start_time_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_THREAD
   return;
 #else
   PFS_thread *pfs= get_pfs_thread();
@@ -2009,7 +2016,7 @@ void pfs_set_thread_state_v1(const char*
 {
   PFS_INTERNAL_INC(pfs_internal_set_thread_state_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_THREAD
   return;
 #else
   PFS_thread *pfs= get_pfs_thread();
@@ -2034,7 +2041,7 @@ void pfs_set_thread_info_v1(const char*
 {
   PFS_INTERNAL_INC(pfs_internal_set_thread_info_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_THREAD
   return;
 #else
   PFS_thread *pfs= get_pfs_thread();
@@ -2057,7 +2064,7 @@ void pfs_set_thread_v1(PSI_thread* threa
 {
   PFS_INTERNAL_INC(pfs_internal_set_thread_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_THREAD
   return;
 #else
   PFS_thread *pfs= reinterpret_cast<PFS_thread*> (thread);
@@ -2074,7 +2081,7 @@ void pfs_delete_current_thread_v1(void)
 {
   PFS_INTERNAL_INC(pfs_internal_delete_current_thread_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_THREAD
   return;
 #else
   PFS_thread *thread= get_pfs_thread();
@@ -2096,7 +2103,7 @@ void pfs_delete_thread_v1(PSI_thread *th
 {
   PFS_INTERNAL_INC(pfs_internal_delete_thread_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_THREAD
   return;
 #else
   PFS_thread *pfs= reinterpret_cast<PFS_thread*> (thread);
@@ -2119,24 +2126,20 @@ pfs_get_thread_mutex_locker_v1(PSI_mutex
 {
   PFS_INTERNAL_INC(pfs_internal_get_thread_mutex_locker_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_MUTEX
   return NULL;
 #else
   DBUG_ASSERT((int) op >= 0);
   DBUG_ASSERT((uint) op < array_elements(mutex_operation_map));
   DBUG_ASSERT(state != NULL);
 
-  if (! flag_global_instrumentation)
-    return NULL;
-
   PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex*> (mutex);
   if (unlikely(pfs_mutex == NULL))
     return NULL;
 
   DBUG_ASSERT(pfs_mutex->m_class != NULL);
 
-  PFS_mutex_class *klass= pfs_mutex->m_class;
-  if (! klass->m_enabled)
+  if (! pfs_mutex->m_enabled)
     return NULL;
 
   register uint flags;
@@ -2151,7 +2154,7 @@ pfs_get_thread_mutex_locker_v1(PSI_mutex
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (klass->m_timed)
+    if (pfs_mutex->m_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -2171,7 +2174,7 @@ pfs_get_thread_mutex_locker_v1(PSI_mutex
       wait->m_nesting_event_type= parent_event->m_event_type;
 
       wait->m_thread= pfs_thread;
-      wait->m_class= klass;
+      wait->m_class= pfs_mutex->m_class;
       wait->m_timer_start= 0;
       wait->m_timer_end= 0;
       wait->m_object_instance_addr= pfs_mutex->m_identity;
@@ -2184,7 +2187,7 @@ pfs_get_thread_mutex_locker_v1(PSI_mutex
   }
   else
   {
-    if (klass->m_timed)
+    if (pfs_mutex->m_timed)
     {
       flags= STATE_FLAG_TIMED;
       state->m_thread= NULL;
@@ -2217,24 +2220,20 @@ pfs_get_thread_rwlock_locker_v1(PSI_rwlo
 {
   PFS_INTERNAL_INC(pfs_internal_get_thread_rwlock_locker_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_RWLOCK
   return NULL;
 #else
   DBUG_ASSERT(static_cast<int> (op) >= 0);
   DBUG_ASSERT(static_cast<uint> (op) < array_elements(rwlock_operation_map));
   DBUG_ASSERT(state != NULL);
 
-  if (! flag_global_instrumentation)
-    return NULL;
-
   PFS_rwlock *pfs_rwlock= reinterpret_cast<PFS_rwlock*> (rwlock);
   if (unlikely(pfs_rwlock == NULL))
     return NULL;
 
   DBUG_ASSERT(pfs_rwlock->m_class != NULL);
 
-  PFS_rwlock_class *klass= pfs_rwlock->m_class;
-  if (! klass->m_enabled)
+  if (! pfs_rwlock->m_enabled)
     return NULL;
 
   register uint flags;
@@ -2249,7 +2248,7 @@ pfs_get_thread_rwlock_locker_v1(PSI_rwlo
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (klass->m_timed)
+    if (pfs_rwlock->m_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -2269,7 +2268,7 @@ pfs_get_thread_rwlock_locker_v1(PSI_rwlo
       wait->m_nesting_event_type= parent_event->m_event_type;
 
       wait->m_thread= pfs_thread;
-      wait->m_class= klass;
+      wait->m_class= pfs_rwlock->m_class;
       wait->m_timer_start= 0;
       wait->m_timer_end= 0;
       wait->m_object_instance_addr= pfs_rwlock->m_identity;
@@ -2282,7 +2281,7 @@ pfs_get_thread_rwlock_locker_v1(PSI_rwlo
   }
   else
   {
-    if (klass->m_timed)
+    if (pfs_rwlock->m_timed)
     {
       flags= STATE_FLAG_TIMED;
       state->m_thread= NULL;
@@ -2316,7 +2315,7 @@ pfs_get_thread_cond_locker_v1(PSI_cond_l
 {
   PFS_INTERNAL_INC(pfs_internal_get_thread_cond_locker_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_COND
   return NULL;
 #else
   /*
@@ -2334,22 +2333,18 @@ pfs_get_thread_cond_locker_v1(PSI_cond_l
   DBUG_ASSERT(static_cast<uint> (op) < array_elements(cond_operation_map));
   DBUG_ASSERT(state != NULL);
 
-  if (! flag_global_instrumentation)
-    return NULL;
-
   PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond);
   if (unlikely(pfs_cond == NULL))
     return NULL;
 
   DBUG_ASSERT(pfs_cond->m_class != NULL);
 
-  PFS_cond_class *klass= pfs_cond->m_class;
-  if (! klass->m_enabled)
+  if (! pfs_cond->m_enabled)
     return NULL;
 
   register uint flags;
 
-  if (klass->m_timed)
+  if (pfs_cond->m_timed)
     state->m_flags= STATE_FLAG_TIMED;
   else
     state->m_flags= 0;
@@ -2364,7 +2359,7 @@ pfs_get_thread_cond_locker_v1(PSI_cond_l
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (klass->m_timed)
+    if (pfs_cond->m_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -2384,7 +2379,7 @@ pfs_get_thread_cond_locker_v1(PSI_cond_l
       wait->m_nesting_event_type= parent_event->m_event_type;
 
       wait->m_thread= pfs_thread;
-      wait->m_class= klass;
+      wait->m_class= pfs_cond->m_class;
       wait->m_timer_start= 0;
       wait->m_timer_end= 0;
       wait->m_object_instance_addr= pfs_cond->m_identity;
@@ -2397,7 +2392,7 @@ pfs_get_thread_cond_locker_v1(PSI_cond_l
   }
   else
   {
-    if (klass->m_timed)
+    if (pfs_cond->m_timed)
       flags= STATE_FLAG_TIMED;
     else
     {
@@ -2472,16 +2467,13 @@ pfs_get_thread_table_io_locker_v1(PSI_ta
 {
   PFS_INTERNAL_INC(pfs_internal_get_thread_table_io_locker_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_TABLE
   return NULL;
 #else
   DBUG_ASSERT(static_cast<int> (op) >= 0);
   DBUG_ASSERT(static_cast<uint> (op) < array_elements(table_io_operation_map));
   DBUG_ASSERT(state != NULL);
 
-  if (! flag_global_instrumentation)
-    return NULL;
-
   PFS_table *pfs_table= reinterpret_cast<PFS_table*> (table);
 
   if (unlikely(pfs_table == NULL))
@@ -2489,13 +2481,9 @@ pfs_get_thread_table_io_locker_v1(PSI_ta
 
   DBUG_ASSERT(pfs_table->m_share != NULL);
 
-  PFS_table_share *share= pfs_table->m_share;
-  if (! share->m_io_enabled)
+  if (! pfs_table->m_io_enabled)
     return NULL;
 
-  PFS_instr_class *klass;
-  klass= &global_table_io_class;
-
   register uint flags;
 
   if (flag_thread_instrumentation)
@@ -2508,7 +2496,7 @@ pfs_get_thread_table_io_locker_v1(PSI_ta
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (share->m_io_timed)
+    if (pfs_table->m_io_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -2522,8 +2510,9 @@ pfs_get_thread_table_io_locker_v1(PSI_ta
       state->m_wait= wait;
       flags|= STATE_FLAG_EVENT;
 
+      PFS_table_share *share= pfs_table->m_share;
       wait->m_thread= pfs_thread;
-      wait->m_class= klass;
+      wait->m_class= &global_table_io_class;
       wait->m_timer_start= 0;
       wait->m_timer_end= 0;
       wait->m_object_instance_addr= pfs_table->m_identity;
@@ -2542,7 +2531,7 @@ pfs_get_thread_table_io_locker_v1(PSI_ta
   }
   else
   {
-    if (share->m_io_timed)
+    if (pfs_table->m_io_timed)
     {
       flags= STATE_FLAG_TIMED;
     }
@@ -2571,15 +2560,12 @@ pfs_get_thread_table_lock_locker_v1(PSI_
 {
   PFS_INTERNAL_INC(pfs_internal_get_thread_table_lock_locker_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_TABLE
   return NULL;
 #else
   DBUG_ASSERT(state != NULL);
   DBUG_ASSERT((op == PSI_TABLE_LOCK) || (op == PSI_TABLE_EXTERNAL_LOCK));
 
-  if (! flag_global_instrumentation)
-    return NULL;
-
   PFS_table *pfs_table= reinterpret_cast<PFS_table*> (table);
 
   if (unlikely(pfs_table == NULL))
@@ -2587,13 +2573,10 @@ pfs_get_thread_table_lock_locker_v1(PSI_
 
   DBUG_ASSERT(pfs_table->m_share != NULL);
 
-  PFS_table_share *share= pfs_table->m_share;
-  if (! share->m_lock_enabled)
+  if (! pfs_table->m_lock_enabled)
     return NULL;
 
-  PFS_instr_class *klass;
   PFS_TL_LOCK_TYPE lock_type;
-  klass= &global_table_lock_class;
 
   switch (op)
   {
@@ -2628,7 +2611,7 @@ pfs_get_thread_table_lock_locker_v1(PSI_
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (share->m_lock_timed)
+    if (pfs_table->m_lock_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -2642,8 +2625,9 @@ pfs_get_thread_table_lock_locker_v1(PSI_
       state->m_wait= wait;
       flags|= STATE_FLAG_EVENT;
 
+      PFS_table_share *share= pfs_table->m_share;
       wait->m_thread= pfs_thread;
-      wait->m_class= klass;
+      wait->m_class= &global_table_lock_class;
       wait->m_timer_start= 0;
       wait->m_timer_end= 0;
       wait->m_object_instance_addr= pfs_table->m_identity;
@@ -2662,7 +2646,7 @@ pfs_get_thread_table_lock_locker_v1(PSI_
   }
   else
   {
-    if (share->m_lock_timed)
+    if (pfs_table->m_lock_timed)
     {
       flags= STATE_FLAG_TIMED;
     }
@@ -2692,7 +2676,7 @@ pfs_get_thread_file_name_locker_v1(PSI_f
 {
   PFS_INTERNAL_INC(pfs_internal_get_thread_file_name_locker_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_FILE
   return NULL;
 #else
   DBUG_ASSERT(static_cast<int> (op) >= 0);
@@ -2775,24 +2759,20 @@ pfs_get_thread_file_stream_locker_v1(PSI
 {
   PFS_INTERNAL_INC(pfs_internal_get_thread_file_stream_locker_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_FILE
   return NULL;
 #else
   DBUG_ASSERT(static_cast<int> (op) >= 0);
   DBUG_ASSERT(static_cast<uint> (op) < array_elements(file_operation_map));
   DBUG_ASSERT(state != NULL);
 
-  if (! flag_global_instrumentation)
-    return NULL;
-
   PFS_file *pfs_file= reinterpret_cast<PFS_file*> (file);
   if (unlikely(pfs_file == NULL))
     return NULL;
 
   DBUG_ASSERT(pfs_file->m_class != NULL);
 
-  PFS_file_class *klass= pfs_file->m_class;
-  if (! klass->m_enabled)
+  if (! pfs_file->m_enabled)
     return NULL;
 
   register uint flags;
@@ -2807,7 +2787,7 @@ pfs_get_thread_file_stream_locker_v1(PSI
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (klass->m_timed)
+    if (pfs_file->m_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -2827,7 +2807,7 @@ pfs_get_thread_file_stream_locker_v1(PSI
       wait->m_nesting_event_type= parent_event->m_event_type;
 
       wait->m_thread= pfs_thread;
-      wait->m_class= klass;
+      wait->m_class= pfs_file->m_class;
       wait->m_timer_start= 0;
       wait->m_timer_end= 0;
       wait->m_object_instance_addr= pfs_file;
@@ -2843,7 +2823,7 @@ pfs_get_thread_file_stream_locker_v1(PSI
   else
   {
     state->m_thread= NULL;
-    if (klass->m_timed)
+    if (pfs_file->m_timed)
     {
       flags= STATE_FLAG_TIMED;
     }
@@ -2871,7 +2851,7 @@ pfs_get_thread_file_descriptor_locker_v1
 {
   PFS_INTERNAL_INC(pfs_internal_get_thread_file_descriptor_locker_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_FILE
   return NULL;
 #else
   int index= static_cast<int> (file);
@@ -2901,8 +2881,7 @@ pfs_get_thread_file_descriptor_locker_v1
     file_handle_array[index]= NULL;
 
   DBUG_ASSERT(pfs_file->m_class != NULL);
-  PFS_instr_class *klass= pfs_file->m_class;
-  if (! klass->m_enabled)
+  if (! pfs_file->m_enabled)
     return NULL;
 
   register uint flags;
@@ -2917,7 +2896,7 @@ pfs_get_thread_file_descriptor_locker_v1
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (klass->m_timed)
+    if (pfs_file->m_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -2937,7 +2916,7 @@ pfs_get_thread_file_descriptor_locker_v1
       wait->m_nesting_event_type= parent_event->m_event_type;
 
       wait->m_thread= pfs_thread;
-      wait->m_class= klass;
+      wait->m_class= pfs_file->m_class;
       wait->m_timer_start= 0;
       wait->m_timer_end= 0;
       wait->m_object_instance_addr= pfs_file;
@@ -2953,7 +2932,7 @@ pfs_get_thread_file_descriptor_locker_v1
   else
   {
     state->m_thread= NULL;
-    if (klass->m_timed)
+    if (pfs_file->m_timed)
     {
       flags= STATE_FLAG_TIMED;
     }
@@ -2979,7 +2958,7 @@ void pfs_unlock_mutex_v1(PSI_mutex *mute
 {
   PFS_INTERNAL_INC(pfs_internal_unlock_mutex_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_MUTEX
   return;
 #else
   PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex*> (mutex);
@@ -3030,7 +3009,7 @@ void pfs_unlock_rwlock_v1(PSI_rwlock *rw
 {
   PFS_INTERNAL_INC(pfs_internal_unlock_rwlock_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_RWLOCK
   return;
 #else
   PFS_rwlock *pfs_rwlock= reinterpret_cast<PFS_rwlock*> (rwlock);
@@ -3119,7 +3098,7 @@ void pfs_signal_cond_v1(PSI_cond* cond)
 {
   PFS_INTERNAL_INC(pfs_internal_signal_cond_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_COND
   return;
 #else
   PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond);
@@ -3139,7 +3118,7 @@ void pfs_broadcast_cond_v1(PSI_cond* con
 {
   PFS_INTERNAL_INC(pfs_internal_broadcast_cond_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_COND
   return;
 #else
   PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond);
@@ -3160,7 +3139,7 @@ void pfs_start_mutex_wait_v1(PSI_mutex_l
 {
   PFS_INTERNAL_INC(pfs_internal_start_mutex_wait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_MUTEX
   return;
 #else
   PSI_mutex_locker_state *state= reinterpret_cast<PSI_mutex_locker_state*> (locker);
@@ -3195,7 +3174,7 @@ void pfs_end_mutex_wait_v1(PSI_mutex_loc
 {
   PFS_INTERNAL_INC(pfs_internal_end_mutex_wait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_MUTEX
   return;
 #else
   PSI_mutex_locker_state *state= reinterpret_cast<PSI_mutex_locker_state*> (locker);
@@ -3270,7 +3249,7 @@ void pfs_start_rwlock_rdwait_v1(PSI_rwlo
 {
   PFS_INTERNAL_INC(pfs_internal_start_rwlock_rdwait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_RWLOCK
   return;
 #else
   ulonglong timer_start= 0;
@@ -3303,7 +3282,7 @@ void pfs_end_rwlock_rdwait_v1(PSI_rwlock
 {
   PFS_INTERNAL_INC(pfs_internal_end_rwlock_rdwait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_RWLOCK
   return;
 #else
   PSI_rwlock_locker_state *state= reinterpret_cast<PSI_rwlock_locker_state*> (locker);
@@ -3386,7 +3365,7 @@ void pfs_start_rwlock_wrwait_v1(PSI_rwlo
 {
   PFS_INTERNAL_INC(pfs_internal_start_rwlock_wrwait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_RWLOCK
   return;
 #else
   ulonglong timer_start= 0;
@@ -3419,7 +3398,7 @@ void pfs_end_rwlock_wrwait_v1(PSI_rwlock
 {
   PFS_INTERNAL_INC(pfs_internal_end_rwlock_wrwait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_RWLOCK
   return;
 #else
   PSI_rwlock_locker_state *state= reinterpret_cast<PSI_rwlock_locker_state*> (locker);
@@ -3495,7 +3474,7 @@ void pfs_start_cond_wait_v1(PSI_cond_loc
 {
   PFS_INTERNAL_INC(pfs_internal_start_cond_wait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_COND
   return;
 #else
   ulonglong timer_start= 0;
@@ -3528,7 +3507,7 @@ void pfs_end_cond_wait_v1(PSI_cond_locke
 {
   PFS_INTERNAL_INC(pfs_internal_end_cond_wait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_COND
   return;
 #else
   PSI_cond_locker_state *state= reinterpret_cast<PSI_cond_locker_state*> (locker);
@@ -3597,7 +3576,7 @@ void pfs_start_table_io_wait_v1(PSI_tabl
 {
   PFS_INTERNAL_INC(pfs_internal_start_table_io_wait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_TABLE
   return;
 #else
   ulonglong timer_start= 0;
@@ -3632,7 +3611,7 @@ void pfs_end_table_io_wait_v1(PSI_table_
 {
   PFS_INTERNAL_INC(pfs_internal_end_table_io_wait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_TABLE
   return;
 #else
   PSI_table_locker_state *state= reinterpret_cast<PSI_table_locker_state*> (locker);
@@ -3709,7 +3688,7 @@ void pfs_start_table_lock_wait_v1(PSI_ta
 {
   PFS_INTERNAL_INC(pfs_internal_start_table_lock_wait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_TABLE
   return;
 #else
   ulonglong timer_start= 0;
@@ -3744,7 +3723,7 @@ void pfs_end_table_lock_wait_v1(PSI_tabl
 {
   PFS_INTERNAL_INC(pfs_internal_end_table_lock_wait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_TABLE
   return;
 #else
   PSI_table_locker_state *state= reinterpret_cast<PSI_table_locker_state*> (locker);
@@ -3807,7 +3786,7 @@ PSI_file* pfs_start_file_open_wait_v1(PS
 {
   PFS_INTERNAL_INC(pfs_internal_start_file_open_wait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_FILE
   return NULL;
 #else
   PSI_file_locker_state *state= reinterpret_cast<PSI_file_locker_state*> (locker);
@@ -3827,7 +3806,7 @@ void pfs_end_file_open_wait_v1(PSI_file_
 {
   PFS_INTERNAL_INC(pfs_internal_end_file_open_wait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_FILE
   return;
 #else
   pfs_end_file_wait_v1(locker, 0);
@@ -3843,7 +3822,7 @@ void pfs_end_file_open_wait_and_bind_to_
 {
   PFS_INTERNAL_INC(pfs_internal_end_file_open_wait_and_bind_to_descriptor_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_FILE
   return;
 #else
   int index= (int) file;
@@ -3880,7 +3859,7 @@ void pfs_start_file_wait_v1(PSI_file_loc
 {
   PFS_INTERNAL_INC(pfs_internal_start_file_wait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_FILE
   return;
 #else
   ulonglong timer_start= 0;
@@ -3917,7 +3896,7 @@ void pfs_end_file_wait_v1(PSI_file_locke
 {
   PFS_INTERNAL_INC(pfs_internal_end_file_wait_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_FILE
   return;
 #else
   PSI_file_locker_state *state= reinterpret_cast<PSI_file_locker_state*> (locker);
@@ -4007,7 +3986,7 @@ void pfs_start_stage_v1(PSI_stage_key ke
 {
   PFS_INTERNAL_INC(pfs_internal_start_stage_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STAGE
   return;
 #else
   ulonglong timer_value= 0;
@@ -4106,7 +4085,7 @@ void pfs_end_stage_v1()
 {
   PFS_INTERNAL_INC(pfs_internal_end_stage_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STAGE
   return;
 #else
   ulonglong timer_value= 0;
@@ -4172,7 +4151,7 @@ pfs_get_thread_statement_locker_v1(PSI_s
 {
   PFS_INTERNAL_INC(pfs_internal_get_thread_statement_locker_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return NULL;
 #else
   DBUG_ASSERT(state != NULL);
@@ -4297,7 +4276,7 @@ pfs_refine_statement_v1(PSI_statement_lo
 {
   PFS_INTERNAL_INC(pfs_internal_refine_statement_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return NULL;
 #else
   PSI_statement_locker_state *state= reinterpret_cast<PSI_statement_locker_state*> (locker);
@@ -4350,7 +4329,7 @@ void pfs_start_statement_v1(PSI_statemen
 {
   PFS_INTERNAL_INC(pfs_internal_start_statement_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   PSI_statement_locker_state *state= reinterpret_cast<PSI_statement_locker_state*> (locker);
@@ -4389,7 +4368,7 @@ void pfs_set_statement_text_v1(PSI_state
 {
   PFS_INTERNAL_INC(pfs_internal_set_statement_text_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   PSI_statement_locker_state *state= reinterpret_cast<PSI_statement_locker_state*> (locker);
@@ -4454,7 +4433,7 @@ void pfs_set_statement_lock_time_v1(PSI_
 {
   PFS_INTERNAL_INC(pfs_internal_set_statement_lock_time_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   SET_STATEMENT_ATTR_BODY(locker, m_lock_time, count);
@@ -4466,7 +4445,7 @@ void pfs_set_statement_rows_sent_v1(PSI_
 {
   PFS_INTERNAL_INC(pfs_internal_set_statement_rows_sent_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   SET_STATEMENT_ATTR_BODY(locker, m_rows_sent, count);
@@ -4478,7 +4457,7 @@ void pfs_set_statement_rows_examined_v1(
 {
   PFS_INTERNAL_INC(pfs_internal_set_statement_rows_examined_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   SET_STATEMENT_ATTR_BODY(locker, m_rows_examined, count);
@@ -4490,7 +4469,7 @@ void pfs_inc_statement_created_tmp_disk_
 {
   PFS_INTERNAL_INC(pfs_internal_inc_statement_created_tmp_disk_tables_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   INC_STATEMENT_ATTR_BODY(locker, m_created_tmp_disk_tables, count);
@@ -4502,7 +4481,7 @@ void pfs_inc_statement_created_tmp_table
 {
   PFS_INTERNAL_INC(pfs_internal_inc_statement_created_tmp_tables_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   INC_STATEMENT_ATTR_BODY(locker, m_created_tmp_tables, count);
@@ -4514,7 +4493,7 @@ void pfs_inc_statement_select_full_join_
 {
   PFS_INTERNAL_INC(pfs_internal_inc_statement_select_full_join_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   INC_STATEMENT_ATTR_BODY(locker, m_select_full_join, count);
@@ -4526,7 +4505,7 @@ void pfs_inc_statement_select_full_range
 {
   PFS_INTERNAL_INC(pfs_internal_inc_statement_select_full_range_join_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   INC_STATEMENT_ATTR_BODY(locker, m_select_full_range_join, count);
@@ -4538,7 +4517,7 @@ void pfs_inc_statement_select_range_v1(P
 {
   PFS_INTERNAL_INC(pfs_internal_inc_statement_select_range_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   INC_STATEMENT_ATTR_BODY(locker, m_select_range, count);
@@ -4550,7 +4529,7 @@ void pfs_inc_statement_select_range_chec
 {
   PFS_INTERNAL_INC(pfs_internal_inc_statement_select_range_check_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   INC_STATEMENT_ATTR_BODY(locker, m_select_range_check, count);
@@ -4562,7 +4541,7 @@ void pfs_inc_statement_select_scan_v1(PS
 {
   PFS_INTERNAL_INC(pfs_internal_inc_statement_select_scan_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   INC_STATEMENT_ATTR_BODY(locker, m_select_scan, count);
@@ -4574,7 +4553,7 @@ void pfs_inc_statement_sort_merge_passes
 {
   PFS_INTERNAL_INC(pfs_internal_inc_statement_sort_merge_passes_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   INC_STATEMENT_ATTR_BODY(locker, m_sort_merge_passes, count);
@@ -4586,7 +4565,7 @@ void pfs_inc_statement_sort_range_v1(PSI
 {
   PFS_INTERNAL_INC(pfs_internal_inc_statement_sort_range_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   INC_STATEMENT_ATTR_BODY(locker, m_sort_range, count);
@@ -4598,7 +4577,7 @@ void pfs_inc_statement_sort_rows_v1(PSI_
 {
   PFS_INTERNAL_INC(pfs_internal_inc_statement_sort_rows_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   INC_STATEMENT_ATTR_BODY(locker, m_sort_rows, count);
@@ -4610,7 +4589,7 @@ void pfs_inc_statement_sort_scan_v1(PSI_
 {
   PFS_INTERNAL_INC(pfs_internal_inc_statement_sort_scan_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   INC_STATEMENT_ATTR_BODY(locker, m_sort_scan, count);
@@ -4621,7 +4600,7 @@ void pfs_set_statement_no_index_used_v1(
 {
   PFS_INTERNAL_INC(pfs_internal_set_statement_no_index_used_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   SET_STATEMENT_ATTR_BODY(locker, m_no_index_used, 1);
@@ -4632,7 +4611,7 @@ void pfs_set_statement_no_good_index_use
 {
   PFS_INTERNAL_INC(pfs_internal_set_statement_no_good_index_used_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   SET_STATEMENT_ATTR_BODY(locker, m_no_good_index_used, 1);
@@ -4643,7 +4622,7 @@ void pfs_end_statement_v1(PSI_statement_
 {
   PFS_INTERNAL_INC(pfs_internal_end_statement_v1);
 
-#ifdef PFS_NOTHING
+#ifdef PFS_NOTHING_STATEMENT
   return;
 #else
   PSI_statement_locker_state *state= reinterpret_cast<PSI_statement_locker_state*> (locker);

=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc	2011-05-26 09:05:41 +0000
+++ b/storage/perfschema/pfs_instr.cc	2011-06-06 20:07:48 +0000
@@ -587,6 +587,7 @@ PFS_mutex* create_mutex(PFS_mutex_class
         {
           pfs->m_identity= identity;
           pfs->m_class= klass;
+          pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
           pfs->m_wait_stat.reset();
           pfs->m_lock_stat.reset();
           pfs->m_owner= NULL;
@@ -627,6 +628,7 @@ PFS_mutex* create_mutex(PFS_mutex_class
       {
         pfs->m_identity= identity;
         pfs->m_class= klass;
+        pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
         pfs->m_wait_stat.reset();
         pfs->m_lock_stat.reset();
         pfs->m_owner= NULL;
@@ -690,6 +692,7 @@ PFS_rwlock* create_rwlock(PFS_rwlock_cla
         {
           pfs->m_identity= identity;
           pfs->m_class= klass;
+          pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
           pfs->m_wait_stat.reset();
           pfs->m_lock.dirty_to_allocated();
           pfs->m_read_lock_stat.reset();
@@ -733,6 +736,7 @@ PFS_rwlock* create_rwlock(PFS_rwlock_cla
       {
         pfs->m_identity= identity;
         pfs->m_class= klass;
+        pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
         pfs->m_wait_stat.reset();
         pfs->m_lock.dirty_to_allocated();
         pfs->m_read_lock_stat.reset();
@@ -797,6 +801,7 @@ PFS_cond* create_cond(PFS_cond_class *kl
         {
           pfs->m_identity= identity;
           pfs->m_class= klass;
+          pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
           pfs->m_cond_stat.m_signal_count= 0;
           pfs->m_cond_stat.m_broadcast_count= 0;
           pfs->m_wait_stat.reset();
@@ -1197,6 +1202,7 @@ search:
         if (pfs->m_lock.free_to_dirty())
         {
           pfs->m_class= klass;
+          pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
           strncpy(pfs->m_filename, normalized_filename, normalized_length);
           pfs->m_filename[normalized_length]= '\0';
           pfs->m_filename_length= normalized_length;
@@ -1310,6 +1316,12 @@ PFS_table* create_table(PFS_table_share
         {
           pfs->m_identity= identity;
           pfs->m_share= share;
+          pfs->m_io_enabled= share->m_io_enabled &&
+            flag_global_instrumentation && global_table_io_class.m_enabled;
+          pfs->m_io_timed= share->m_io_timed && global_table_io_class.m_timed;
+          pfs->m_lock_enabled= share->m_lock_enabled &&
+            flag_global_instrumentation && global_table_lock_class.m_enabled;
+          pfs->m_lock_timed= share->m_lock_timed && global_table_lock_class.m_timed;
           share->inc_refcount();
           pfs->m_table_stat.reset();
           pfs->m_opening_thread= opening_thread;
@@ -1628,4 +1640,130 @@ void aggregate_thread_statements(PFS_thr
                            global_instr_class_statements_array);
 }
 
+static void update_mutex_derived_flags()
+{
+  PFS_mutex *pfs= mutex_array;
+  PFS_mutex *pfs_last= mutex_array + mutex_max;
+  PFS_mutex_class *klass;
+
+  for ( ; pfs < pfs_last; pfs++)
+  {
+    klass= sanitize_mutex_class(pfs->m_class);
+    if (likely(klass != NULL))
+    {
+      pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
+      pfs->m_timed= klass->m_timed;
+    }
+    else
+    {
+      pfs->m_enabled= false;
+      pfs->m_timed= false;
+    }
+  }
+}
+
+static void update_rwlock_derived_flags()
+{
+  PFS_rwlock *pfs= rwlock_array;
+  PFS_rwlock *pfs_last= rwlock_array + rwlock_max;
+  PFS_rwlock_class *klass;
+
+  for ( ; pfs < pfs_last; pfs++)
+  {
+    klass= sanitize_rwlock_class(pfs->m_class);
+    if (likely(klass != NULL))
+    {
+      pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
+      pfs->m_timed= klass->m_timed;
+    }
+    else
+    {
+      pfs->m_enabled= false;
+      pfs->m_timed= false;
+    }
+  }
+}
+
+static void update_cond_derived_flags()
+{
+  PFS_cond *pfs= cond_array;
+  PFS_cond *pfs_last= cond_array + cond_max;
+  PFS_cond_class *klass;
+
+  for ( ; pfs < pfs_last; pfs++)
+  {
+    klass= sanitize_cond_class(pfs->m_class);
+    if (likely(klass != NULL))
+    {
+      pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
+      pfs->m_timed= klass->m_timed;
+    }
+    else
+    {
+      pfs->m_enabled= false;
+      pfs->m_timed= false;
+    }
+  }
+}
+
+static void update_file_derived_flags()
+{
+  PFS_file *pfs= file_array;
+  PFS_file *pfs_last= file_array + file_max;
+  PFS_file_class *klass;
+
+  for ( ; pfs < pfs_last; pfs++)
+  {
+    klass= sanitize_file_class(pfs->m_class);
+    if (likely(klass != NULL))
+    {
+      pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
+      pfs->m_timed= klass->m_timed;
+    }
+    else
+    {
+      pfs->m_enabled= false;
+      pfs->m_timed= false;
+    }
+  }
+}
+
+static void update_table_derived_flags()
+{
+  PFS_table *pfs= table_array;
+  PFS_table *pfs_last= table_array + table_max;
+  PFS_table_share *share;
+
+  for ( ; pfs < pfs_last; pfs++)
+  {
+    share= sanitize_table_share(pfs->m_share);
+    if (likely(share != NULL))
+    {
+      pfs->m_io_enabled= share->m_io_enabled &&
+        flag_global_instrumentation && global_table_io_class.m_enabled;
+      pfs->m_io_timed= share->m_io_timed && global_table_io_class.m_timed;
+      pfs->m_lock_enabled= share->m_lock_enabled &&
+        flag_global_instrumentation && global_table_lock_class.m_enabled;
+      pfs->m_lock_timed= share->m_lock_timed && global_table_lock_class.m_timed;
+    }
+    else
+    {
+      pfs->m_io_enabled= false;
+      pfs->m_io_timed= false;
+      pfs->m_lock_enabled= false;
+      pfs->m_lock_timed= false;
+    }
+  }
+}
+
+void update_instruments_derived_flags()
+{
+  update_mutex_derived_flags();
+  update_rwlock_derived_flags();
+  update_cond_derived_flags();
+  update_file_derived_flags();
+  update_table_derived_flags();
+  /* nothing for stages and statements (no instances) */
+}
+
 /** @} */

=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h	2011-04-04 14:34:42 +0000
+++ b/storage/perfschema/pfs_instr.h	2011-06-06 20:07:48 +0000
@@ -50,6 +50,10 @@ struct PFS_instr
 {
   /** Internal lock. */
   pfs_lock m_lock;
+  /** Enabled flag. */
+  bool m_enabled;
+  /** Timed flag. */
+  bool m_timed;
   /** Instrument wait statistics. */
   PFS_single_stat m_wait_stat;
 };
@@ -138,6 +142,15 @@ struct PFS_file : public PFS_instr
 /** Instrumented table implementation. @see PSI_table. */
 struct PFS_table
 {
+  /** True if table io instrumentation is enabled. */
+  bool m_io_enabled;
+  /** True if table lock instrumentation is enabled. */
+  bool m_lock_enabled;
+  /** True if table io instrumentation is timed. */
+  bool m_io_timed;
+  /** True if table lock instrumentation is timed. */
+  bool m_lock_timed;
+
 public:
   /**
     Aggregate this table handle statistics to the parents.
@@ -485,6 +498,9 @@ void aggregate_thread_waits(PFS_thread *
 void aggregate_thread_stages(PFS_thread *thread);
 void aggregate_thread_statements(PFS_thread *thread);
 
+/** Update derived flags for all instruments. */
+void update_instruments_derived_flags();
+
 /** @} */
 #endif
 

=== modified file 'storage/perfschema/table_setup_consumers.cc'
--- a/storage/perfschema/table_setup_consumers.cc	2011-02-14 14:23:55 +0000
+++ b/storage/perfschema/table_setup_consumers.cc	2011-06-06 20:07:48 +0000
@@ -218,6 +218,8 @@ int table_setup_consumers::update_row_va
     }
   }
 
+  update_instruments_derived_flags();
+
   return 0;
 }
 

=== modified file 'storage/perfschema/table_setup_instruments.cc'
--- a/storage/perfschema/table_setup_instruments.cc	2011-05-13 13:44:31 +0000
+++ b/storage/perfschema/table_setup_instruments.cc	2011-06-06 20:07:48 +0000
@@ -21,6 +21,7 @@
 #include "my_global.h"
 #include "my_pthread.h"
 #include "pfs_instr_class.h"
+#include "pfs_instr.h"
 #include "pfs_column_types.h"
 #include "pfs_column_values.h"
 #include "table_setup_instruments.h"
@@ -245,6 +246,8 @@ int table_setup_instruments::update_row_
     }
   }
 
+  update_instruments_derived_flags();
+
   return 0;
 }
 

=== modified file 'storage/perfschema/unittest/pfs-t.cc'
--- a/storage/perfschema/unittest/pfs-t.cc	2011-03-17 17:39:31 +0000
+++ b/storage/perfschema/unittest/pfs-t.cc	2011-06-06 20:07:48 +0000
@@ -1003,6 +1003,7 @@ void test_locker_disabled()
   rwlock_class_A->m_enabled= true;
   cond_class_A->m_enabled= true;
   file_class_A->m_enabled= true;
+  update_instruments_derived_flags();
 
   mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK);
   ok(mutex_locker == NULL, "no locker (global disabled)");
@@ -1017,7 +1018,7 @@ void test_locker_disabled()
   file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ);
   ok(file_locker == NULL, "no locker (global disabled)");
 
-  /* Pretent the mode is global, counted only */
+  /* Pretend the mode is global, counted only */
   /* ---------------------------------------- */
 
   setup_thread(thread_1, true);
@@ -1031,6 +1032,7 @@ void test_locker_disabled()
   cond_class_A->m_timed= false;
   file_class_A->m_enabled= true;
   file_class_A->m_timed= false;
+  update_instruments_derived_flags();
 
   mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK);
   ok(mutex_locker == NULL, "no locker (global counted)");
@@ -1063,6 +1065,7 @@ void test_locker_disabled()
   rwlock_class_A->m_enabled= false;
   cond_class_A->m_enabled= false;
   file_class_A->m_enabled= false;
+  update_instruments_derived_flags();
 
   mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK);
   ok(mutex_locker == NULL, "no locker");
@@ -1092,6 +1095,7 @@ void test_locker_disabled()
   cond_class_A->m_timed= true;
   file_class_A->m_enabled= true;
   file_class_A->m_timed= true;
+  update_instruments_derived_flags();
 
   mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK);
   ok(mutex_locker != NULL, "locker");
@@ -1127,6 +1131,7 @@ void test_locker_disabled()
   rwlock_class_A->m_enabled= true;
   cond_class_A->m_enabled= true;
   file_class_A->m_enabled= true;
+  update_instruments_derived_flags();
 
   mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK);
   ok(mutex_locker == NULL, "no locker");

=== modified file 'storage/perfschema/unittest/pfs_instr_class-t.cc'
--- a/storage/perfschema/unittest/pfs_instr_class-t.cc	2011-03-08 17:24:34 +0000
+++ b/storage/perfschema/unittest/pfs_instr_class-t.cc	2011-06-06 20:07:48 +0000
@@ -567,6 +567,7 @@ void test_instruments_reset()
 void do_all_tests()
 {
   PFS_atomic::init();
+  pfs_initialized= true;
 
   test_no_registration();
   test_mutex_registration();
@@ -578,6 +579,7 @@ void do_all_tests()
   test_instruments_reset();
 
   PFS_atomic::cleanup();
+  pfs_initialized= false;
 }
 
 int main(int, char **)

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-pfs-tuning branch (marc.alff:3380 to 3381) Marc Alff7 Jun