List:Commits« Previous MessageNext Message »
From:Marc Alff Date:July 5 2011 8:18am
Subject:bzr push into mysql-trunk branch (marc.alff:3243)
View as plain text  
 3243 Marc Alff	2011-07-05 [merge]
      local merge

    added:
      mysql-test/r/mysql_binary_mode.result
      mysql-test/suite/sys_vars/inc/bin_relay_log_basename_index.inc
      mysql-test/suite/sys_vars/r/default_temp_storage_engine_basic.result
      mysql-test/suite/sys_vars/r/log_bin_basename_basic.result
      mysql-test/suite/sys_vars/r/log_bin_index_basic.result
      mysql-test/suite/sys_vars/r/relay_log_basename_basic.result
      mysql-test/suite/sys_vars/t/default_temp_storage_engine_basic.test
      mysql-test/suite/sys_vars/t/log_bin_basename_basic.test
      mysql-test/suite/sys_vars/t/log_bin_index_basic.test
      mysql-test/suite/sys_vars/t/relay_log_basename_basic.test
      mysql-test/t/mysql_binary_mode.test
    modified:
      BUILD/FINISH.sh
      BUILD/autorun.sh
      BUILD/build_mccge.sh
      BUILD/check-cpu
      BUILD/cmake_configure.sh
      BUILD/compile-dist
      BUILD/compile-ia64-debug-max
      BUILD/compile-pentium-debug
      BUILD/compile-pentium-debug-max
      BUILD/compile-pentium-debug-openssl
      BUILD/compile-pentium-debug-yassl
      BUILD/compile-pentium-icc-valgrind-max
      BUILD/compile-pentium-valgrind-max
      BUILD/compile-pentium64-debug
      BUILD/compile-pentium64-debug-max
      BUILD/compile-pentium64-valgrind-max
      BUILD/compile-solaris-amd64-forte
      BUILD/compile-solaris-amd64-forte-debug
      BUILD/compile-solaris-sparc
      BUILD/compile-solaris-sparc-forte
      client/client_priv.h
      client/completion_hash.cc
      client/my_readline.h
      client/mysql.cc
      client/mysql_upgrade.c
      client/mysqladmin.cc
      client/mysqlbinlog.cc
      client/mysqlcheck.c
      client/mysqldump.c
      client/mysqlimport.c
      client/mysqlshow.c
      client/mysqlslap.c
      client/readline.cc
      client/sql_string.cc
      cmake/abi_check.cmake
      cmake/bison.cmake
      cmake/build_configurations/mysql_release.cmake
      cmake/cat.cmake
      cmake/check_minimal_version.cmake
      cmake/cmake_parse_arguments.cmake
      cmake/configure.pl
      cmake/cpack_source_ignore_files.cmake
      cmake/create_initial_db.cmake.in
      cmake/do_abi_check.cmake
      cmake/dtrace.cmake
      cmake/dtrace_prelink.cmake
      cmake/install_layout.cmake
      cmake/install_macros.cmake
      cmake/libutils.cmake
      cmake/maintainer.cmake
      cmake/merge_archives_unix.cmake.in
      cmake/mysql_add_executable.cmake
      cmake/mysql_version.cmake
      cmake/os/AIX.cmake
      cmake/os/Cygwin.cmake
      cmake/os/Darwin.cmake
      cmake/os/HP-UX.cmake
      cmake/os/Linux.cmake
      cmake/os/OS400.cmake
      cmake/os/SunOS.cmake
      cmake/os/Windows.cmake
      cmake/package_name.cmake
      cmake/readline.cmake
      cmake/stack_direction.c
      cmake/versioninfo.rc.in
      cmake/zlib.cmake
      cmd-line-utils/readline/CMakeLists.txt
      dbug/dbug_add_tags.pl
      extra/comp_err.c
      extra/innochecksum.c
      extra/my_print_defaults.c
      extra/mysql_waitpid.c
      extra/perror.c
      extra/replace.c
      extra/resolve_stack_dump.c
      extra/resolveip.c
      extra/yassl/include/cert_wrapper.hpp
      extra/yassl/include/openssl/prefix_ssl.h
      extra/yassl/include/openssl/ssl.h
      extra/yassl/include/openssl/transport_types.h
      extra/yassl/include/socket_wrapper.hpp
      extra/yassl/include/yassl_error.hpp
      extra/yassl/include/yassl_imp.hpp
      extra/yassl/include/yassl_int.hpp
      extra/yassl/include/yassl_types.hpp
      extra/yassl/src/buffer.cpp
      extra/yassl/src/cert_wrapper.cpp
      extra/yassl/src/crypto_wrapper.cpp
      extra/yassl/src/handshake.cpp
      extra/yassl/src/socket_wrapper.cpp
      extra/yassl/src/ssl.cpp
      extra/yassl/src/yassl_error.cpp
      extra/yassl/src/yassl_imp.cpp
      extra/yassl/src/yassl_int.cpp
      extra/yassl/taocrypt/include/asn.hpp
      extra/yassl/taocrypt/include/block.hpp
      extra/yassl/taocrypt/include/blowfish.hpp
      extra/yassl/taocrypt/include/misc.hpp
      extra/yassl/taocrypt/include/modes.hpp
      extra/yassl/taocrypt/include/runtime.hpp
      extra/yassl/taocrypt/src/aes.cpp
      extra/yassl/taocrypt/src/algebra.cpp
      extra/yassl/taocrypt/src/asn.cpp
      extra/yassl/taocrypt/src/blowfish.cpp
      extra/yassl/taocrypt/src/coding.cpp
      extra/yassl/taocrypt/src/integer.cpp
      extra/yassl/taocrypt/src/misc.cpp
      extra/yassl/taocrypt/src/random.cpp
      extra/yassl/taocrypt/src/twofish.cpp
      extra/yassl/testsuite/test.hpp
      include/atomic/gcc_builtins.h
      include/atomic/generic-msvc.h
      include/atomic/nolock.h
      include/atomic/rwlock.h
      include/atomic/solaris.h
      include/atomic/x86-gcc.h
      include/base64.h
      include/decimal.h
      include/errmsg.h
      include/hash.h
      include/heap.h
      include/keycache.h
      include/lf.h
      include/m_string.h
      include/my_aes.h
      include/my_alarm.h
      include/my_alloc.h
      include/my_atomic.h
      include/my_attribute.h
      include/my_bit.h
      include/my_bitmap.h
      include/my_compiler.h
      include/my_dbug.h
      include/my_dir.h
      include/my_getopt.h
      include/my_global.h
      include/my_libwrap.h
      include/my_list.h
      include/my_nosys.h
      include/my_rdtsc.h
      include/my_stacktrace.h
      include/my_time.h
      include/my_uctype.h
      include/myisam.h
      include/myisammrg.h
      include/myisampack.h
      include/mysql.h
      include/mysql/client_plugin.h
      include/mysql/plugin.h
      include/mysql/plugin_audit.h
      include/mysql/plugin_auth.h
      include/mysql/plugin_auth_common.h
      include/mysql/psi/mysql_stage.h
      include/mysql/psi/mysql_statement.h
      include/mysql/psi/mysql_table.h
      include/mysql/service_my_snprintf.h
      include/mysql/service_thd_alloc.h
      include/mysql/service_thd_wait.h
      include/mysql/service_thread_scheduler.h
      include/mysql/services.h
      include/mysql/thread_pool_priv.h
      include/mysql_com.h
      include/mysql_embed.h
      include/mysys_err.h
      include/password.h
      include/probes_mysql.d.base
      include/probes_mysql.h
      include/queues.h
      include/rijndael.h
      include/service_versions.h
      include/sha1.h
      include/sha2.h
      include/sql_common.h
      include/sslopt-case.h
      include/sslopt-longopts.h
      include/sslopt-vars.h
      include/thr_alarm.h
      include/thr_lock.h
      include/waiting_threads.h
      include/welcome_copyright_notice.h
      libmysql/client_settings.h
      libmysql/errmsg.c
      libmysql/get_password.c
      libmysqld/emb_qcache.cc
      libmysqld/emb_qcache.h
      libmysqld/embedded_priv.h
      libmysqld/examples/builder-sample/emb_sample.bpr
      libmysqld/examples/builder-sample/emb_sample.cpp
      libmysqld/examples/builder-sample/emb_samples.cpp
      libmysqld/examples/builder-sample/emb_samples.h
      libmysqld/libmysqld.c
      libservices/CMakeLists.txt
      libservices/HOWTO
      libservices/my_snprintf_service.c
      libservices/my_thread_scheduler_service.c
      libservices/thd_alloc_service.c
      libservices/thd_wait_service.c
      mysql-test/CMakeLists.txt
      mysql-test/include/default_my.cnf
      mysql-test/include/default_mysqld.cnf
      mysql-test/include/mtr_check.sql
      mysql-test/include/mtr_warnings.sql
      mysql-test/include/set_binlog_format_mixed.sql
      mysql-test/include/set_binlog_format_row.sql
      mysql-test/include/set_binlog_format_statement.sql
      mysql-test/lib/My/Config.pm
      mysql-test/lib/My/ConfigFactory.pm
      mysql-test/lib/My/File/Path.pm
      mysql-test/lib/My/Find.pm
      mysql-test/lib/My/Handles.pm
      mysql-test/lib/My/Options.pm
      mysql-test/lib/My/Platform.pm
      mysql-test/lib/My/SafeProcess.pm
      mysql-test/lib/My/SafeProcess/Base.pm
      mysql-test/lib/My/SafeProcess/safe_kill_win.cc
      mysql-test/lib/My/SafeProcess/safe_process.pl
      mysql-test/lib/My/SafeProcess/safe_process_win.cc
      mysql-test/lib/My/SysInfo.pm
      mysql-test/lib/mtr_cases.pm
      mysql-test/lib/mtr_gprof.pl
      mysql-test/lib/mtr_io.pl
      mysql-test/lib/mtr_stress.pl
      mysql-test/lib/mtr_unique.pm
      mysql-test/lib/t/Base.t
      mysql-test/lib/t/Find.t
      mysql-test/lib/t/Options.t
      mysql-test/lib/t/Platform.t
      mysql-test/lib/t/SafeProcess.t
      mysql-test/lib/t/SafeProcessStress.pl
      mysql-test/lib/t/copytree.t
      mysql-test/lib/t/dummyd.pl
      mysql-test/lib/t/rmtree.t
      mysql-test/lib/t/testMyConfig.t
      mysql-test/lib/t/testMyConfigFactory.t
      mysql-test/lib/t/test_child.pl
      mysql-test/lib/v1/My/Config.pm
      mysql-test/lib/v1/mtr_cases.pl
      mysql-test/lib/v1/mtr_gcov.pl
      mysql-test/lib/v1/mtr_gprof.pl
      mysql-test/lib/v1/mtr_im.pl
      mysql-test/lib/v1/mtr_io.pl
      mysql-test/lib/v1/mtr_match.pl
      mysql-test/lib/v1/mtr_misc.pl
      mysql-test/lib/v1/mtr_process.pl
      mysql-test/lib/v1/mtr_report.pl
      mysql-test/lib/v1/mtr_stress.pl
      mysql-test/lib/v1/mtr_timer.pl
      mysql-test/lib/v1/mtr_unique.pl
      mysql-test/lib/v1/mysql-test-run.pl
      mysql-test/mysql-test-run.pl
      mysql-test/r/func_if.result
      mysql-test/r/gis.result
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/ps.result
      mysql-test/std_data/latin1.xml
      mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam-master.opt
      mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt
      mysql-test/suite/innodb/r/innodb-index.result
      mysql-test/suite/innodb/t/innodb-index.test
      mysql-test/suite/perfschema/include/cleanup_helper.inc
      mysql-test/suite/perfschema/include/event_aggregate_setup.inc
      mysql-test/suite/perfschema/include/schema.inc
      mysql-test/suite/perfschema/include/table_aggregate_load.inc
      mysql-test/suite/perfschema/include/table_aggregate_setup.inc
      mysql-test/suite/perfschema/include/upgrade_check.inc
      mysql-test/suite/perfschema/r/relaylog.result
      mysql-test/suite/perfschema/t/part_table_io.test
      mysql-test/suite/perfschema/t/relaylog.test
      mysql-test/suite/perfschema_stress/README
      mysql-test/suite/perfschema_stress/include/settings.inc
      mysql-test/suite/sys_vars/r/all_vars.result
      mysql-test/suite/sys_vars/r/relay_log_index_basic.result
      mysql-test/suite/sys_vars/t/relay_log_index_basic.test
      mysql-test/t/bootstrap-master.opt
      mysql-test/t/bootstrap.test
      mysql-test/t/ctype_utf8mb4-master.opt
      mysql-test/t/func_if.test
      mysql-test/t/gis.test
      mysql-test/t/ps.test
      mysys/array.c
      mysys/base64.c
      mysys/charset-def.c
      mysys/checksum.c
      mysys/errors.c
      mysys/hash.c
      mysys/lf_alloc-pin.c
      mysys/lf_dynarray.c
      mysys/lf_hash.c
      mysys/list.c
      mysys/mf_cache.c
      mysys/mf_dirname.c
      mysys/mf_fn_ext.c
      mysys/mf_format.c
      mysys/mf_getdate.c
      mysys/mf_iocache.c
      mysys/mf_iocache2.c
      mysys/mf_keycache.c
      mysys/mf_keycaches.c
      mysys/mf_loadpath.c
      mysys/mf_pack.c
      mysys/mf_path.c
      mysys/mf_radix.c
      mysys/mf_sort.c
      mysys/mf_tempdir.c
      mysys/mf_tempfile.c
      mysys/mf_unixpath.c
      mysys/my_aes.c
      mysys/my_alloc.c
      mysys/my_atomic.c
      mysys/my_bit.c
      mysys/my_bitmap.c
      mysys/my_chsize.c
      mysys/my_compress.c
      mysys/my_conio.c
      mysys/my_copy.c
      mysys/my_create.c
      mysys/my_delete.c
      mysys/my_error.c
      mysys/my_file.c
      mysys/my_fstream.c
      mysys/my_gethwaddr.c
      mysys/my_getncpus.c
      mysys/my_getwd.c
      mysys/my_init.c
      mysys/my_largepage.c
      mysys/my_lib.c
      mysys/my_lock.c
      mysys/my_lockmem.c
      mysys/my_malloc.c
      mysys/my_mess.c
      mysys/my_mmap.c
      mysys/my_new.cc
      mysys/my_once.c
      mysys/my_open.c
      mysys/my_pread.c
      mysys/my_pthread.c
      mysys/my_quick.c
      mysys/my_rdtsc.c
      mysys/my_read.c
      mysys/my_redel.c
      mysys/my_rename.c
      mysys/my_seek.c
      mysys/my_sleep.c
      mysys/my_static.c
      mysys/my_static.h
      mysys/my_symlink.c
      mysys/my_sync.c
      mysys/my_thr_init.c
      mysys/my_timer_cycles.il
      mysys/my_wincond.c
      mysys/my_windac.c
      mysys/my_winerr.c
      mysys/my_winfile.c
      mysys/my_winthread.c
      mysys/my_write.c
      mysys/mysys_priv.h
      mysys/ptr_cmp.c
      mysys/queues.c
      mysys/rijndael.c
      mysys/sha1.c
      mysys/stacktrace.c
      mysys/string.c
      mysys/test_charset.c
      mysys/testhash.c
      mysys/thr_lock.c
      mysys/thr_mutex.c
      mysys/thr_rwlock.c
      mysys/waiting_threads.c
      packaging/WiX/CMakeLists.txt
      packaging/WiX/CPackWixConfig.cmake
      packaging/WiX/ca/CMakeLists.txt
      packaging/WiX/ca/CustomAction.cpp
      packaging/WiX/create_msi.cmake.in
      packaging/WiX/custom_ui.wxs
      packaging/WiX/extra.wxs.in
      packaging/WiX/mysql_server.wxs.in
      plugin/audit_null/audit_null.c
      plugin/auth/auth_socket.c
      plugin/auth/test_plugin.c
      plugin/daemon_example/daemon_example.cc
      plugin/fulltext/plugin_example.c
      plugin/semisync/semisync_master.cc
      plugin/semisync/semisync_master.h
      plugin/semisync/semisync_master_plugin.cc
      plugin/semisync/semisync_slave.cc
      plugin/semisync/semisync_slave.h
      regex/CMakeLists.txt
      scripts/dheadgen.pl
      scripts/make_binary_distribution.sh
      scripts/make_win_bin_dist
      scripts/mysql_config.pl.in
      scripts/mysql_config.sh
      scripts/mysql_convert_table_format.sh
      scripts/mysql_find_rows.sh
      scripts/mysql_fix_extensions.sh
      scripts/mysql_install_db.pl.in
      scripts/mysql_install_db.sh
      scripts/mysql_secure_installation.pl.in
      scripts/mysql_secure_installation.sh
      scripts/mysql_setpermission.sh
      scripts/mysql_system_tables.sql
      scripts/mysql_system_tables_data.sql
      scripts/mysql_system_tables_fix.sql
      scripts/mysql_zap.sh
      scripts/mysqlaccess.sh
      scripts/mysqld_multi.sh
      scripts/mysqldumpslow.sh
      scripts/mysqlhotcopy.sh
      sql-bench/as3ap.sh
      sql-bench/bench-count-distinct.sh
      sql-bench/bench-init.pl.sh
      sql-bench/compare-results.sh
      sql-bench/copy-db.sh
      sql-bench/crash-me.sh
      sql-bench/run-all-tests.sh
      sql-bench/server-cfg.sh
      sql-bench/test-ATIS.sh
      sql-bench/test-alter-table.sh
      sql-bench/test-big-tables.sh
      sql-bench/test-connect.sh
      sql-bench/test-create.sh
      sql-bench/test-insert.sh
      sql-bench/test-select.sh
      sql-bench/test-transactions.sh
      sql-bench/test-wisconsin.sh
      sql-common/client.c
      sql-common/client_plugin.c
      sql-common/my_time.c
      sql-common/my_user.c
      sql/client_settings.h
      sql/contributors.h
      sql/custom_conf.h
      sql/debug_sync.cc
      sql/debug_sync.h
      sql/des_key_file.cc
      sql/event_data_objects.cc
      sql/event_db_repository.cc
      sql/event_db_repository.h
      sql/event_parse_data.cc
      sql/event_parse_data.h
      sql/event_scheduler.cc
      sql/events.cc
      sql/field.cc
      sql/field.h
      sql/field_conv.cc
      sql/filesort_utils.cc
      sql/filesort_utils.h
      sql/gcalc_slicescan.cc
      sql/gcalc_slicescan.h
      sql/gcalc_tools.cc
      sql/gcalc_tools.h
      sql/gstream.cc
      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.cc
      sql/hash_filo.h
      sql/item.cc
      sql/item_cmpfunc.cc
      sql/item_create.cc
      sql/item_geofunc.cc
      sql/item_row.cc
      sql/item_row.h
      sql/item_strfunc.cc
      sql/item_subselect.h
      sql/item_timefunc.cc
      sql/item_xmlfunc.h
      sql/keycaches.cc
      sql/lex_symbol.h
      sql/lock.cc
      sql/lock.h
      sql/log_event.cc
      sql/log_event_old.cc
      sql/log_event_old.h
      sql/main.cc
      sql/mdl.h
      sql/message.h
      sql/mysqld.cc
      sql/mysqld.h
      sql/mysqld_suffix.h
      sql/opt_range.h
      sql/opt_sum.cc
      sql/password.c
      sql/plistsort.c
      sql/procedure.cc
      sql/records.cc
      sql/records.h
      sql/rpl_constants.h
      sql/rpl_info.cc
      sql/rpl_info.h
      sql/rpl_info_factory.cc
      sql/rpl_info_factory.h
      sql/rpl_info_file.cc
      sql/rpl_info_file.h
      sql/rpl_info_handler.cc
      sql/rpl_info_handler.h
      sql/rpl_info_table.cc
      sql/rpl_info_table.h
      sql/rpl_info_table_access.cc
      sql/rpl_info_values.cc
      sql/rpl_mi.cc
      sql/rpl_mi.h
      sql/rpl_record_old.cc
      sql/rpl_reporting.cc
      sql/rpl_reporting.h
      sql/rpl_rli.cc
      sql/rpl_rli.h
      sql/rpl_slave.cc
      sql/rpl_slave.h
      sql/rpl_utility.h
      sql/scheduler.cc
      sql/scheduler.h
      sql/server_ids.h
      sql/share/CMakeLists.txt
      sql/share/charsets/cp1251.xml
      sql/sp.cc
      sql/sp_cache.cc
      sql/sp_cache.h
      sql/sp_head.cc
      sql/sp_pcontext.cc
      sql/sp_pcontext.h
      sql/sp_rcontext.cc
      sql/sp_rcontext.h
      sql/spatial.cc
      sql/sql_acl.h
      sql/sql_admin.cc
      sql/sql_admin.h
      sql/sql_alloc_error_handler.cc
      sql/sql_alter.cc
      sql/sql_alter.h
      sql/sql_analyse.cc
      sql/sql_analyse.h
      sql/sql_array.h
      sql/sql_audit.cc
      sql/sql_base.h
      sql/sql_binlog.cc
      sql/sql_builtin.cc.in
      sql/sql_cache.cc
      sql/sql_callback.h
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_cmd.h
      sql/sql_connect.cc
      sql/sql_connect.h
      sql/sql_const.h
      sql/sql_crypt.cc
      sql/sql_crypt.h
      sql/sql_cursor.h
      sql/sql_db.cc
      sql/sql_derived.cc
      sql/sql_do.cc
      sql/sql_error.cc
      sql/sql_error.h
      sql/sql_handler.cc
      sql/sql_handler.h
      sql/sql_help.cc
      sql/sql_insert.cc
      sql/sql_join_cache.cc
      sql/sql_lex.cc
      sql/sql_list.cc
      sql/sql_list.h
      sql/sql_load.cc
      sql/sql_partition.h
      sql/sql_partition_admin.cc
      sql/sql_partition_admin.h
      sql/sql_plist.h
      sql/sql_plugin.cc
      sql/sql_plugin.h
      sql/sql_plugin_services.h
      sql/sql_prepare.cc
      sql/sql_prepare.h
      sql/sql_priv.h
      sql/sql_profile.cc
      sql/sql_rename.cc
      sql/sql_select.cc
      sql/sql_servers.cc
      sql/sql_show.h
      sql/sql_table.cc
      sql/sql_test.cc
      sql/sql_test.h
      sql/sql_trigger.cc
      sql/sql_trigger.h
      sql/sql_udf.h
      sql/sql_union.cc
      sql/sql_update.cc
      sql/sql_yacc.yy
      sql/structs.h
      sql/sys_vars.cc
      sql/sys_vars.h
      sql/table.cc
      sql/transaction.h
      sql/tzfile.h
      sql/tztime.cc
      sql/tztime.h
      sql/udf_example.c
      sql/unireg.cc
      storage/archive/archive_reader.c
      storage/archive/ha_archive.cc
      storage/archive/ha_archive.h
      storage/blackhole/ha_blackhole.cc
      storage/blackhole/ha_blackhole.h
      storage/csv/ha_tina.cc
      storage/csv/ha_tina.h
      storage/csv/transparent_file.cc
      storage/csv/transparent_file.h
      storage/example/ha_example.cc
      storage/example/ha_example.h
      storage/federated/ha_federated.cc
      storage/federated/ha_federated.h
      storage/heap/ha_heap.cc
      storage/heap/ha_heap.h
      storage/heap/heapdef.h
      storage/heap/hp_block.c
      storage/heap/hp_clear.c
      storage/heap/hp_close.c
      storage/heap/hp_create.c
      storage/heap/hp_open.c
      storage/heap/hp_panic.c
      storage/heap/hp_rename.c
      storage/heap/hp_rkey.c
      storage/heap/hp_static.c
      storage/heap/hp_test1.c
      storage/heap/hp_test2.c
      storage/heap/hp_write.c
      storage/innobase/include/trx0sys.h
      storage/innobase/lock/lock0lock.c
      storage/innobase/row/row0row.c
      storage/myisam/fulltext.h
      storage/myisam/ha_myisam.cc
      storage/myisam/ha_myisam.h
      storage/myisam/mi_cache.c
      storage/myisam/mi_changed.c
      storage/myisam/mi_check.c
      storage/myisam/mi_close.c
      storage/myisam/mi_create.c
      storage/myisam/mi_dbug.c
      storage/myisam/mi_delete.c
      storage/myisam/mi_delete_all.c
      storage/myisam/mi_delete_table.c
      storage/myisam/mi_dynrec.c
      storage/myisam/mi_extra.c
      storage/myisam/mi_extrafunc.h
      storage/myisam/mi_info.c
      storage/myisam/mi_keycache.c
      storage/myisam/mi_locking.c
      storage/myisam/mi_log.c
      storage/myisam/mi_open.c
      storage/myisam/mi_packrec.c
      storage/myisam/mi_page.c
      storage/myisam/mi_panic.c
      storage/myisam/mi_preload.c
      storage/myisam/mi_range.c
      storage/myisam/mi_rename.c
      storage/myisam/mi_rkey.c
      storage/myisam/mi_rnext.c
      storage/myisam/mi_rnext_same.c
      storage/myisam/mi_rprev.c
      storage/myisam/mi_rsame.c
      storage/myisam/mi_scan.c
      storage/myisam/mi_search.c
      storage/myisam/mi_static.c
      storage/myisam/mi_statrec.c
      storage/myisam/mi_test1.c
      storage/myisam/mi_test2.c
      storage/myisam/mi_test3.c
      storage/myisam/mi_unique.c
      storage/myisam/mi_update.c
      storage/myisam/mi_write.c
      storage/myisam/myisam_ftdump.c
      storage/myisam/myisamdef.h
      storage/myisam/myisamlog.c
      storage/myisam/myisampack.c
      storage/myisam/rt_split.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/ha_myisammrg.h
      storage/myisammrg/myrg_close.c
      storage/myisammrg/myrg_create.c
      storage/myisammrg/myrg_def.h
      storage/myisammrg/myrg_extra.c
      storage/myisammrg/myrg_info.c
      storage/myisammrg/myrg_queue.c
      storage/myisammrg/myrg_rkey.c
      storage/myisammrg/myrg_static.c
      storage/ndb/MAINTAINERS
      storage/ndb/config/win-lib.am
      storage/ndb/config/win-prg.am
      storage/ndb/src/kernel/blocks/lgman.cpp
      storage/ndb/test/run-test/autotest-boot.sh
      storage/ndb/test/run-test/autotest-run.sh
      storage/ndb/test/run-test/files.cpp
      storage/ndb/test/run-test/setup.cpp
      storage/ndb/test/run-test/upgrade-boot.sh
      storage/ndb/test/sql/BANK.sql
      storage/ndb/test/sql/T1.sql
      storage/ndb/test/tools/log_listner.cpp
      storage/perfschema/ha_perfschema.cc
      storage/perfschema/ha_perfschema.h
      storage/perfschema/pfs.cc
      storage/perfschema/pfs.h
      storage/perfschema/pfs_atomic.h
      storage/perfschema/pfs_column_values.cc
      storage/perfschema/pfs_column_values.h
      storage/perfschema/pfs_con_slice.cc
      storage/perfschema/pfs_con_slice.h
      storage/perfschema/pfs_defaults.h
      storage/perfschema/pfs_engine_table.cc
      storage/perfschema/pfs_engine_table.h
      storage/perfschema/pfs_events.h
      storage/perfschema/pfs_events_stages.cc
      storage/perfschema/pfs_events_stages.h
      storage/perfschema/pfs_events_statements.cc
      storage/perfschema/pfs_events_statements.h
      storage/perfschema/pfs_events_waits.cc
      storage/perfschema/pfs_events_waits.h
      storage/perfschema/pfs_global.h
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      storage/perfschema/pfs_instr_class.cc
      storage/perfschema/pfs_instr_class.h
      storage/perfschema/pfs_server.cc
      storage/perfschema/pfs_server.h
      storage/perfschema/pfs_setup_actor.cc
      storage/perfschema/pfs_setup_actor.h
      storage/perfschema/pfs_setup_object.h
      storage/perfschema/pfs_stat.h
      storage/perfschema/pfs_timer.cc
      storage/perfschema/pfs_timer.h
      storage/perfschema/pfs_visitor.cc
      storage/perfschema/pfs_visitor.h
      storage/perfschema/table_esgs_by_thread_by_event_name.cc
      storage/perfschema/table_esgs_by_thread_by_event_name.h
      storage/perfschema/table_esgs_global_by_event_name.cc
      storage/perfschema/table_esgs_global_by_event_name.h
      storage/perfschema/table_esms_by_thread_by_event_name.cc
      storage/perfschema/table_esms_by_thread_by_event_name.h
      storage/perfschema/table_esms_global_by_event_name.cc
      storage/perfschema/table_esms_global_by_event_name.h
      storage/perfschema/table_events_stages.cc
      storage/perfschema/table_events_stages.h
      storage/perfschema/table_events_statements.cc
      storage/perfschema/table_events_statements.h
      storage/perfschema/table_events_waits.cc
      storage/perfschema/table_events_waits.h
      storage/perfschema/table_ews_by_thread_by_event_name.cc
      storage/perfschema/table_ews_by_thread_by_event_name.h
      storage/perfschema/table_ews_global_by_event_name.cc
      storage/perfschema/table_ews_global_by_event_name.h
      storage/perfschema/table_setup_consumers.cc
      storage/perfschema/table_setup_instruments.h
      storage/perfschema/table_setup_timers.cc
      storage/perfschema/table_tiws_by_index_usage.cc
      storage/perfschema/table_tiws_by_index_usage.h
      storage/perfschema/unittest/CMakeLists.txt
      storage/perfschema/unittest/pfs-t.cc
      storage/perfschema/unittest/pfs_instr-oom-t.cc
      storage/perfschema/unittest/pfs_instr-t.cc
      storage/perfschema/unittest/pfs_instr_class-oom-t.cc
      storage/perfschema/unittest/pfs_instr_class-t.cc
      storage/perfschema/unittest/pfs_timer-t.cc
      strings/bchange.c
      strings/bmove_upp.c
      strings/ctype-cp932.c
      strings/ctype-eucjpms.c
      strings/ctype-extra.c
      strings/ctype-mb.c
      strings/ctype-ucs2.c
      strings/ctype-ujis.c
      strings/ctype-win1250ch.c
      strings/decimal.c
      strings/do_ctype.c
      strings/dtoa.c
      strings/int2str.c
      strings/is_prefix.c
      strings/llstr.c
      strings/longlong2str.c
      strings/my_strtoll10.c
      strings/str2int.c
      strings/str_alloc.c
      strings/strappend.c
      strings/strcend.c
      strings/strcont.c
      strings/strend.c
      strings/strfill.c
      strings/strmake.c
      strings/strmov.c
      strings/strnlen.c
      strings/strnmov.c
      strings/strxmov.c
      strings/strxnmov.c
      strings/utr11-dump.c
      strings/xml.c
      support-files/config.huge.ini.sh
      support-files/config.medium.ini.sh
      support-files/config.small.ini.sh
      support-files/dtrace/locktime.d
      support-files/dtrace/query-execandqc.d
      support-files/dtrace/query-filesort-time.d
      support-files/dtrace/query-network-time.d
      support-files/dtrace/query-parse-time.d
      support-files/dtrace/query-rowops.d
      support-files/dtrace/query-time.d
      support-files/dtrace/statement-time.d
      support-files/dtrace/statement-type-aggregate.d
      support-files/mysql.spec.sh
      support-files/ndb-config-2-node.ini.sh
      tests/big_record.pl
      tests/bug25714.c
      tests/grant.pl
      tests/thread_test.c
      unittest/examples/skip-t.c
      unittest/examples/skip_all-t.c
      unittest/examples/todo-t.c
      unittest/gunit/CMakeLists.txt
      unittest/gunit/FindGTest.cmake
      unittest/gunit/gunit_test_main.cc
      unittest/gunit/my_bitmap-t.cc
      unittest/gunit/sql_list-t.cc
      unittest/gunit/tap_event_listener.cc
      unittest/gunit/thread_utils-t.cc
      unittest/gunit/thread_utils.cc
      unittest/gunit/thread_utils.h
      unittest/mysys/CMakeLists.txt
      unittest/mysys/base64-t.c
      unittest/mysys/lf-t.c
      unittest/mysys/my_atomic-t.c
      unittest/mysys/my_rdtsc-t.c
      unittest/mysys/my_vsnprintf-t.c
      unittest/mysys/thr_template.c
      unittest/mysys/waiting_threads-t.c
      unittest/mytap/t/basic-t.c
      unittest/strings/strings-t.c
      unittest/unit.pl
      vio/CMakeLists.txt
      vio/test-ssl.c
      vio/test-sslclient.c
      vio/test-sslserver.c
      vio/viosocket.c
      vio/viosslfactories.c
      vio/viotest-ssl.c
      vio/viotest-sslconnect.cc
      vio/viotest.cc
      win/create_def_file.js
=== modified file 'include/my_sys.h'
--- a/include/my_sys.h	2011-07-04 00:25:46 +0000
+++ b/include/my_sys.h	2011-07-05 08:15:52 +0000
@@ -961,6 +961,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_file.h'
--- a/include/mysql/psi/mysql_file.h	2011-06-30 15:50:45 +0000
+++ b/include/mysql/psi/mysql_file.h	2011-07-05 08:15:52 +0000
@@ -518,8 +518,7 @@ static inline void inline_mysql_file_reg
 )
 {
 #ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(PSI_server != NULL))
-    PSI_server->register_file(category, info, count);
+  PSI_CALL(register_file)(category, info, count);
 #endif
 }
 
@@ -532,21 +531,20 @@ inline_mysql_file_fgets(
 {
   char *result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server && file->m_psi))
+  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+                                                  PSI_FILE_READ);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
-                                                      PSI_FILE_READ);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) size, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) size, src_file, src_line);
+    result= fgets(str, size, file->m_file);
+    PSI_CALL(end_file_wait)(locker, result ? strlen(result) : 0);
+    return result;
   }
 #endif
+
   result= fgets(str, size, file->m_file);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, result ? strlen(result) : 0);
-#endif
   return result;
 }
 
@@ -559,21 +557,20 @@ inline_mysql_file_fgetc(
 {
   int result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server && file->m_psi))
+  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+                                                  PSI_FILE_READ);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
-                                                      PSI_FILE_READ);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
+    result= fgetc(file->m_file);
+    PSI_CALL(end_file_wait)(locker, (size_t) 1);
+    return result;
   }
 #endif
+
   result= fgetc(file->m_file);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) 1);
-#endif
   return result;
 }
 
@@ -586,25 +583,22 @@ inline_mysql_file_fputs(
 {
   int result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  size_t bytes= 0;
-  if (likely(PSI_server && file->m_psi))
+  size_t bytes;
+  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+                                                  PSI_FILE_WRITE);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
-                                                      PSI_FILE_WRITE);
-    if (likely(locker != NULL))
-    {
-      bytes= str ? strlen(str) : 0;
-      PSI_server->start_file_wait(locker, bytes, src_file, src_line);
-    }
+    bytes= str ? strlen(str) : 0;
+    PSI_CALL(start_file_wait)(locker, bytes, src_file, src_line);
+    result= fputs(str, file->m_file);
+    PSI_CALL(end_file_wait)(locker, bytes);
+    return result;
   }
 #endif
+
   result= fputs(str, file->m_file);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, bytes);
-#endif
   return result;
 }
 
@@ -617,21 +611,20 @@ inline_mysql_file_fputc(
 {
   int result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server && file->m_psi))
+  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+                                                  PSI_FILE_WRITE);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
-                                                      PSI_FILE_WRITE);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
+    result= fputc(c, file->m_file);
+    PSI_CALL(end_file_wait)(locker, (size_t) 1);
+    return result;
   }
 #endif
+
   result= fputc(c, file->m_file);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) 1);
-#endif
   return result;
 }
 
@@ -644,23 +637,24 @@ inline_mysql_file_fprintf(MYSQL_FILE *fi
   int result;
   va_list args;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server && file->m_psi))
+  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+                                                  PSI_FILE_WRITE);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
-                                                      PSI_FILE_WRITE);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 0, __FILE__, __LINE__);
+    PSI_CALL(start_file_wait)(locker, (size_t) 0, __FILE__, __LINE__);
+    va_start(args, format);
+    result= vfprintf(file->m_file, format, args);
+    va_end(args);
+    PSI_CALL(end_file_wait)(locker, (size_t) result);
+    return result;
   }
 #endif
+
   va_start(args, format);
   result= vfprintf(file->m_file, format, args);
   va_end(args);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) result);
-#endif
   return result;
 }
 
@@ -673,21 +667,20 @@ inline_mysql_file_vfprintf(
 {
   int result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server && file->m_psi))
+  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+                                                  PSI_FILE_WRITE);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
-                                                      PSI_FILE_WRITE);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    result= vfprintf(file->m_file, format, args);
+    PSI_CALL(end_file_wait)(locker, (size_t) result);
+    return result;
   }
 #endif
+
   result= vfprintf(file->m_file, format, args);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) result);
-#endif
   return result;
 }
 
@@ -700,21 +693,20 @@ inline_mysql_file_fflush(
 {
   int result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server && file->m_psi))
+  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+                                                  PSI_FILE_FLUSH);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
-                                                      PSI_FILE_FLUSH);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    result= fflush(file->m_file);
+    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    return result;
   }
 #endif
+
   result= fflush(file->m_file);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) 0);
-#endif
   return result;
 }
 
@@ -733,21 +725,20 @@ inline_mysql_file_fstat(
 {
   int result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
+  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, filenr,
+                                                      PSI_FILE_FSTAT);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_descriptor_locker(&state, filenr,
-                                                          PSI_FILE_FSTAT);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    result= my_fstat(filenr, stat_area, flags);
+    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    return result;
   }
 #endif
+
   result= my_fstat(filenr, stat_area, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) 0);
-#endif
   return result;
 }
 
@@ -760,22 +751,21 @@ inline_mysql_file_stat(
 {
   MY_STAT *result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
+  locker= PSI_CALL(get_thread_file_name_locker)(&state,
+                                                key, PSI_FILE_STAT,
+                                                path, &locker);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_name_locker(&state,
-                                                    key, PSI_FILE_STAT,
-                                                    path, &locker);
-    if (likely(locker != NULL))
-      PSI_server->start_file_open_wait(locker, src_file, src_line);
+    PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
+    result= my_stat(path, stat_area, flags);
+    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    return result;
   }
 #endif
+
   result= my_stat(path, stat_area, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) 0);
-#endif
   return result;
 }
 
@@ -788,22 +778,21 @@ inline_mysql_file_chsize(
 {
   int result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
+  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
+                                                      PSI_FILE_CHSIZE);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_descriptor_locker(&state, file,
-                                                          PSI_FILE_CHSIZE);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) newlength, src_file,
-                                  src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) newlength, src_file,
+                              src_line);
+    result= my_chsize(file, newlength, filler, flags);
+    PSI_CALL(end_file_wait)(locker, (size_t) newlength);
+    return result;
   }
 #endif
+
   result= my_chsize(file, newlength, filler, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) newlength);
-#endif
   return result;
 }
 
@@ -818,30 +807,32 @@ inline_mysql_file_fopen(
   that= (MYSQL_FILE*) my_malloc(sizeof(MYSQL_FILE), MYF(MY_WME));
   if (likely(that != NULL))
   {
-    that->m_psi= NULL;
-    {
 #ifdef HAVE_PSI_FILE_INTERFACE
-      struct PSI_file_locker *locker= NULL;
-      PSI_file_locker_state state;
-      if (likely(PSI_server != NULL))
-      {
-        locker= PSI_server->get_thread_file_name_locker
-          (&state, key, PSI_FILE_STREAM_OPEN, filename, that);
-        if (likely(locker != NULL))
-          that->m_psi= PSI_server->start_file_open_wait(locker, src_file,
-                                                        src_line);
-      }
-#endif
+    struct PSI_file_locker *locker;
+    PSI_file_locker_state state;
+    locker= PSI_CALL(get_thread_file_name_locker)
+        (&state, key, PSI_FILE_STREAM_OPEN, filename, that);
+    if (likely(locker != NULL))
+    {
+      that->m_psi= PSI_CALL(start_file_open_wait)(locker, src_file,
+                                                  src_line);
       that->m_file= my_fopen(filename, flags, myFlags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-      if (likely(locker != NULL))
-        PSI_server->end_file_open_wait(locker);
-#endif
+      PSI_CALL(end_file_open_wait)(locker);
       if (unlikely(that->m_file == NULL))
       {
         my_free(that);
         return NULL;
       }
+      return that;
+    }
+#endif
+
+    that->m_psi= NULL;
+    that->m_file= my_fopen(filename, flags, myFlags);
+    if (unlikely(that->m_file == NULL))
+    {
+      my_free(that);
+      return NULL;
     }
   }
   return that;
@@ -858,22 +849,21 @@ inline_mysql_file_fclose(
   if (likely(file != NULL))
   {
 #ifdef HAVE_PSI_FILE_INTERFACE
-    struct PSI_file_locker *locker= NULL;
+    struct PSI_file_locker *locker;
     PSI_file_locker_state state;
-    DBUG_ASSERT(file != NULL);
-    if (likely(PSI_server && file->m_psi))
+    locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+                                                    PSI_FILE_STREAM_CLOSE);
+    if (likely(locker != NULL))
     {
-      locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
-                                                        PSI_FILE_STREAM_CLOSE);
-      if (likely(locker != NULL))
-        PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
+      PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+      result= my_fclose(file->m_file, flags);
+      PSI_CALL(end_file_wait)(locker, (size_t) 0);
+      my_free(file);
+      return result;
     }
 #endif
+
     result= my_fclose(file->m_file, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-    if (likely(locker != NULL))
-      PSI_server->end_file_wait(locker, (size_t) 0);
-#endif
     my_free(file);
   }
   return result;
@@ -886,30 +876,27 @@ inline_mysql_file_fread(
 #endif
   MYSQL_FILE *file, uchar *buffer, size_t count, myf flags)
 {
-  size_t result= 0;
+  size_t result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server && file->m_psi))
-  {
-    locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
-                                                      PSI_FILE_READ);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, count, src_file, src_line);
-  }
-#endif
-  result= my_fread(file->m_file, buffer, count, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
+  size_t bytes_read;
+  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+                                                  PSI_FILE_READ);
   if (likely(locker != NULL))
   {
-    size_t bytes_read;
+    PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+    result= my_fread(file->m_file, buffer, count, flags);
     if (flags & (MY_NABP | MY_FNABP))
       bytes_read= (result == 0) ? count : 0;
     else
       bytes_read= (result != MY_FILE_ERROR) ? result : 0;
-    PSI_server->end_file_wait(locker, bytes_read);
+    PSI_CALL(end_file_wait)(locker, bytes_read);
+    return result;
   }
 #endif
+
+  result= my_fread(file->m_file, buffer, count, flags);
   return result;
 }
 
@@ -920,30 +907,27 @@ inline_mysql_file_fwrite(
 #endif
   MYSQL_FILE *file, const uchar *buffer, size_t count, myf flags)
 {
-  size_t result= 0;
+  size_t result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server && file->m_psi))
-  {
-    locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
-                                                      PSI_FILE_WRITE);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, count, src_file, src_line);
-  }
-#endif
-  result= my_fwrite(file->m_file, buffer, count, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
+  size_t bytes_written;
+  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+                                                  PSI_FILE_WRITE);
   if (likely(locker != NULL))
   {
-    size_t bytes_written;
+    PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+    result= my_fwrite(file->m_file, buffer, count, flags);
     if (flags & (MY_NABP | MY_FNABP))
       bytes_written= (result == 0) ? count : 0;
     else
       bytes_written= (result != MY_FILE_ERROR) ? result : 0;
-    PSI_server->end_file_wait(locker, bytes_written);
+    PSI_CALL(end_file_wait)(locker, bytes_written);
+    return result;
   }
 #endif
+
+  result= my_fwrite(file->m_file, buffer, count, flags);
   return result;
 }
 
@@ -956,21 +940,20 @@ inline_mysql_file_fseek(
 {
   my_off_t result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server && file->m_psi))
+  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+                                                  PSI_FILE_SEEK);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
-                                                      PSI_FILE_SEEK);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    result= my_fseek(file->m_file, pos, whence, flags);
+    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    return result;
   }
 #endif
+
   result= my_fseek(file->m_file, pos, whence, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) 0);
-#endif
   return result;
 }
 
@@ -983,21 +966,20 @@ inline_mysql_file_ftell(
 {
   my_off_t result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server && file->m_psi))
+  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
+                                                  PSI_FILE_TELL);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
-                                                      PSI_FILE_TELL);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    result= my_ftell(file->m_file, flags);
+    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    return result;
   }
 #endif
+
   result= my_ftell(file->m_file, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) 0);
-#endif
   return result;
 }
 
@@ -1010,21 +992,20 @@ inline_mysql_file_create(
 {
   File file;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
+  locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_CREATE,
+                                                filename, &locker);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_CREATE,
-                                                    filename, &locker);
-    if (likely(locker != NULL))
-      PSI_server->start_file_open_wait(locker, src_file, src_line);
+    PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
+    file= my_create(filename, create_flags, access_flags, myFlags);
+    PSI_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
+    return file;
   }
 #endif
+
   file= my_create(filename, create_flags, access_flags, myFlags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file);
-#endif
   return file;
 }
 
@@ -1043,8 +1024,7 @@ inline_mysql_file_create_temp(
   */
   file= create_temp_file(to, dir, pfx, mode, myFlags);
 #ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(PSI_server != NULL))
-    PSI_server->create_file(key, to, file);
+  PSI_CALL(create_file)(key, to, file);
 #endif
   return file;
 }
@@ -1058,21 +1038,20 @@ inline_mysql_file_open(
 {
   File file;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
+  locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_OPEN,
+                                                filename, &locker);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_OPEN,
-                                                    filename, &locker);
-    if (likely(locker != NULL))
-      PSI_server->start_file_open_wait(locker, src_file, src_line);
+    PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
+    file= my_open(filename, flags, myFlags);
+    PSI_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
+    return file;
   }
 #endif
+
   file= my_open(filename, flags, myFlags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file);
-#endif
   return file;
 }
 
@@ -1085,21 +1064,20 @@ inline_mysql_file_close(
 {
   int result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
+  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
+                                                      PSI_FILE_CLOSE);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_descriptor_locker(&state, file,
-                                                          PSI_FILE_CLOSE);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    result= my_close(file, flags);
+    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    return result;
   }
 #endif
+
   result= my_close(file, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) 0);
-#endif
   return result;
 }
 
@@ -1110,30 +1088,27 @@ inline_mysql_file_read(
 #endif
   File file, uchar *buffer, size_t count, myf flags)
 {
-  size_t result= 0;
+  size_t result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
-  {
-    locker= PSI_server->get_thread_file_descriptor_locker(&state, file,
-                                                          PSI_FILE_READ);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, count, src_file, src_line);
-  }
-#endif
-  result= my_read(file, buffer, count, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
+  size_t bytes_read;
+  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
+                                                      PSI_FILE_READ);
   if (likely(locker != NULL))
   {
-    size_t bytes_read;
+    PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+    result= my_read(file, buffer, count, flags);
     if (flags & (MY_NABP | MY_FNABP))
       bytes_read= (result == 0) ? count : 0;
     else
       bytes_read= (result != MY_FILE_ERROR) ? result : 0;
-    PSI_server->end_file_wait(locker, bytes_read);
+    PSI_CALL(end_file_wait)(locker, bytes_read);
+    return result;
   }
 #endif
+
+  result= my_read(file, buffer, count, flags);
   return result;
 }
 
@@ -1146,28 +1121,25 @@ inline_mysql_file_write(
 {
   size_t result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
-  {
-    locker= PSI_server->get_thread_file_descriptor_locker(&state, file,
-                                                          PSI_FILE_WRITE);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, count, src_file, src_line);
-  }
-#endif
-  result= my_write(file, buffer, count, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
+  size_t bytes_written;
+  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
+                                                      PSI_FILE_WRITE);
   if (likely(locker != NULL))
   {
-    size_t bytes_written;
+    PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+    result= my_write(file, buffer, count, flags);
     if (flags & (MY_NABP | MY_FNABP))
       bytes_written= (result == 0) ? count : 0;
     else
       bytes_written= (result != MY_FILE_ERROR) ? result : 0;
-    PSI_server->end_file_wait(locker, bytes_written);
+    PSI_CALL(end_file_wait)(locker, bytes_written);
+    return result;
   }
 #endif
+
+  result= my_write(file, buffer, count, flags);
   return result;
 }
 
@@ -1180,27 +1152,24 @@ inline_mysql_file_pread(
 {
   size_t result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
-  {
-    locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_READ);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, count, src_file, src_line);
-  }
-#endif
-  result= my_pread(file, buffer, count, offset, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
+  size_t bytes_read;
+  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_READ);
   if (likely(locker != NULL))
   {
-    size_t bytes_read;
+    PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+    result= my_pread(file, buffer, count, offset, flags);
     if (flags & (MY_NABP | MY_FNABP))
       bytes_read= (result == 0) ? count : 0;
     else
       bytes_read= (result != MY_FILE_ERROR) ? result : 0;
-    PSI_server->end_file_wait(locker, bytes_read);
+    PSI_CALL(end_file_wait)(locker, bytes_read);
+    return result;
   }
 #endif
+
+  result= my_pread(file, buffer, count, offset, flags);
   return result;
 }
 
@@ -1213,28 +1182,25 @@ inline_mysql_file_pwrite(
 {
   size_t result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
-  {
-    locker= PSI_server->get_thread_file_descriptor_locker(&state, file,
-                                                          PSI_FILE_WRITE);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, count, src_file, src_line);
-  }
-#endif
-  result= my_pwrite(file, buffer, count, offset, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
+  size_t bytes_written;
+  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
+                                                      PSI_FILE_WRITE);
   if (likely(locker != NULL))
   {
-    size_t bytes_written;
+    PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+    result= my_pwrite(file, buffer, count, offset, flags);
     if (flags & (MY_NABP | MY_FNABP))
       bytes_written= (result == 0) ? count : 0;
     else
       bytes_written= (result != MY_FILE_ERROR) ? result : 0;
-    PSI_server->end_file_wait(locker, bytes_written);
+    PSI_CALL(end_file_wait)(locker, bytes_written);
+    return result;
   }
 #endif
+
+  result= my_pwrite(file, buffer, count, offset, flags);
   return result;
 }
 
@@ -1247,20 +1213,19 @@ inline_mysql_file_seek(
 {
   my_off_t result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
+  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_SEEK);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_SEEK);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    result= my_seek(file, pos, whence, flags);
+    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    return result;
   }
 #endif
+
   result= my_seek(file, pos, whence, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) 0);
-#endif
   return result;
 }
 
@@ -1273,20 +1238,19 @@ inline_mysql_file_tell(
 {
   my_off_t result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
+  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_TELL);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_TELL);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    result= my_tell(file, flags);
+    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    return result;
   }
 #endif
+
   result= my_tell(file, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) 0);
-#endif
   return result;
 }
 
@@ -1299,21 +1263,20 @@ inline_mysql_file_delete(
 {
   int result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
+  locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_DELETE,
+                                                name, &locker);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_DELETE,
-                                                    name, &locker);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    result= my_delete(name, flags);
+    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    return result;
   }
 #endif
+
   result= my_delete(name, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) 0);
-#endif
   return result;
 }
 
@@ -1326,21 +1289,20 @@ inline_mysql_file_rename(
 {
   int result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
+  locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_RENAME,
+                                                to, &locker);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_RENAME,
-                                                    to, &locker);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    result= my_rename(from, to, flags);
+    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    return result;
   }
 #endif
+
   result= my_rename(from, to, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) 0);
-#endif
   return result;
 }
 
@@ -1354,22 +1316,22 @@ inline_mysql_file_create_with_symlink(
 {
   File file;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
+  locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_CREATE,
+                                                filename, &locker);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_CREATE,
-                                                    filename, &locker);
-    if (likely(locker != NULL))
-      PSI_server->start_file_open_wait(locker, src_file, src_line);
+    PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
+    file= my_create_with_symlink(linkname, filename, create_flags, access_flags,
+                                 flags);
+    PSI_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
+    return file;
   }
 #endif
+
   file= my_create_with_symlink(linkname, filename, create_flags, access_flags,
                                flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file);
-#endif
   return file;
 }
 
@@ -1382,21 +1344,20 @@ inline_mysql_file_delete_with_symlink(
 {
   int result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
+  locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_DELETE,
+                                                name, &locker);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_DELETE,
-                                                    name, &locker);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    result= my_delete_with_symlink(name, flags);
+    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    return result;
   }
 #endif
+
   result= my_delete_with_symlink(name, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) 0);
-#endif
   return result;
 }
 
@@ -1409,21 +1370,20 @@ inline_mysql_file_rename_with_symlink(
 {
   int result;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
+  locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_RENAME,
+                                                to, &locker);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_RENAME,
-                                                    to, &locker);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    result= my_rename_with_symlink(from, to, flags);
+    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    return result;
   }
 #endif
+
   result= my_rename_with_symlink(from, to, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) 0);
-#endif
   return result;
 }
 
@@ -1436,20 +1396,19 @@ inline_mysql_file_sync(
 {
   int result= 0;
 #ifdef HAVE_PSI_FILE_INTERFACE
-  struct PSI_file_locker *locker= NULL;
+  struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  if (likely(PSI_server != NULL))
+  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, fd, PSI_FILE_SYNC);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_file_descriptor_locker(&state, fd, PSI_FILE_SYNC);
-    if (likely(locker != NULL))
-      PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
+    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    result= my_sync(fd, flags);
+    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    return result;
   }
 #endif
+
   result= my_sync(fd, flags);
-#ifdef HAVE_PSI_FILE_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_file_wait(locker, (size_t) 0);
-#endif
   return result;
 }
 

=== modified file 'include/mysql/psi/mysql_stage.h'
--- a/include/mysql/psi/mysql_stage.h	2011-06-30 15:50:45 +0000
+++ b/include/mysql/psi/mysql_stage.h	2011-07-05 08:15:52 +0000
@@ -53,8 +53,7 @@
 static inline void inline_mysql_stage_register(
   const char *category, PSI_stage_info **info, int count)
 {
-  if (likely(PSI_server != NULL))
-    PSI_server->register_stage(category, info, count);
+  PSI_CALL(register_stage)(category, info, count);
 }
 #endif
 
@@ -63,8 +62,7 @@ static inline void
 inline_mysql_set_stage(PSI_stage_key key,
                        const char *src_file, int src_line)
 {
-  if (likely(PSI_server != NULL))
-    PSI_server->start_stage(key, src_file, src_line);
+  PSI_CALL(start_stage)(key, src_file, src_line);
 }
 #endif
 

=== modified file 'include/mysql/psi/mysql_statement.h'
--- a/include/mysql/psi/mysql_statement.h	2011-06-30 15:50:45 +0000
+++ b/include/mysql/psi/mysql_statement.h	2011-07-05 08:15:52 +0000
@@ -101,8 +101,7 @@
 static inline void inline_mysql_statement_register(
   const char *category, PSI_statement_info *info, int count)
 {
-  if (likely(PSI_server != NULL))
-    PSI_server->register_statement(category, info, count);
+  PSI_CALL(register_statement)(category, info, count);
 }
 
 static inline struct PSI_statement_locker *
@@ -111,13 +110,10 @@ inline_mysql_start_statement(PSI_stateme
                              const char *db, uint db_len,
                              const char *src_file, int src_line)
 {
-  PSI_statement_locker *locker= NULL;
-  if (likely(PSI_server != NULL))
-  {
-    locker= PSI_server->get_thread_statement_locker(state, key);
-    if (likely(locker != NULL))
-      PSI_server->start_statement(locker, db, db_len, src_file, src_line);
-  }
+  PSI_statement_locker *locker;
+  locker= PSI_CALL(get_thread_statement_locker)(state, key);
+  if (likely(locker != NULL))
+    PSI_CALL(start_statement)(locker, db, db_len, src_file, src_line);
   return locker;
 }
 
@@ -125,9 +121,9 @@ static inline struct PSI_statement_locke
 inline_mysql_refine_statement(PSI_statement_locker *locker,
                               PSI_statement_key key)
 {
-  if (likely(PSI_server && locker))
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->refine_statement(locker, key);
+    locker= PSI_CALL(refine_statement)(locker, key);
   }
   return locker;
 }
@@ -136,9 +132,9 @@ static inline void
 inline_mysql_set_statement_text(PSI_statement_locker *locker,
                                 const char *text, uint text_len)
 {
-  if (likely(PSI_server && locker))
+  if (likely(locker != NULL))
   {
-    PSI_server->set_statement_text(locker, text, text_len);
+    PSI_CALL(set_statement_text)(locker, text, text_len);
   }
 }
 
@@ -146,9 +142,9 @@ static inline void
 inline_mysql_set_statement_lock_time(PSI_statement_locker *locker,
                                      ulonglong count)
 {
-  if (likely(PSI_server && locker))
+  if (likely(locker != NULL))
   {
-    PSI_server->set_statement_lock_time(locker, count);
+    PSI_CALL(set_statement_lock_time)(locker, count);
   }
 }
 
@@ -156,9 +152,9 @@ static inline void
 inline_mysql_set_statement_rows_sent(PSI_statement_locker *locker,
                                      ulonglong count)
 {
-  if (likely(PSI_server && locker))
+  if (likely(locker != NULL))
   {
-    PSI_server->set_statement_rows_sent(locker, count);
+    PSI_CALL(set_statement_rows_sent)(locker, count);
   }
 }
 
@@ -166,9 +162,9 @@ static inline void
 inline_mysql_set_statement_rows_examined(PSI_statement_locker *locker,
                                          ulonglong count)
 {
-  if (likely(PSI_server && locker))
+  if (likely(locker != NULL))
   {
-    PSI_server->set_statement_rows_examined(locker, count);
+    PSI_CALL(set_statement_rows_examined)(locker, count);
   }
 }
 
@@ -176,12 +172,9 @@ static inline void
 inline_mysql_end_statement(struct PSI_statement_locker *locker,
                            Diagnostics_area *stmt_da)
 {
-  if (likely(PSI_server != NULL))
-  {
-    PSI_server->end_stage();
-    if (likely(locker != NULL))
-      PSI_server->end_statement(locker, stmt_da);
-  }
+  PSI_CALL(end_stage)();
+  if (likely(locker != NULL))
+    PSI_CALL(end_statement)(locker, stmt_da);
 }
 #endif
 

=== modified file 'include/mysql/psi/mysql_table.h'
--- a/include/mysql/psi/mysql_table.h	2011-06-30 15:50:45 +0000
+++ b/include/mysql/psi/mysql_table.h	2011-07-05 08:15:52 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.   
+/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -97,13 +97,10 @@ inline_mysql_start_table_io_wait(PSI_tab
                                  uint index,
                                  const char *src_file, int src_line)
 {
-  struct PSI_table_locker *locker= NULL;
-  if (likely(PSI_server && psi))
-  {
-    locker= PSI_server->get_thread_table_io_locker(state, psi, op, index);
-    if (likely(locker != NULL))
-      PSI_server->start_table_io_wait(locker, src_file, src_line);
-  }
+  struct PSI_table_locker *locker;
+  locker= PSI_CALL(get_thread_table_io_locker)(state, psi, op, index);
+  if (likely(locker != NULL))
+    PSI_CALL(start_table_io_wait)(locker, src_file, src_line);
   return locker;
 }
 
@@ -115,7 +112,7 @@ static inline void
 inline_mysql_end_table_io_wait(struct PSI_table_locker *locker)
 {
   if (likely(locker != NULL))
-    PSI_server->end_table_io_wait(locker);
+    PSI_CALL(end_table_io_wait)(locker);
 }
 #endif
 
@@ -165,13 +162,10 @@ inline_mysql_start_table_lock_wait(PSI_t
                                    enum PSI_table_lock_operation op,
                                    ulong flags, const char *src_file, int src_line)
 {
-  struct PSI_table_locker *locker= NULL;
-  if (likely(PSI_server && psi))
-  {
-    locker= PSI_server->get_thread_table_lock_locker(state, psi, op, flags);
-    if (likely(locker != NULL))
-      PSI_server->start_table_lock_wait(locker, src_file, src_line);
-  }
+  struct PSI_table_locker *locker;
+  locker= PSI_CALL(get_thread_table_lock_locker)(state, psi, op, flags);
+  if (likely(locker != NULL))
+    PSI_CALL(start_table_lock_wait)(locker, src_file, src_line);
   return locker;
 }
 
@@ -183,7 +177,7 @@ static inline void
 inline_mysql_end_table_lock_wait(struct PSI_table_locker *locker)
 {
   if (likely(locker != NULL))
-    PSI_server->end_table_lock_wait(locker);
+    PSI_CALL(end_table_lock_wait)(locker);
 }
 #endif
 

=== modified file 'include/mysql/psi/mysql_thread.h'
--- a/include/mysql/psi/mysql_thread.h	2011-06-30 15:50:45 +0000
+++ b/include/mysql/psi/mysql_thread.h	2011-07-05 08:15:52 +0000
@@ -588,8 +588,7 @@ static inline void inline_mysql_mutex_re
 )
 {
 #ifdef HAVE_PSI_MUTEX_INTERFACE
-  if (likely(PSI_server != NULL))
-    PSI_server->register_mutex(category, info, count);
+  PSI_CALL(register_mutex)(category, info, count);
 #endif
 }
 
@@ -605,8 +604,7 @@ static inline int inline_mysql_mutex_ini
   )
 {
 #ifdef HAVE_PSI_MUTEX_INTERFACE
-  that->m_psi= PSI_server ? PSI_server->init_mutex(key, &that->m_mutex)
-                          : NULL;
+  that->m_psi= PSI_CALL(init_mutex)(key, &that->m_mutex);
 #else
   that->m_psi= NULL;
 #endif
@@ -625,11 +623,8 @@ static inline int inline_mysql_mutex_des
   )
 {
 #ifdef HAVE_PSI_MUTEX_INTERFACE
-  if (likely(PSI_server && that->m_psi))
-  {
-    PSI_server->destroy_mutex(that->m_psi);
-    that->m_psi= NULL;
-  }
+  PSI_CALL(destroy_mutex)(that->m_psi);
+  that->m_psi= NULL;
 #endif
 #ifdef SAFE_MUTEX
   return safe_mutex_destroy(&that->m_mutex, src_file, src_line);
@@ -647,24 +642,27 @@ static inline int inline_mysql_mutex_loc
 {
   int result;
 #ifdef HAVE_PSI_MUTEX_INTERFACE
-  struct PSI_mutex_locker *locker= NULL;
+  struct PSI_mutex_locker *locker;
   PSI_mutex_locker_state state;
-  if (likely(PSI_server && that->m_psi))
+  locker= PSI_CALL(get_thread_mutex_locker)(&state, that->m_psi, PSI_MUTEX_LOCK);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_mutex_locker(&state, that->m_psi, PSI_MUTEX_LOCK);
-    if (likely(locker != NULL))
-      PSI_server->start_mutex_wait(locker, src_file, src_line);
+    PSI_CALL(start_mutex_wait)(locker, src_file, src_line);
+#ifdef SAFE_MUTEX
+    result= safe_mutex_lock(&that->m_mutex, FALSE, src_file, src_line);
+#else
+    result= pthread_mutex_lock(&that->m_mutex);
+#endif
+    PSI_CALL(end_mutex_wait)(locker, result);
+    return result;
   }
 #endif
+
 #ifdef SAFE_MUTEX
   result= safe_mutex_lock(&that->m_mutex, FALSE, src_file, src_line);
 #else
   result= pthread_mutex_lock(&that->m_mutex);
 #endif
-#ifdef HAVE_PSI_MUTEX_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_mutex_wait(locker, result);
-#endif
   return result;
 }
 
@@ -677,24 +675,27 @@ static inline int inline_mysql_mutex_try
 {
   int result;
 #ifdef HAVE_PSI_MUTEX_INTERFACE
-  struct PSI_mutex_locker *locker= NULL;
+  struct PSI_mutex_locker *locker;
   PSI_mutex_locker_state state;
-  if (likely(PSI_server && that->m_psi))
+  locker= PSI_CALL(get_thread_mutex_locker)(&state, that->m_psi, PSI_MUTEX_TRYLOCK);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_mutex_locker(&state, that->m_psi, PSI_MUTEX_TRYLOCK);
-    if (likely(locker != NULL))
-      PSI_server->start_mutex_wait(locker, src_file, src_line);
+    PSI_CALL(start_mutex_wait)(locker, src_file, src_line);
+#ifdef SAFE_MUTEX
+    result= safe_mutex_lock(&that->m_mutex, TRUE, src_file, src_line);
+#else
+    result= pthread_mutex_trylock(&that->m_mutex);
+#endif
+    PSI_CALL(end_mutex_wait)(locker, result);
+    return result;
   }
 #endif
+
 #ifdef SAFE_MUTEX
   result= safe_mutex_lock(&that->m_mutex, TRUE, src_file, src_line);
 #else
   result= pthread_mutex_trylock(&that->m_mutex);
 #endif
-#ifdef HAVE_PSI_MUTEX_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_mutex_wait(locker, result);
-#endif
   return result;
 }
 
@@ -707,8 +708,7 @@ static inline int inline_mysql_mutex_unl
 {
   int result;
 #ifdef HAVE_PSI_MUTEX_INTERFACE
-  if (likely(PSI_server && that->m_psi))
-    PSI_server->unlock_mutex(that->m_psi);
+  PSI_CALL(unlock_mutex)(that->m_psi);
 #endif
 #ifdef SAFE_MUTEX
   result= safe_mutex_unlock(&that->m_mutex, src_file, src_line);
@@ -731,8 +731,7 @@ static inline void inline_mysql_rwlock_r
 )
 {
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  if (likely(PSI_server != NULL))
-    PSI_server->register_rwlock(category, info, count);
+  PSI_CALL(register_rwlock)(category, info, count);
 #endif
 }
 
@@ -743,8 +742,7 @@ static inline int inline_mysql_rwlock_in
   mysql_rwlock_t *that)
 {
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  that->m_psi= (PSI_server ? PSI_server->init_rwlock(key, &that->m_rwlock)
-                           : NULL);
+  that->m_psi= PSI_CALL(init_rwlock)(key, &that->m_rwlock);
 #else
   that->m_psi= NULL;
 #endif
@@ -762,8 +760,7 @@ static inline int inline_mysql_prlock_in
   mysql_prlock_t *that)
 {
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  that->m_psi= (PSI_server ? PSI_server->init_rwlock(key, &that->m_prlock)
-                           : NULL);
+  that->m_psi= PSI_CALL(init_rwlock)(key, &that->m_prlock);
 #else
   that->m_psi= NULL;
 #endif
@@ -775,11 +772,8 @@ static inline int inline_mysql_rwlock_de
   mysql_rwlock_t *that)
 {
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  if (likely(PSI_server && that->m_psi))
-  {
-    PSI_server->destroy_rwlock(that->m_psi);
-    that->m_psi= NULL;
-  }
+  PSI_CALL(destroy_rwlock)(that->m_psi);
+  that->m_psi= NULL;
 #endif
   return rwlock_destroy(&that->m_rwlock);
 }
@@ -789,11 +783,8 @@ static inline int inline_mysql_prlock_de
   mysql_prlock_t *that)
 {
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  if (likely(PSI_server && that->m_psi))
-  {
-    PSI_server->destroy_rwlock(that->m_psi);
-    that->m_psi= NULL;
-  }
+  PSI_CALL(destroy_rwlock)(that->m_psi);
+  that->m_psi= NULL;
 #endif
   return rw_pr_destroy(&that->m_prlock);
 }
@@ -808,21 +799,20 @@ static inline int inline_mysql_rwlock_rd
 {
   int result;
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  struct PSI_rwlock_locker *locker= NULL;
+  struct PSI_rwlock_locker *locker;
   PSI_rwlock_locker_state state;
-  if (likely(PSI_server && that->m_psi))
+  locker= PSI_CALL(get_thread_rwlock_locker)(&state, that->m_psi,
+                                             PSI_RWLOCK_READLOCK);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
-                                                 PSI_RWLOCK_READLOCK);
-    if (likely(locker != NULL))
-      PSI_server->start_rwlock_rdwait(locker, src_file, src_line);
+    PSI_CALL(start_rwlock_rdwait)(locker, src_file, src_line);
+    result= rw_rdlock(&that->m_rwlock);
+    PSI_CALL(end_rwlock_rdwait)(locker, result);
+    return result;
   }
 #endif
+
   result= rw_rdlock(&that->m_rwlock);
-#ifdef HAVE_PSI_RWLOCK_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_rwlock_rdwait(locker, result);
-#endif
   return result;
 }
 
@@ -836,21 +826,20 @@ static inline int inline_mysql_prlock_rd
 {
   int result;
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  struct PSI_rwlock_locker *locker= NULL;
+  struct PSI_rwlock_locker *locker;
   PSI_rwlock_locker_state state;
-  if (likely(PSI_server && that->m_psi))
+  locker= PSI_CALL(get_thread_rwlock_locker)(&state, that->m_psi,
+                                             PSI_RWLOCK_READLOCK);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
-                                                 PSI_RWLOCK_READLOCK);
-    if (likely(locker != NULL))
-      PSI_server->start_rwlock_rdwait(locker, src_file, src_line);
+    PSI_CALL(start_rwlock_rdwait)(locker, src_file, src_line);
+    result= rw_pr_rdlock(&that->m_prlock);
+    PSI_CALL(end_rwlock_rdwait)(locker, result);
+    return result;
   }
 #endif
+
   result= rw_pr_rdlock(&that->m_prlock);
-#ifdef HAVE_PSI_RWLOCK_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_rwlock_rdwait(locker, result);
-#endif
   return result;
 }
 #endif
@@ -864,21 +853,20 @@ static inline int inline_mysql_rwlock_wr
 {
   int result;
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  struct PSI_rwlock_locker *locker= NULL;
+  struct PSI_rwlock_locker *locker;
   PSI_rwlock_locker_state state;
-  if (likely(PSI_server && that->m_psi))
+  locker= PSI_CALL(get_thread_rwlock_locker)(&state, that->m_psi,
+                                             PSI_RWLOCK_WRITELOCK);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
-                                                 PSI_RWLOCK_WRITELOCK);
-    if (likely(locker != NULL))
-      PSI_server->start_rwlock_wrwait(locker, src_file, src_line);
+    PSI_CALL(start_rwlock_wrwait)(locker, src_file, src_line);
+    result= rw_wrlock(&that->m_rwlock);
+    PSI_CALL(end_rwlock_wrwait)(locker, result);
+    return result;
   }
 #endif
+
   result= rw_wrlock(&that->m_rwlock);
-#ifdef HAVE_PSI_RWLOCK_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_rwlock_wrwait(locker, result);
-#endif
   return result;
 }
 
@@ -892,21 +880,20 @@ static inline int inline_mysql_prlock_wr
 {
   int result;
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  struct PSI_rwlock_locker *locker= NULL;
+  struct PSI_rwlock_locker *locker;
   PSI_rwlock_locker_state state;
-  if (likely(PSI_server && that->m_psi))
+  locker= PSI_CALL(get_thread_rwlock_locker)(&state, that->m_psi,
+                                             PSI_RWLOCK_WRITELOCK);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
-                                                 PSI_RWLOCK_WRITELOCK);
-    if (likely(locker != NULL))
-      PSI_server->start_rwlock_wrwait(locker, src_file, src_line);
+    PSI_CALL(start_rwlock_wrwait)(locker, src_file, src_line);
+    result= rw_pr_wrlock(&that->m_prlock);
+    PSI_CALL(end_rwlock_wrwait)(locker, result);
+    return result;
   }
 #endif
+
   result= rw_pr_wrlock(&that->m_prlock);
-#ifdef HAVE_PSI_RWLOCK_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_rwlock_wrwait(locker, result);
-#endif
   return result;
 }
 #endif
@@ -920,21 +907,20 @@ static inline int inline_mysql_rwlock_tr
 {
   int result;
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  struct PSI_rwlock_locker *locker= NULL;
+  struct PSI_rwlock_locker *locker;
   PSI_rwlock_locker_state state;
-  if (likely(PSI_server && that->m_psi))
+  locker= PSI_CALL(get_thread_rwlock_locker)(&state, that->m_psi,
+                                             PSI_RWLOCK_TRYREADLOCK);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
-                                                 PSI_RWLOCK_TRYREADLOCK);
-    if (likely(locker != NULL))
-      PSI_server->start_rwlock_rdwait(locker, src_file, src_line);
+    PSI_CALL(start_rwlock_rdwait)(locker, src_file, src_line);
+    result= rw_tryrdlock(&that->m_rwlock);
+    PSI_CALL(end_rwlock_rdwait)(locker, result);
+    return result;
   }
 #endif
+
   result= rw_tryrdlock(&that->m_rwlock);
-#ifdef HAVE_PSI_RWLOCK_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_rwlock_rdwait(locker, result);
-#endif
   return result;
 }
 
@@ -947,21 +933,20 @@ static inline int inline_mysql_rwlock_tr
 {
   int result;
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  struct PSI_rwlock_locker *locker= NULL;
+  struct PSI_rwlock_locker *locker;
   PSI_rwlock_locker_state state;
-  if (likely(PSI_server && that->m_psi))
+  locker= PSI_CALL(get_thread_rwlock_locker)(&state, that->m_psi,
+                                             PSI_RWLOCK_TRYWRITELOCK);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
-                                                 PSI_RWLOCK_TRYWRITELOCK);
-    if (likely(locker != NULL))
-      PSI_server->start_rwlock_wrwait(locker, src_file, src_line);
+    PSI_CALL(start_rwlock_wrwait)(locker, src_file, src_line);
+    result= rw_trywrlock(&that->m_rwlock);
+    PSI_CALL(end_rwlock_wrwait)(locker, result);
+    return result;
   }
 #endif
+
   result= rw_trywrlock(&that->m_rwlock);
-#ifdef HAVE_PSI_RWLOCK_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_rwlock_wrwait(locker, result);
-#endif
   return result;
 }
 
@@ -970,8 +955,7 @@ static inline int inline_mysql_rwlock_un
 {
   int result;
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  if (likely(PSI_server && that->m_psi))
-    PSI_server->unlock_rwlock(that->m_psi);
+  PSI_CALL(unlock_rwlock)(that->m_psi);
 #endif
   result= rw_unlock(&that->m_rwlock);
   return result;
@@ -983,8 +967,7 @@ static inline int inline_mysql_prlock_un
 {
   int result;
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  if (likely(PSI_server && that->m_psi))
-    PSI_server->unlock_rwlock(that->m_psi);
+  PSI_CALL(unlock_rwlock)(that->m_psi);
 #endif
   result= rw_pr_unlock(&that->m_prlock);
   return result;
@@ -1004,8 +987,7 @@ static inline void inline_mysql_cond_reg
 )
 {
 #ifdef HAVE_PSI_COND_INTERFACE
-  if (likely(PSI_server != NULL))
-    PSI_server->register_cond(category, info, count);
+  PSI_CALL(register_cond)(category, info, count);
 #endif
 }
 
@@ -1017,8 +999,7 @@ static inline int inline_mysql_cond_init
   const pthread_condattr_t *attr)
 {
 #ifdef HAVE_PSI_COND_INTERFACE
-  that->m_psi= (PSI_server ? PSI_server->init_cond(key, &that->m_cond)
-                           : NULL);
+  that->m_psi= PSI_CALL(init_cond)(key, &that->m_cond);
 #else
   that->m_psi= NULL;
 #endif
@@ -1029,11 +1010,8 @@ static inline int inline_mysql_cond_dest
   mysql_cond_t *that)
 {
 #ifdef HAVE_PSI_COND_INTERFACE
-  if (likely(PSI_server && that->m_psi))
-  {
-    PSI_server->destroy_cond(that->m_psi);
-    that->m_psi= NULL;
-  }
+  PSI_CALL(destroy_cond)(that->m_psi);
+  that->m_psi= NULL;
 #endif
   return pthread_cond_destroy(&that->m_cond);
 }
@@ -1048,21 +1026,20 @@ static inline int inline_mysql_cond_wait
 {
   int result;
 #ifdef HAVE_PSI_COND_INTERFACE
-  struct PSI_cond_locker *locker= NULL;
+  struct PSI_cond_locker *locker;
   PSI_cond_locker_state state;
-  if (likely(PSI_server && that->m_psi))
+  locker= PSI_CALL(get_thread_cond_locker)(&state, that->m_psi, mutex->m_psi,
+                                           PSI_COND_WAIT);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_cond_locker(&state, that->m_psi, mutex->m_psi,
-                                               PSI_COND_WAIT);
-    if (likely(locker != NULL))
-      PSI_server->start_cond_wait(locker, src_file, src_line);
+    PSI_CALL(start_cond_wait)(locker, src_file, src_line);
+    result= pthread_cond_wait(&that->m_cond, &mutex->m_mutex);
+    PSI_CALL(end_cond_wait)(locker, result);
+    return result;
   }
 #endif
+
   result= pthread_cond_wait(&that->m_cond, &mutex->m_mutex);
-#ifdef HAVE_PSI_COND_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_cond_wait(locker, result);
-#endif
   return result;
 }
 
@@ -1077,21 +1054,20 @@ static inline int inline_mysql_cond_time
 {
   int result;
 #ifdef HAVE_PSI_COND_INTERFACE
-  struct PSI_cond_locker *locker= NULL;
+  struct PSI_cond_locker *locker;
   PSI_cond_locker_state state;
-  if (likely(PSI_server && that->m_psi))
+  locker= PSI_CALL(get_thread_cond_locker)(&state, that->m_psi, mutex->m_psi,
+                                           PSI_COND_TIMEDWAIT);
+  if (likely(locker != NULL))
   {
-    locker= PSI_server->get_thread_cond_locker(&state, that->m_psi, mutex->m_psi,
-                                               PSI_COND_TIMEDWAIT);
-    if (likely(locker != NULL))
-      PSI_server->start_cond_wait(locker, src_file, src_line);
+    PSI_CALL(start_cond_wait)(locker, src_file, src_line);
+    result= pthread_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime);
+    PSI_CALL(end_cond_wait)(locker, result);
+    return result;
   }
 #endif
+
   result= pthread_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime);
-#ifdef HAVE_PSI_COND_INTERFACE
-  if (likely(locker != NULL))
-    PSI_server->end_cond_wait(locker, result);
-#endif
   return result;
 }
 
@@ -1100,8 +1076,7 @@ static inline int inline_mysql_cond_sign
 {
   int result;
 #ifdef HAVE_PSI_COND_INTERFACE
-  if (likely(PSI_server && that->m_psi))
-    PSI_server->signal_cond(that->m_psi);
+  PSI_CALL(signal_cond)(that->m_psi);
 #endif
   result= pthread_cond_signal(&that->m_cond);
   return result;
@@ -1112,8 +1087,7 @@ static inline int inline_mysql_cond_broa
 {
   int result;
 #ifdef HAVE_PSI_COND_INTERFACE
-  if (likely(PSI_server && that->m_psi))
-    PSI_server->broadcast_cond(that->m_psi);
+  PSI_CALL(broadcast_cond)(that->m_psi);
 #endif
   result= pthread_cond_broadcast(&that->m_cond);
   return result;
@@ -1132,8 +1106,7 @@ static inline void inline_mysql_thread_r
 )
 {
 #ifdef HAVE_PSI_THREAD_INTERFACE
-  if (likely(PSI_server != NULL))
-    PSI_server->register_thread(category, info, count);
+  PSI_CALL(register_thread)(category, info, count);
 #endif
 }
 
@@ -1144,21 +1117,14 @@ static inline int inline_mysql_thread_cr
   void *(*start_routine)(void*), void *arg)
 {
   int result;
-  if (likely(PSI_server != NULL))
-    result= PSI_server->spawn_thread(key, thread, attr, start_routine, arg);
-  else
-    result= pthread_create(thread, attr, start_routine, arg);
+  result= PSI_CALL(spawn_thread)(key, thread, attr, start_routine, arg);
   return result;
 }
 
 static inline void inline_mysql_thread_set_psi_id(ulong id)
 {
-  if (likely(PSI_server != NULL))
-  {
-    struct PSI_thread *psi= PSI_server->get_thread();
-    if (likely(psi != NULL))
-      PSI_server->set_thread_id(psi, id);
-  }
+  struct PSI_thread *psi= PSI_CALL(get_thread)();
+  PSI_CALL(set_thread_id)(psi, id);
 }
 #endif
 

=== modified file 'include/mysql/psi/psi.h'
--- a/include/mysql/psi/psi.h	2011-04-26 20:35:24 +0000
+++ b/include/mysql/psi/psi.h	2011-07-01 08:46:20 +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
@@ -165,9 +166,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
@@ -600,6 +606,8 @@ struct PSI_mutex_locker_state_v1
 {
   /** Internal state. */
   uint m_flags;
+  /** Current operation. */
+  enum PSI_mutex_operation m_operation;
   /** Current mutex. */
   struct PSI_mutex *m_mutex;
   /** Current thread. */
@@ -608,12 +616,6 @@ struct PSI_mutex_locker_state_v1
   ulonglong m_timer_start;
   /** Timer function. */
   ulonglong (*m_timer)(void);
-  /** Current operation. */
-  enum PSI_mutex_operation m_operation;
-  /** Source file. */
-  const char* m_src_file;
-  /** Source line number. */
-  int m_src_line;
   /** Internal data. */
   void *m_wait;
 };
@@ -631,6 +633,8 @@ struct PSI_rwlock_locker_state_v1
 {
   /** Internal state. */
   uint m_flags;
+  /** Current operation. */
+  enum PSI_rwlock_operation m_operation;
   /** Current rwlock. */
   struct PSI_rwlock *m_rwlock;
   /** Current thread. */
@@ -639,12 +643,6 @@ struct PSI_rwlock_locker_state_v1
   ulonglong m_timer_start;
   /** Timer function. */
   ulonglong (*m_timer)(void);
-  /** Current operation. */
-  enum PSI_rwlock_operation m_operation;
-  /** Source file. */
-  const char* m_src_file;
-  /** Source line number. */
-  int m_src_line;
   /** Internal data. */
   void *m_wait;
 };
@@ -662,6 +660,8 @@ struct PSI_cond_locker_state_v1
 {
   /** Internal state. */
   uint m_flags;
+  /** Current operation. */
+  enum PSI_cond_operation m_operation;
   /** Current condition. */
   struct PSI_cond *m_cond;
   /** Current mutex. */
@@ -672,12 +672,6 @@ struct PSI_cond_locker_state_v1
   ulonglong m_timer_start;
   /** Timer function. */
   ulonglong (*m_timer)(void);
-  /** Current operation. */
-  enum PSI_cond_operation m_operation;
-  /** Source file. */
-  const char* m_src_file;
-  /** Source line number. */
-  int m_src_line;
   /** Internal data. */
   void *m_wait;
 };
@@ -697,6 +691,8 @@ struct PSI_file_locker_state_v1
 {
   /** Internal state. */
   uint m_flags;
+  /** Current operation. */
+  enum PSI_file_operation m_operation;
   /** Current file. */
   struct PSI_file *m_file;
   /** Current thread. */
@@ -707,12 +703,6 @@ struct PSI_file_locker_state_v1
   ulonglong m_timer_start;
   /** Timer function. */
   ulonglong (*m_timer)(void);
-  /** Current operation. */
-  enum PSI_file_operation m_operation;
-  /** Source file. */
-  const char* m_src_file;
-  /** Source line number. */
-  int m_src_line;
   /** Internal data. */
   void *m_wait;
 };
@@ -732,6 +722,8 @@ struct PSI_table_locker_state_v1
 {
   /** Internal state. */
   uint m_flags;
+  /** Current io operation. */
+  enum PSI_table_io_operation m_io_operation;
   /** Current table handle. */
   struct PSI_table *m_table;
   /** Current table share. */
@@ -742,20 +734,14 @@ struct PSI_table_locker_state_v1
   ulonglong m_timer_start;
   /** Timer function. */
   ulonglong (*m_timer)(void);
-  /** Current io operation. */
-  enum PSI_table_io_operation m_io_operation;
+  /** Internal data. */
+  void *m_wait;
   /**
     Implementation specific.
     For table io, the table io index.
     For table lock, the lock type.
   */
   uint m_index;
-  /** Source file. */
-  const char* m_src_file;
-  /** Source line number. */
-  int m_src_line;
-  /** Internal data. */
-  void *m_wait;
 };
 
 /**
@@ -770,6 +756,12 @@ struct PSI_table_locker_state_v1
 */
 struct PSI_statement_locker_state_v1
 {
+  /** Discarded flag. */
+  my_bool m_discarded;
+  /** Metric, no index used flag. */
+  uchar m_no_index_used;
+  /** Metric, no good index used flag. */
+  uchar m_no_good_index_used;
   /** Internal state. */
   uint m_flags;
   /** Instrumentation class. */
@@ -780,14 +772,8 @@ struct PSI_statement_locker_state_v1
   ulonglong m_timer_start;
   /** Timer function. */
   ulonglong (*m_timer)(void);
-  /** Source file. */
-  const char* m_src_file;
-  /** Source line number. */
-  int m_src_line;
   /** Internal data. */
   void *m_statement;
-  /** Discarded flag. */
-  my_bool m_discarded;
   /** Locked time. */
   ulonglong m_lock_time;
   /** Rows sent. */
@@ -795,31 +781,27 @@ struct PSI_statement_locker_state_v1
   /** Rows examined. */
   ulonglong m_rows_examined;
   /** Metric, temporary tables created on disk. */
-  ulonglong m_created_tmp_disk_tables;
+  ulong m_created_tmp_disk_tables;
   /** Metric, temporary tables created. */
-  ulonglong m_created_tmp_tables;
+  ulong m_created_tmp_tables;
   /** Metric, number of select full join. */
-  ulonglong m_select_full_join;
+  ulong m_select_full_join;
   /** Metric, number of select full range join. */
-  ulonglong m_select_full_range_join;
+  ulong m_select_full_range_join;
   /** Metric, number of select range. */
-  ulonglong m_select_range;
+  ulong m_select_range;
   /** Metric, number of select range check. */
-  ulonglong m_select_range_check;
+  ulong m_select_range_check;
   /** Metric, number of select scan. */
-  ulonglong m_select_scan;
+  ulong m_select_scan;
   /** Metric, number of sort merge passes. */
-  ulonglong m_sort_merge_passes;
+  ulong m_sort_merge_passes;
   /** Metric, number of sort merge. */
-  ulonglong m_sort_range;
+  ulong m_sort_range;
   /** Metric, number of sort rows. */
-  ulonglong m_sort_rows;
+  ulong m_sort_rows;
   /** Metric, number of sort scans. */
-  ulonglong m_sort_scan;
-  /** Metric, number of no index used. */
-  ulonglong m_no_index_used;
-  /** Metric, number of no good index used. */
-  ulonglong m_no_good_index_used;
+  ulong m_sort_scan;
 };
 
 /* Using typedef to make reuse between PSI_v1 and PSI_v2 easier later. */
@@ -1961,6 +1943,8 @@ typedef struct PSI_stage_info_none PSI_s
 
 extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
 
+#define PSI_CALL(M) PSI_server->M
+
 /** @} */
 
 C_MODE_END

=== modified file 'include/mysql/psi/psi_abi_v1.h.pp'
--- a/include/mysql/psi/psi_abi_v1.h.pp	2011-02-14 14:23:55 +0000
+++ b/include/mysql/psi/psi_abi_v1.h.pp	2011-07-01 08:46:20 +0000
@@ -119,94 +119,82 @@ struct PSI_statement_info_v1
 struct PSI_mutex_locker_state_v1
 {
   uint m_flags;
+  enum PSI_mutex_operation m_operation;
   struct PSI_mutex *m_mutex;
   struct PSI_thread *m_thread;
   ulonglong m_timer_start;
   ulonglong (*m_timer)(void);
-  enum PSI_mutex_operation m_operation;
-  const char* m_src_file;
-  int m_src_line;
   void *m_wait;
 };
 struct PSI_rwlock_locker_state_v1
 {
   uint m_flags;
+  enum PSI_rwlock_operation m_operation;
   struct PSI_rwlock *m_rwlock;
   struct PSI_thread *m_thread;
   ulonglong m_timer_start;
   ulonglong (*m_timer)(void);
-  enum PSI_rwlock_operation m_operation;
-  const char* m_src_file;
-  int m_src_line;
   void *m_wait;
 };
 struct PSI_cond_locker_state_v1
 {
   uint m_flags;
+  enum PSI_cond_operation m_operation;
   struct PSI_cond *m_cond;
   struct PSI_mutex *m_mutex;
   struct PSI_thread *m_thread;
   ulonglong m_timer_start;
   ulonglong (*m_timer)(void);
-  enum PSI_cond_operation m_operation;
-  const char* m_src_file;
-  int m_src_line;
   void *m_wait;
 };
 struct PSI_file_locker_state_v1
 {
   uint m_flags;
+  enum PSI_file_operation m_operation;
   struct PSI_file *m_file;
   struct PSI_thread *m_thread;
   size_t m_number_of_bytes;
   ulonglong m_timer_start;
   ulonglong (*m_timer)(void);
-  enum PSI_file_operation m_operation;
-  const char* m_src_file;
-  int m_src_line;
   void *m_wait;
 };
 struct PSI_table_locker_state_v1
 {
   uint m_flags;
+  enum PSI_table_io_operation m_io_operation;
   struct PSI_table *m_table;
   struct PSI_table_share *m_table_share;
   struct PSI_thread *m_thread;
   ulonglong m_timer_start;
   ulonglong (*m_timer)(void);
-  enum PSI_table_io_operation m_io_operation;
-  uint m_index;
-  const char* m_src_file;
-  int m_src_line;
   void *m_wait;
+  uint m_index;
 };
 struct PSI_statement_locker_state_v1
 {
+  my_bool m_discarded;
+  uchar m_no_index_used;
+  uchar m_no_good_index_used;
   uint m_flags;
   void *m_class;
   struct PSI_thread *m_thread;
   ulonglong m_timer_start;
   ulonglong (*m_timer)(void);
-  const char* m_src_file;
-  int m_src_line;
   void *m_statement;
-  my_bool m_discarded;
   ulonglong m_lock_time;
   ulonglong m_rows_sent;
   ulonglong m_rows_examined;
-  ulonglong m_created_tmp_disk_tables;
-  ulonglong m_created_tmp_tables;
-  ulonglong m_select_full_join;
-  ulonglong m_select_full_range_join;
-  ulonglong m_select_range;
-  ulonglong m_select_range_check;
-  ulonglong m_select_scan;
-  ulonglong m_sort_merge_passes;
-  ulonglong m_sort_range;
-  ulonglong m_sort_rows;
-  ulonglong m_sort_scan;
-  ulonglong m_no_index_used;
-  ulonglong m_no_good_index_used;
+  ulong m_created_tmp_disk_tables;
+  ulong m_created_tmp_tables;
+  ulong m_select_full_join;
+  ulong m_select_full_range_join;
+  ulong m_select_range;
+  ulong m_select_range_check;
+  ulong m_select_scan;
+  ulong m_sort_merge_passes;
+  ulong m_sort_range;
+  ulong m_sort_rows;
+  ulong m_sort_scan;
 };
 typedef void (*register_mutex_v1_t)
   (const char *category, struct PSI_mutex_info_v1 *info, int count);

=== modified file 'include/probes_mysql_nodtrace.h'
--- a/include/probes_mysql_nodtrace.h	2011-06-30 15:50:45 +0000
+++ b/include/probes_mysql_nodtrace.h	2011-07-05 08:15:52 +0000
@@ -1,19 +1,3 @@
-/* Copyright (c) 2008, 2010 Sun Microsystems, Inc.
-   Use is subject to license terms.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; version 2 of the License.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
-
 /*
  * Generated by dheadgen(1).
  */

=== modified file 'mysys/CMakeLists.txt'
--- a/mysys/CMakeLists.txt	2011-07-04 00:25:46 +0000
+++ b/mysys/CMakeLists.txt	2011-07-05 08:15:52 +0000
@@ -34,7 +34,7 @@ SET(MYSYS_SOURCES  array.c charset-def.c
 				thr_rwlock.c tree.c typelib.c base64.c my_memmem.c my_getpagesize.c
 				lf_alloc-pin.c lf_dynarray.c lf_hash.c
 				my_atomic.c my_getncpus.c
-				my_rdtsc.c waiting_threads.c)
+				my_rdtsc.c waiting_threads.c psi_noop.cc)
 
 IF (WIN32)
  SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_winthread.c my_wincond.c my_winerr.c my_winfile.c my_windac.c my_conio.c)

=== modified file 'mysys/my_static.c'
--- a/mysys/my_static.c	2011-06-30 15:50:45 +0000
+++ b/mysys/my_static.c	2011-07-05 08:15:52 +0000
@@ -106,30 +106,3 @@ my_bool my_disable_async_io=0;
 my_bool my_disable_flush_key_blocks=0;
 my_bool my_disable_symlinks=0;
 
-/*
-  Note that PSI_hook and PSI_server are unconditionally
-  (no ifdef HAVE_PSI_INTERFACE) defined.
-  This is to ensure binary compatibility between the server and plugins,
-  in the case when:
-  - the server is not compiled with HAVE_PSI_INTERFACE
-  - a plugin is compiled with HAVE_PSI_INTERFACE
-  See the doxygen documentation for the performance schema.
-*/
-
-/**
-  Hook for the instrumentation interface.
-  Code implementing the instrumentation interface should register here.
-*/
-struct PSI_bootstrap *PSI_hook= NULL;
-
-/**
-  Instance of the instrumentation interface for the MySQL server.
-  @todo This is currently a global variable, which is handy when
-  compiling instrumented code that is bundled with the server.
-  When dynamic plugin are truly supported, this variable will need
-  to be replaced by a macro, so that each XYZ plugin can have it's own
-  xyz_psi_server variable, obtained from PSI_bootstrap::get_interface()
-  with the version used at compile time for plugin XYZ.
-*/
-PSI *PSI_server= NULL;
-

=== added file 'mysys/psi_noop.cc'
--- a/mysys/psi_noop.cc	1970-01-01 00:00:00 +0000
+++ b/mysys/psi_noop.cc	2011-07-01 08:46:20 +0000
@@ -0,0 +1,649 @@
+/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; version 2 of the License.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software Foundation,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+/*
+  Always provide the noop performance interface, for plugins.
+*/
+
+#define USE_PSI_V1
+#define HAVE_PSI_INTERFACE
+
+#include "my_global.h"
+#include "my_pthread.h"
+#include "my_sys.h"
+#include "mysql/psi/psi.h"
+
+static void register_mutex_noop(const char *category,
+                                PSI_mutex_info *info,
+                                int count)
+{
+  return;
+}
+
+static void register_rwlock_noop(const char *category,
+                                 PSI_rwlock_info *info,
+                                 int count)
+{
+  return;
+}
+
+static void register_cond_noop(const char *category,
+                               PSI_cond_info *info,
+                               int count)
+{
+  return;
+}
+
+static void register_thread_noop(const char *category,
+                                 PSI_thread_info *info,
+                                 int count)
+{
+  return;
+}
+
+static void register_file_noop(const char *category,
+                               PSI_file_info *info,
+                               int count)
+{
+  return;
+}
+
+static void register_stage_noop(const char *category,
+                                PSI_stage_info **info_array,
+                                int count)
+{
+  return;
+}
+
+static void register_statement_noop(const char *category,
+                                    PSI_statement_info *info,
+                                    int count)
+{
+  return;
+}
+
+static PSI_mutex*
+init_mutex_noop(PSI_mutex_key key, const void *identity)
+{
+  return NULL;
+}
+
+static void destroy_mutex_noop(PSI_mutex* mutex)
+{
+  return;
+}
+
+static PSI_rwlock*
+init_rwlock_noop(PSI_rwlock_key key, const void *identity)
+{
+  return NULL;
+}
+
+static void destroy_rwlock_noop(PSI_rwlock* rwlock)
+{
+  return;
+}
+
+static PSI_cond*
+init_cond_noop(PSI_cond_key key, const void *identity)
+{
+  return NULL;
+}
+
+static void destroy_cond_noop(PSI_cond* cond)
+{
+  return;
+}
+
+static PSI_table_share*
+get_table_share_noop(my_bool temporary, TABLE_SHARE *share)
+{
+  return NULL;
+}
+
+static void release_table_share_noop(PSI_table_share* share)
+{
+  return;
+}
+
+static void
+drop_table_share_noop(const char *schema_name, int schema_name_length,
+                      const char *table_name, int table_name_length)
+{
+  return;
+}
+
+static PSI_table*
+open_table_noop(PSI_table_share *share, const void *identity)
+{
+  return NULL;
+}
+
+static void close_table_noop(PSI_table *table)
+{
+  return;
+}
+
+static void create_file_noop(PSI_file_key key, const char *name, File file)
+{
+  return;
+}
+
+static int spawn_thread_noop(PSI_thread_key key,
+                             pthread_t *thread, const pthread_attr_t *attr,
+                             void *(*start_routine)(void*), void *arg)
+{
+  return pthread_create(thread, attr, start_routine, arg);
+}
+
+static PSI_thread*
+new_thread_noop(PSI_thread_key key, const void *identity, ulong thread_id)
+{
+  return NULL;
+}
+
+static void set_thread_id_noop(PSI_thread *thread, unsigned long id)
+{
+  return;
+}
+
+static PSI_thread*
+get_thread_noop(void)
+{
+  return NULL;
+}
+
+static void set_thread_user_noop(const char *user, int user_len)
+{
+  return;
+}
+
+static void set_thread_user_host_noop(const char *user, int user_len,
+                                    const char *host, int host_len)
+{
+  return;
+}
+
+static void set_thread_db_noop(const char* db, int db_len)
+{
+  return;
+}
+
+static void set_thread_command_noop(int command)
+{
+  return;
+}
+
+static void set_thread_start_time_noop(time_t start_time)
+{
+  return;
+}
+
+static void set_thread_state_noop(const char* state)
+{
+  return;
+}
+
+static void set_thread_info_noop(const char* info, int info_len)
+{
+  return;
+}
+
+static void set_thread_noop(PSI_thread* thread)
+{
+  return;
+}
+
+static void delete_current_thread_noop(void)
+{
+  return;
+}
+
+static void delete_thread_noop(PSI_thread *thread)
+{
+  return;
+}
+
+static PSI_mutex_locker*
+get_thread_mutex_locker_noop(PSI_mutex_locker_state *state,
+                             PSI_mutex *mutex, PSI_mutex_operation op)
+{
+  return NULL;
+}
+
+static PSI_rwlock_locker*
+get_thread_rwlock_locker_noop(PSI_rwlock_locker_state *state,
+                              PSI_rwlock *rwlock, PSI_rwlock_operation op)
+{
+  return NULL;
+}
+
+static PSI_cond_locker*
+get_thread_cond_locker_noop(PSI_cond_locker_state *state,
+                            PSI_cond *cond, PSI_mutex *mutex,
+                            PSI_cond_operation op)
+{
+  return NULL;
+}
+
+static PSI_table_locker*
+get_thread_table_io_locker_noop(PSI_table_locker_state *state,
+                                PSI_table *table, PSI_table_io_operation op, uint index)
+{
+  return NULL;
+}
+
+static PSI_table_locker*
+get_thread_table_lock_locker_noop(PSI_table_locker_state *state,
+                                  PSI_table *table, PSI_table_lock_operation op, ulong op_flags)
+{
+  return NULL;
+}
+
+static PSI_file_locker*
+get_thread_file_name_locker_noop(PSI_file_locker_state *state,
+                                 PSI_file_key key,
+                                 PSI_file_operation op,
+                                 const char *name, const void *identity)
+{
+  return NULL;
+}
+
+static PSI_file_locker*
+get_thread_file_stream_locker_noop(PSI_file_locker_state *state,
+                                   PSI_file *file, PSI_file_operation op)
+{
+  return NULL;
+}
+
+
+static PSI_file_locker*
+get_thread_file_descriptor_locker_noop(PSI_file_locker_state *state,
+                                       File file, PSI_file_operation op)
+{
+  return NULL;
+}
+
+static void unlock_mutex_noop(PSI_mutex *mutex)
+{
+  return;
+}
+
+static void unlock_rwlock_noop(PSI_rwlock *rwlock)
+{
+  return;
+}
+
+static void signal_cond_noop(PSI_cond* cond)
+{
+  return;
+}
+
+static void broadcast_cond_noop(PSI_cond* cond)
+{
+  return;
+}
+
+static void start_mutex_wait_noop(PSI_mutex_locker* locker,
+                                  const char *src_file, uint src_line)
+{
+  return;
+}
+
+static void end_mutex_wait_noop(PSI_mutex_locker* locker, int rc)
+{
+  return;
+}
+
+
+static void start_rwlock_rdwait_noop(PSI_rwlock_locker* locker,
+                                     const char *src_file, uint src_line)
+{
+  return;
+}
+
+static void end_rwlock_rdwait_noop(PSI_rwlock_locker* locker, int rc)
+{
+  return;
+}
+
+static void start_rwlock_wrwait_noop(PSI_rwlock_locker* locker,
+                                     const char *src_file, uint src_line)
+{
+  return;
+}
+
+static void end_rwlock_wrwait_noop(PSI_rwlock_locker* locker, int rc)
+{
+  return;
+}
+
+static void start_cond_wait_noop(PSI_cond_locker* locker,
+                                 const char *src_file, uint src_line)
+{
+  return;
+}
+
+static void end_cond_wait_noop(PSI_cond_locker* locker, int rc)
+{
+  return;
+}
+
+static void start_table_io_wait_noop(PSI_table_locker* locker,
+                                     const char *src_file, uint src_line)
+{
+  return;
+}
+
+static void end_table_io_wait_noop(PSI_table_locker* locker)
+{
+  return;
+}
+
+static void start_table_lock_wait_noop(PSI_table_locker* locker,
+                                       const char *src_file, uint src_line)
+{
+  return;
+}
+
+static void end_table_lock_wait_noop(PSI_table_locker* locker)
+{
+  return;
+}
+
+static PSI_file* start_file_open_wait_noop(PSI_file_locker *locker,
+                                           const char *src_file,
+                                           uint src_line)
+{
+  return NULL;
+}
+
+static void end_file_open_wait_noop(PSI_file_locker *locker)
+{
+  return;
+}
+
+static void end_file_open_wait_and_bind_to_descriptor_noop
+  (PSI_file_locker *locker, File file)
+{
+  return;
+}
+
+static void start_file_wait_noop(PSI_file_locker *locker,
+                                 size_t count,
+                                 const char *src_file,
+                                 uint src_line)
+{
+  return;
+}
+
+static void end_file_wait_noop(PSI_file_locker *locker,
+                               size_t count)
+{
+  return;
+}
+
+static void start_stage_noop(PSI_stage_key key, const char *src_file, int src_line)
+{
+  return;
+}
+
+static void end_stage_noop()
+{
+  return;
+}
+
+static PSI_statement_locker*
+get_thread_statement_locker_noop(PSI_statement_locker_state *state,
+                                 PSI_statement_key key)
+{
+  return NULL;
+}
+
+static PSI_statement_locker*
+refine_statement_noop(PSI_statement_locker *locker,
+                      PSI_statement_key key)
+{
+  return NULL;
+}
+
+static void start_statement_noop(PSI_statement_locker *locker,
+                                 const char *db, uint db_len,
+                                 const char *src_file, uint src_line)
+{
+  return;
+}
+
+static void set_statement_text_noop(PSI_statement_locker *locker,
+                                    const char *text, uint text_len)
+{
+  return;
+}
+
+static void set_statement_lock_time_noop(PSI_statement_locker *locker,
+                                         ulonglong count)
+{
+  return;
+}
+
+static void set_statement_rows_sent_noop(PSI_statement_locker *locker,
+                                         ulonglong count)
+{
+  return;
+}
+
+static void set_statement_rows_examined_noop(PSI_statement_locker *locker,
+                                             ulonglong count)
+{
+  return;
+}
+
+static void inc_statement_created_tmp_disk_tables_noop(PSI_statement_locker *locker,
+                                                       ulonglong count)
+{
+  return;
+}
+
+static void inc_statement_created_tmp_tables_noop(PSI_statement_locker *locker,
+                                                  ulonglong count)
+{
+  return;
+}
+
+static void inc_statement_select_full_join_noop(PSI_statement_locker *locker,
+                                                ulonglong count)
+{
+  return;
+}
+
+static void inc_statement_select_full_range_join_noop(PSI_statement_locker *locker,
+                                                      ulonglong count)
+{
+  return;
+}
+
+static void inc_statement_select_range_noop(PSI_statement_locker *locker,
+                                            ulonglong count)
+{
+  return;
+}
+
+static void inc_statement_select_range_check_noop(PSI_statement_locker *locker,
+                                                  ulonglong count)
+{
+  return;
+}
+
+static void inc_statement_select_scan_noop(PSI_statement_locker *locker,
+                                           ulonglong count)
+{
+  return;
+}
+
+static void inc_statement_sort_merge_passes_noop(PSI_statement_locker *locker,
+                                                 ulonglong count)
+{
+  return;
+}
+
+static void inc_statement_sort_range_noop(PSI_statement_locker *locker,
+                                          ulonglong count)
+{
+  return;
+}
+
+static void inc_statement_sort_rows_noop(PSI_statement_locker *locker,
+                                         ulonglong count)
+{
+  return;
+}
+
+static void inc_statement_sort_scan_noop(PSI_statement_locker *locker,
+                                         ulonglong count)
+{
+  return;
+}
+
+static void set_statement_no_index_used_noop(PSI_statement_locker *locker)
+{
+  return;
+}
+
+static void set_statement_no_good_index_used_noop(PSI_statement_locker *locker)
+{
+  return;
+}
+
+static void end_statement_noop(PSI_statement_locker *locker, void *stmt_da)
+{
+  return;
+}
+
+static PSI PSI_noop=
+{
+  register_mutex_noop,
+  register_rwlock_noop,
+  register_cond_noop,
+  register_thread_noop,
+  register_file_noop,
+  register_stage_noop,
+  register_statement_noop,
+  init_mutex_noop,
+  destroy_mutex_noop,
+  init_rwlock_noop,
+  destroy_rwlock_noop,
+  init_cond_noop,
+  destroy_cond_noop,
+  get_table_share_noop,
+  release_table_share_noop,
+  drop_table_share_noop,
+  open_table_noop,
+  close_table_noop,
+  create_file_noop,
+  spawn_thread_noop,
+  new_thread_noop,
+  set_thread_id_noop,
+  get_thread_noop,
+  set_thread_user_noop,
+  set_thread_user_host_noop,
+  set_thread_db_noop,
+  set_thread_command_noop,
+  set_thread_start_time_noop,
+  set_thread_state_noop,
+  set_thread_info_noop,
+  set_thread_noop,
+  delete_current_thread_noop,
+  delete_thread_noop,
+  get_thread_mutex_locker_noop,
+  get_thread_rwlock_locker_noop,
+  get_thread_cond_locker_noop,
+  get_thread_table_io_locker_noop,
+  get_thread_table_lock_locker_noop,
+  get_thread_file_name_locker_noop,
+  get_thread_file_stream_locker_noop,
+  get_thread_file_descriptor_locker_noop,
+  unlock_mutex_noop,
+  unlock_rwlock_noop,
+  signal_cond_noop,
+  broadcast_cond_noop,
+  start_mutex_wait_noop,
+  end_mutex_wait_noop,
+  start_rwlock_rdwait_noop,
+  end_rwlock_rdwait_noop,
+  start_rwlock_wrwait_noop,
+  end_rwlock_wrwait_noop,
+  start_cond_wait_noop,
+  end_cond_wait_noop,
+  start_table_io_wait_noop,
+  end_table_io_wait_noop,
+  start_table_lock_wait_noop,
+  end_table_lock_wait_noop,
+  start_file_open_wait_noop,
+  end_file_open_wait_noop,
+  end_file_open_wait_and_bind_to_descriptor_noop,
+  start_file_wait_noop,
+  end_file_wait_noop,
+  start_stage_noop,
+  end_stage_noop,
+  get_thread_statement_locker_noop,
+  refine_statement_noop,
+  start_statement_noop,
+  set_statement_text_noop,
+  set_statement_lock_time_noop,
+  set_statement_rows_sent_noop,
+  set_statement_rows_examined_noop,
+  inc_statement_created_tmp_disk_tables_noop,
+  inc_statement_created_tmp_tables_noop,
+  inc_statement_select_full_join_noop,
+  inc_statement_select_full_range_join_noop,
+  inc_statement_select_range_noop,
+  inc_statement_select_range_check_noop,
+  inc_statement_select_scan_noop,
+  inc_statement_sort_merge_passes_noop,
+  inc_statement_sort_range_noop,
+  inc_statement_sort_rows_noop,
+  inc_statement_sort_scan_noop,
+  set_statement_no_index_used_noop,
+  set_statement_no_good_index_used_noop,
+  end_statement_noop
+};
+
+C_MODE_START
+
+/**
+  Hook for the instrumentation interface.
+  Code implementing the instrumentation interface should register here.
+*/
+struct PSI_bootstrap *PSI_hook= NULL;
+
+/**
+  Instance of the instrumentation interface for the MySQL server.
+  @todo This is currently a global variable, which is handy when
+  compiling instrumented code that is bundled with the server.
+  When dynamic plugin are truly supported, this variable will need
+  to be replaced by a macro, so that each XYZ plugin can have it's own
+  xyz_psi_server variable, obtained from PSI_bootstrap::get_interface()
+  with the version used at compile time for plugin XYZ.
+*/
+
+PSI *PSI_server= & PSI_noop;
+
+void set_psi_server(PSI *psi)
+{
+  PSI_server= psi;
+}
+
+C_MODE_END
+

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2011-07-04 00:25:46 +0000
+++ b/sql/handler.cc	2011-07-05 08:15:52 +0000
@@ -2113,8 +2113,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);
@@ -2213,12 +2213,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)
@@ -2242,11 +2238,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);
@@ -3937,10 +3930,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-07-04 00:25:46 +0000
+++ b/sql/mysqld.cc	2011-07-05 08:15:52 +0000
@@ -2129,8 +2129,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)
@@ -2151,13 +2150,9 @@ 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);
+      PSI_CALL(set_thread)(psi);
 #endif
 
       /*
@@ -2787,8 +2782,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;
@@ -4689,27 +4683,29 @@ 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);
+      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 */
 
@@ -5010,8 +5006,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-07-04 00:25:46 +0000
+++ b/sql/sql_acl.cc	2011-07-05 08:15:52 +0000
@@ -9543,13 +9543,10 @@ acl_authenticate(THD *thd, uint connect_
     my_ok(thd);
 
 #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-07-04 00:25:46 +0000
+++ b/sql/sql_base.cc	2011-07-05 08:15:52 +0000
@@ -582,8 +582,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",
@@ -5962,8 +5963,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-07-04 00:25:46 +0000
+++ b/sql/sql_class.cc	2011-07-05 08:15:52 +0000
@@ -334,11 +334,10 @@ THD *thd_get_current_thd()
 void thd_new_connection_setup(THD *thd, char *stack_start)
 {
 #ifdef HAVE_PSI_INTERFACE
-  if (PSI_server)
-    thd_set_psi(thd,
-                PSI_server->new_thread(key_thread_one_connection,
-                                       thd,
-                                       thd_get_thread_id((MYSQL_THD)thd)));
+  thd_set_psi(thd,
+              PSI_CALL(new_thread)(key_thread_one_connection,
+                                   thd,
+                                   thd->thread_id));
 #endif
   thd->set_time();
   thd->prior_thr_create_utime= thd->thr_create_utime= thd->start_utime=
@@ -510,8 +509,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;
 }
@@ -3804,8 +3802,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
 }
 
@@ -3813,8 +3810,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
 }
 
@@ -3822,8 +3818,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
 }
 
@@ -3831,8 +3826,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
 }
 
@@ -3840,8 +3834,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
 }
 
@@ -3849,8 +3842,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
 }
 
@@ -3858,8 +3850,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
 }
 
@@ -3867,8 +3858,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
 }
 
@@ -3876,8 +3866,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
 }
 
@@ -3885,8 +3874,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
 }
 
@@ -3894,8 +3882,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
 }
 
@@ -3903,8 +3890,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
 }
 
@@ -3912,8 +3898,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
 }
 
@@ -3921,8 +3906,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
 }
 
@@ -3936,8 +3920,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-07-04 00:25:46 +0000
+++ b/sql/sql_class.h	2011-07-05 08:15:52 +0000
@@ -2632,26 +2632,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 */
@@ -3025,9 +3022,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;
   }
@@ -3047,9 +3044,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-07-04 00:25:46 +0000
+++ b/sql/table.cc	2011-07-05 08:15:52 +0000
@@ -472,8 +472,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-06-28 12:36:14 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2011-07-01 08:46:20 +0000
@@ -2686,42 +2686,33 @@ 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);
-
- 		mysql_mutex_register(
-			"innodb", all_pthread_mutexes, count);
+	count = array_elements(all_pthread_mutexes);
+ 	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/innobase/include/os0file.h'
--- a/storage/innobase/include/os0file.h	2011-05-17 11:42:10 +0000
+++ b/storage/innobase/include/os0file.h	2011-07-01 08:46:20 +0000
@@ -206,20 +206,18 @@ used to register actual file read, write
 # define register_pfs_file_open_begin(state, locker, key, op, name,	\
 				      src_file, src_line)		\
 do {									\
-	if (PSI_server) {						\
-		locker = PSI_server->get_thread_file_name_locker(	\
-			state, key, op, name, &locker);			\
-		if (locker) {						\
-			PSI_server->start_file_open_wait(		\
-				locker, src_file, src_line);		\
-		}							\
+	locker = PSI_CALL(get_thread_file_name_locker)(			\
+		state, key, op, name, &locker);				\
+	if (UNIV_LIKELY(locker != NULL)) {				\
+		PSI_CALL(start_file_open_wait)(				\
+			locker, src_file, src_line);			\
 	}								\
 } while (0)
 
 # define register_pfs_file_open_end(locker, file)			\
 do {									\
-	if (locker) {							\
-		PSI_server->end_file_open_wait_and_bind_to_descriptor(	\
+	if (UNIV_LIKELY(locker != NULL)) {				\
+		PSI_CALL(end_file_open_wait_and_bind_to_descriptor)(	\
 			locker, file);					\
 	}								\
 } while (0)
@@ -227,20 +225,18 @@ do {									\
 # define register_pfs_file_io_begin(state, locker, file, count, op,	\
 				    src_file, src_line)			\
 do {									\
-	if (PSI_server) {						\
-		locker = PSI_server->get_thread_file_descriptor_locker(	\
-			state, file, op);				\
-		if (locker) {						\
-			PSI_server->start_file_wait(			\
-				locker, count, src_file, src_line);	\
-		}							\
+	locker = PSI_CALL(get_thread_file_descriptor_locker)(		\
+		state, file, op);					\
+	if (UNIV_LIKELY(locker != NULL)) {				\
+		PSI_CALL(start_file_wait)(				\
+			locker, count, src_file, src_line);		\
 	}								\
 } while (0)
 
 # define register_pfs_file_io_end(locker, count)			\
 do {									\
-	if (locker) {							\
-		PSI_server->end_file_wait(locker, count);		\
+	if (UNIV_LIKELY(locker != NULL)) {				\
+		PSI_CALL(end_file_wait)(locker, count);			\
 	}								\
 } while (0)
 #endif /* UNIV_PFS_IO  */

=== modified file 'storage/innobase/include/os0sync.ic'
--- a/storage/innobase/include/os0sync.ic	2011-02-15 09:40:34 +0000
+++ b/storage/innobase/include/os0sync.ic	2011-07-01 08:46:20 +0000
@@ -65,10 +65,11 @@ pfs_os_fast_mutex_init(
 						key */
 	os_fast_mutex_t*	fast_mutex)	/*!< out: fast mutex */
 {
-	fast_mutex->pfs_psi = (PSI_server && PFS_IS_INSTRUMENTED(key))
-				? PSI_server->init_mutex(key,
-							 &fast_mutex->mutex)
-				: NULL;
+#ifdef HAVE_PSI_MUTEX_INTERFACE
+	fast_mutex->pfs_psi = PSI_CALL(init_mutex)(key, &fast_mutex->mutex);
+#else
+	fast_mutex->pfs_psi = NULL;
+#endif
 
 	os_fast_mutex_init_func(&fast_mutex->mutex);
 }
@@ -83,10 +84,10 @@ pfs_os_fast_mutex_free(
 /*===================*/
 	os_fast_mutex_t*	fast_mutex)  /*!< in/out: mutex */
 {
-	if (UNIV_LIKELY(PSI_server && fast_mutex->pfs_psi)) {
-		PSI_server->destroy_mutex(fast_mutex->pfs_psi);
-		fast_mutex->pfs_psi = NULL;
-	}
+#ifdef HAVE_PSI_MUTEX_INTERFACE
+	PSI_CALL(destroy_mutex)(fast_mutex->pfs_psi);
+#endif
+	fast_mutex->pfs_psi = NULL;
 
 	os_fast_mutex_free_func(&fast_mutex->mutex);
 }
@@ -104,23 +105,21 @@ pfs_os_fast_mutex_lock(
 						 locked */
 	ulint			line)		/*!< in: line where locked */
 {
-	struct PSI_mutex_locker*        locker = NULL;
+#ifdef HAVE_PSI_MUTEX_INTERFACE
+	struct PSI_mutex_locker*        locker;
 	PSI_mutex_locker_state          state;
-	int     result = 0;
 
-	if (UNIV_LIKELY(PSI_server && fast_mutex->pfs_psi)) {
-		locker = PSI_server->get_thread_mutex_locker(
-			&state, fast_mutex->pfs_psi, PSI_MUTEX_LOCK);
-		if (locker) {
-			PSI_server->start_mutex_wait(locker, file_name, line);
-		}
+	locker = PSI_CALL(get_thread_mutex_locker)(
+		&state, fast_mutex->pfs_psi, PSI_MUTEX_LOCK);
+	if (UNIV_LIKELY(locker != NULL)) {
+		PSI_CALL(start_mutex_wait)(locker, file_name, line);
+		os_fast_mutex_lock_func(&fast_mutex->mutex);
+		PSI_CALL(end_mutex_wait)(locker, 0);
+		return;
 	}
+#endif
 
 	os_fast_mutex_lock_func(&fast_mutex->mutex);
-
-	if (locker) {
-		PSI_server->end_mutex_wait(locker, result);
-	}
 }
 /**********************************************************//**
 NOTE! Please use the corresponding macro os_fast_mutex_unlock, not directly
@@ -133,9 +132,9 @@ pfs_os_fast_mutex_unlock(
 /*=====================*/
 	os_fast_mutex_t*	fast_mutex)	/*!< in/out: mutex to release */
 {
-	if (UNIV_LIKELY(PSI_server && fast_mutex->pfs_psi)) {
-		PSI_server->unlock_mutex(fast_mutex->pfs_psi);
-	}
+#ifdef HAVE_PSI_MUTEX_INTERFACE
+	PSI_CALL(unlock_mutex)(fast_mutex->pfs_psi);
+#endif
 
 	os_fast_mutex_unlock_func(&fast_mutex->mutex);
 }

=== modified file 'storage/innobase/include/srv0srv.h'
--- a/storage/innobase/include/srv0srv.h	2011-06-23 06:48:48 +0000
+++ b/storage/innobase/include/srv0srv.h	2011-07-01 08:46:20 +0000
@@ -375,20 +375,14 @@ extern mysql_pfs_key_t	srv_purge_thread_
 schema */
 #  define pfs_register_thread(key)			\
 do {								\
-	if (PSI_server) {					\
-		struct PSI_thread* psi = PSI_server->new_thread(key, NULL, 0);\
-		if (psi) {					\
-			PSI_server->set_thread(psi);		\
-		}						\
-	}							\
+	struct PSI_thread* psi = PSI_CALL(new_thread)(key, NULL, 0);\
+	PSI_CALL(set_thread)(psi);				\
 } while (0)
 
 /* This macro delist the current thread from performance schema */
 #  define pfs_delete_thread()				\
 do {								\
-	if (PSI_server) {					\
-		PSI_server->delete_current_thread();		\
-	}							\
+	PSI_CALL(delete_current_thread)();			\
 } while (0)
 # endif /* UNIV_PFS_THREAD */
 

=== modified file 'storage/innobase/include/sync0rw.ic'
--- a/storage/innobase/include/sync0rw.ic	2011-06-16 09:26:09 +0000
+++ b/storage/innobase/include/sync0rw.ic	2011-07-01 08:46:20 +0000
@@ -646,9 +646,7 @@ pfs_rw_lock_create_func(
 	ulint		cline)		/*!< in: file line where created */
 {
 	/* Initialize the rwlock for performance schema */
-	lock->pfs_psi = (PSI_server && PFS_IS_INSTRUMENTED(key))
-				? PSI_server->init_rwlock(key, lock)
-				: NULL;
+	lock->pfs_psi = PSI_CALL(init_rwlock)(key, lock);
 
 	/* The actual function to initialize an rwlock */
 	rw_lock_create_func(lock,
@@ -675,25 +673,21 @@ pfs_rw_lock_x_lock_func(
 	const char*	file_name,/*!< in: file name where lock requested */
 	ulint		line)	/*!< in: line where requested */
 {
-	struct PSI_rwlock_locker*	locker = NULL;
+	struct PSI_rwlock_locker*	locker;
 	PSI_rwlock_locker_state		state;
 
 	/* Record the entry of rw x lock request in performance schema */
-	if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
-		locker = PSI_server->get_thread_rwlock_locker(
-			&state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
-
-		if (locker) {
-			PSI_server->start_rwlock_wrwait(locker,
-							file_name, line);
-		}
+	locker = PSI_CALL(get_thread_rwlock_locker)(
+		&state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
+
+	if (UNIV_LIKELY(locker != NULL)) {
+		PSI_CALL(start_rwlock_wrwait)(locker, file_name, line);
+		rw_lock_x_lock_func(lock, pass, file_name, line);
+		PSI_CALL(end_rwlock_wrwait)(locker, 0);
+		return;
 	}
 
 	rw_lock_x_lock_func(lock, pass, file_name, line);
-
-	if (locker) {
-		PSI_server->end_rwlock_wrwait(locker, 0);
-	}
 }
 /******************************************************************//**
 Performance schema instrumented wrap function for
@@ -710,27 +704,22 @@ pfs_rw_lock_x_lock_func_nowait(
 				requested */
 	ulint		line)	/*!< in: line where requested */
 {
-	struct PSI_rwlock_locker*	locker = NULL;
+	struct PSI_rwlock_locker*	locker;
 	PSI_rwlock_locker_state		state;
 	ibool	ret;
 
 	/* Record the entry of rw x lock request in performance schema */
-	if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
-		locker = PSI_server->get_thread_rwlock_locker(
-			&state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
-
-		if (locker) {
-			PSI_server->start_rwlock_wrwait(locker,
-							file_name, line);
-		}
-	}
+	locker = PSI_CALL(get_thread_rwlock_locker)(
+		&state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
 
-	ret = rw_lock_x_lock_func_nowait(lock, file_name, line);
-
-	if (locker) {
-		PSI_server->end_rwlock_wrwait(locker, 0);
+	if (UNIV_LIKELY(locker != NULL)) {
+		PSI_CALL(start_rwlock_wrwait)(locker, file_name, line);
+		ret = rw_lock_x_lock_func_nowait(lock, file_name, line);
+		PSI_CALL(end_rwlock_wrwait)(locker, 0);
+		return(ret);
 	}
 
+	ret = rw_lock_x_lock_func_nowait(lock, file_name, line);
 	return(ret);
 }
 /******************************************************************//**
@@ -743,10 +732,8 @@ pfs_rw_lock_free_func(
 /*==================*/
 	rw_lock_t*	lock)	/*!< in: pointer to rw-lock */
 {
-	if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
-		PSI_server->destroy_rwlock(lock->pfs_psi);
-		lock->pfs_psi = NULL;
-	}
+	PSI_CALL(destroy_rwlock)(lock->pfs_psi);
+	lock->pfs_psi = NULL;
 
 	rw_lock_free_func(lock);
 }
@@ -766,24 +753,20 @@ pfs_rw_lock_s_lock_func(
 				requested */
 	ulint		line)	/*!< in: line where requested */
 {
-	struct PSI_rwlock_locker*	locker = NULL;
+	struct PSI_rwlock_locker*	locker;
 	PSI_rwlock_locker_state		state;
 
 	/* Instrumented to inform we are aquiring a shared rwlock */
-	if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
-		locker = PSI_server->get_thread_rwlock_locker(
-			&state, lock->pfs_psi, PSI_RWLOCK_READLOCK);
-		if (locker) {
-			PSI_server->start_rwlock_rdwait(locker,
-							file_name, line);
-		}
+	locker = PSI_CALL(get_thread_rwlock_locker)(
+		&state, lock->pfs_psi, PSI_RWLOCK_READLOCK);
+	if (UNIV_LIKELY(locker != NULL)) {
+		PSI_CALL(start_rwlock_rdwait)(locker, file_name, line);
+		rw_lock_s_lock_func(lock, pass, file_name, line);
+		PSI_CALL(end_rwlock_rdwait)(locker, 0);
+		return;
 	}
 
 	rw_lock_s_lock_func(lock, pass, file_name, line);
-
-	if (locker) {
-		PSI_server->end_rwlock_rdwait(locker, 0);
-	}
 }
 /******************************************************************//**
 Performance schema instrumented wrap function for rw_lock_s_lock_func()
@@ -801,26 +784,21 @@ pfs_rw_lock_s_lock_low(
 	const char*	file_name, /*!< in: file name where lock requested */
 	ulint		line)	/*!< in: line where requested */
 {
-	struct PSI_rwlock_locker*	locker = NULL;
+	struct PSI_rwlock_locker*	locker;
 	PSI_rwlock_locker_state		state;
 	ibool	ret;
 
 	/* Instrumented to inform we are aquiring a shared rwlock */
-	if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
-		locker = PSI_server->get_thread_rwlock_locker(
-			&state, lock->pfs_psi, PSI_RWLOCK_READLOCK);
-		if (locker) {
-			PSI_server->start_rwlock_rdwait(locker,
-							file_name, line);
-		}
+	locker = PSI_CALL(get_thread_rwlock_locker)(
+		&state, lock->pfs_psi, PSI_RWLOCK_READLOCK);
+	if (UNIV_LIKELY(locker != NULL)) {
+		PSI_CALL(start_rwlock_rdwait)(locker, file_name, line);
+		ret = rw_lock_s_lock_low(lock, pass, file_name, line);
+		PSI_CALL(end_rwlock_rdwait)(locker, 0);
+		return(ret);
 	}
 
 	ret = rw_lock_s_lock_low(lock, pass, file_name, line);
-
-	if (locker) {
-		PSI_server->end_rwlock_rdwait(locker, 0);
-	}
-
 	return(ret);
 }
 
@@ -840,9 +818,7 @@ pfs_rw_lock_x_unlock_func(
 	rw_lock_t*	lock)	/*!< in/out: rw-lock */
 {
 	/* Inform performance schema we are unlocking the lock */
-	if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
-		PSI_server->unlock_rwlock(lock->pfs_psi);
-	}
+	PSI_CALL(unlock_rwlock)(lock->pfs_psi);
 
 	rw_lock_x_unlock_func(
 #ifdef UNIV_SYNC_DEBUG
@@ -867,9 +843,7 @@ pfs_rw_lock_s_unlock_func(
 	rw_lock_t*	lock)	/*!< in/out: rw-lock */
 {
 	/* Inform performance schema we are unlocking the lock */
-	if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
-		PSI_server->unlock_rwlock(lock->pfs_psi);
-	}
+	PSI_CALL(unlock_rwlock)(lock->pfs_psi);
 
 	rw_lock_s_unlock_func(
 #ifdef UNIV_SYNC_DEBUG

=== modified file 'storage/innobase/include/sync0sync.ic'
--- a/storage/innobase/include/sync0sync.ic	2011-06-03 05:59:24 +0000
+++ b/storage/innobase/include/sync0sync.ic	2011-07-01 08:46:20 +0000
@@ -236,23 +236,19 @@ pfs_mutex_enter_func(
 	const char*	file_name,	/*!< in: file name where locked */
 	ulint		line)		/*!< in: line where locked */
 {
-	struct PSI_mutex_locker*	locker = NULL;
+	struct PSI_mutex_locker*	locker;
 	PSI_mutex_locker_state		state;
-	int	result = 0;
 
-	if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) {
-		locker = PSI_server->get_thread_mutex_locker(
-				&state, mutex->pfs_psi, PSI_MUTEX_LOCK);
-		if (locker) {
-			PSI_server->start_mutex_wait(locker, file_name, line);
-		}
+	locker = PSI_CALL(get_thread_mutex_locker)(
+			&state, mutex->pfs_psi, PSI_MUTEX_LOCK);
+	if (locker) {
+		PSI_CALL(start_mutex_wait)(locker, file_name, line);
+		mutex_enter_func(mutex, file_name, line);
+		PSI_CALL(end_mutex_wait)(locker, 0);
+		return;
 	}
 
 	mutex_enter_func(mutex, file_name, line);
-
-	if (locker) {
-		PSI_server->end_mutex_wait(locker, result);
-	}
 }
 /********************************************************************//**
 NOTE! Please use the corresponding macro mutex_enter_nowait(), not directly
@@ -270,24 +266,19 @@ pfs_mutex_enter_nowait_func(
 	ulint		line)		/*!< in: line where requested */
 {
 	ulint	ret;
-	struct PSI_mutex_locker*	locker = NULL;
+	struct PSI_mutex_locker*	locker;
 	PSI_mutex_locker_state		state;
-	int	result = 0;
 
-	if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) {
-		locker = PSI_server->get_thread_mutex_locker(
-				&state, mutex->pfs_psi, PSI_MUTEX_LOCK);
-		if (locker) {
-			PSI_server->start_mutex_wait(locker, file_name, line);
-		}
+	locker = PSI_CALL(get_thread_mutex_locker)(
+			&state, mutex->pfs_psi, PSI_MUTEX_LOCK);
+	if (UNIV_LIKELY(locker != NULL)) {
+		PSI_CALL(start_mutex_wait)(locker, file_name, line);
+		ret = mutex_enter_nowait_func(mutex, file_name, line);
+		PSI_CALL(end_mutex_wait)(locker, 0);
+		return(ret);
 	}
 
 	ret = mutex_enter_nowait_func(mutex, file_name, line);
-
-	if (locker) {
-		PSI_server->end_mutex_wait(locker, result);
-	}
-
 	return(ret);
 }
 /******************************************************************//**
@@ -301,9 +292,7 @@ pfs_mutex_exit_func(
 /*================*/
 	mutex_t*	mutex)	/*!< in: pointer to mutex */
 {
-	if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) {
-		PSI_server->unlock_mutex(mutex->pfs_psi);
-	}
+	PSI_CALL(unlock_mutex)(mutex->pfs_psi);
 
 	mutex_exit_func(mutex);
 }
@@ -329,9 +318,7 @@ pfs_mutex_create_func(
 	const char*	cfile_name,	/*!< in: file name where created */
 	ulint		cline)		/*!< in: file line where created */
 {
-	mutex->pfs_psi = (PSI_server && PFS_IS_INSTRUMENTED(key))
-				? PSI_server->init_mutex(key, mutex)
-				: NULL;
+	mutex->pfs_psi = PSI_CALL(init_mutex)(key, mutex);
 
 	mutex_create_func(mutex,
 # ifdef UNIV_DEBUG
@@ -354,10 +341,8 @@ pfs_mutex_free_func(
 /*================*/
 	mutex_t*	mutex)	/*!< in: mutex */
 {
-	if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) {
-		PSI_server->destroy_mutex(mutex->pfs_psi);
-		mutex->pfs_psi = NULL;
-	}
+	PSI_CALL(destroy_mutex)(mutex->pfs_psi);
+	mutex->pfs_psi = NULL;
 
 	mutex_free_func(mutex);
 }

=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc	2011-06-30 15:50:45 +0000
+++ b/storage/perfschema/pfs.cc	2011-07-05 08:15:52 +0000
@@ -1352,6 +1352,10 @@ init_mutex_v1(PSI_mutex_key key, const v
 static void destroy_mutex_v1(PSI_mutex* mutex)
 {
   PFS_mutex *pfs= reinterpret_cast<PFS_mutex*> (mutex);
+
+  if (unlikely(pfs == NULL))
+    return;
+
   destroy_mutex(pfs);
 }
 
@@ -1372,6 +1376,10 @@ init_rwlock_v1(PSI_rwlock_key key, const
 static void destroy_rwlock_v1(PSI_rwlock* rwlock)
 {
   PFS_rwlock *pfs= reinterpret_cast<PFS_rwlock*> (rwlock);
+
+  if (unlikely(pfs == NULL))
+    return;
+
   destroy_rwlock(pfs);
 }
 
@@ -1392,6 +1400,10 @@ init_cond_v1(PSI_cond_key key, const voi
 static void destroy_cond_v1(PSI_cond* cond)
 {
   PFS_cond *pfs= reinterpret_cast<PFS_cond*> (cond);
+
+  if (unlikely(pfs == NULL))
+    return;
+
   destroy_cond(pfs);
 }
 
@@ -1417,9 +1429,11 @@ get_table_share_v1(my_bool temporary, TA
 */
 static void release_table_share_v1(PSI_table_share* share)
 {
-  DBUG_ASSERT(share != NULL);
-  PFS_table_share* pfs;
-  pfs= reinterpret_cast<PFS_table_share*> (share);
+  PFS_table_share* pfs= reinterpret_cast<PFS_table_share*> (share);
+
+  if (unlikely(pfs == NULL))
+    return;
+
   release_table_share(pfs);
 }
 
@@ -1447,7 +1461,10 @@ static PSI_table*
 open_table_v1(PSI_table_share *share, const void *identity)
 {
   PFS_table_share *pfs_table_share= reinterpret_cast<PFS_table_share*> (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;
@@ -1472,7 +1489,8 @@ open_table_v1(PSI_table_share *share, co
 static void close_table_v1(PSI_table *table)
 {
   PFS_table *pfs= reinterpret_cast<PFS_table*> (table);
-  DBUG_ASSERT(pfs);
+  if (unlikely(pfs == NULL))
+    return;
   pfs->aggregate();
   destroy_table(pfs);
 }
@@ -1632,8 +1650,9 @@ new_thread_v1(PSI_thread_key key, const 
 */
 static void set_thread_id_v1(PSI_thread *thread, unsigned long id)
 {
-  DBUG_ASSERT(thread);
   PFS_thread *pfs= reinterpret_cast<PFS_thread*> (thread);
+  if (unlikely(pfs == NULL))
+    return;
   pfs->m_thread_id= id;
 }
 
@@ -1890,7 +1909,10 @@ get_thread_mutex_locker_v1(PSI_mutex_loc
   DBUG_ASSERT((int) op >= 0);
   DBUG_ASSERT((uint) op < array_elements(mutex_operation_map));
   DBUG_ASSERT(state != NULL);
-  DBUG_ASSERT(pfs_mutex != NULL);
+
+  if (unlikely(pfs_mutex == NULL))
+    return NULL;
+
   DBUG_ASSERT(pfs_mutex->m_class != NULL);
 
   if (! flag_global_instrumentation)
@@ -1978,7 +2000,10 @@ get_thread_rwlock_locker_v1(PSI_rwlock_l
   DBUG_ASSERT(static_cast<int> (op) >= 0);
   DBUG_ASSERT(static_cast<uint> (op) < array_elements(rwlock_operation_map));
   DBUG_ASSERT(state != NULL);
-  DBUG_ASSERT(pfs_rwlock != NULL);
+
+  if (unlikely(pfs_rwlock == NULL))
+    return NULL;
+
   DBUG_ASSERT(pfs_rwlock->m_class != NULL);
 
   if (! flag_global_instrumentation)
@@ -2078,7 +2103,10 @@ get_thread_cond_locker_v1(PSI_cond_locke
   DBUG_ASSERT(static_cast<int> (op) >= 0);
   DBUG_ASSERT(static_cast<uint> (op) < array_elements(cond_operation_map));
   DBUG_ASSERT(state != NULL);
-  DBUG_ASSERT(pfs_cond != NULL);
+
+  if (unlikely(pfs_cond == NULL))
+    return NULL;
+
   DBUG_ASSERT(pfs_cond->m_class != NULL);
 
   if (! flag_global_instrumentation)
@@ -2213,7 +2241,10 @@ get_thread_table_io_locker_v1(PSI_table_
   DBUG_ASSERT(static_cast<uint> (op) < array_elements(table_io_operation_map));
   DBUG_ASSERT(state != NULL);
   PFS_table *pfs_table= reinterpret_cast<PFS_table*> (table);
-  DBUG_ASSERT(pfs_table != NULL);
+
+  if (unlikely(pfs_table == NULL))
+    return NULL;
+
   DBUG_ASSERT(pfs_table->m_share != NULL);
 
   if (! flag_global_instrumentation)
@@ -2300,7 +2331,10 @@ get_thread_table_lock_locker_v1(PSI_tabl
 {
   DBUG_ASSERT(state != NULL);
   PFS_table *pfs_table= reinterpret_cast<PFS_table*> (table);
-  DBUG_ASSERT(pfs_table != NULL);
+
+  if (unlikely(pfs_table == NULL))
+    return NULL;
+
   DBUG_ASSERT(pfs_table->m_share != NULL);
 
   DBUG_ASSERT((op == PSI_TABLE_LOCK) || (op == PSI_TABLE_EXTERNAL_LOCK));
@@ -2488,12 +2522,14 @@ get_thread_file_stream_locker_v1(PSI_fil
                                  PSI_file *file, PSI_file_operation op)
 {
   PFS_file *pfs_file= reinterpret_cast<PFS_file*> (file);
-  DBUG_ASSERT(pfs_file != NULL);
-  DBUG_ASSERT(pfs_file->m_class != NULL);
   DBUG_ASSERT(static_cast<int> (op) >= 0);
   DBUG_ASSERT(static_cast<uint> (op) < array_elements(file_operation_map));
   DBUG_ASSERT(state != NULL);
 
+  if (unlikely(pfs_file == NULL))
+    return NULL; 
+  DBUG_ASSERT(pfs_file->m_class != NULL);
+
   if (! flag_global_instrumentation)
     return NULL;
 
@@ -2677,7 +2713,9 @@ get_thread_file_descriptor_locker_v1(PSI
 static void unlock_mutex_v1(PSI_mutex *mutex)
 {
   PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex*> (mutex);
-  DBUG_ASSERT(pfs_mutex != NULL);
+
+  if (unlikely(pfs_mutex == NULL))
+    return;
 
   /*
     Note that this code is still protected by the instrumented mutex,
@@ -2720,6 +2758,10 @@ static void unlock_mutex_v1(PSI_mutex *m
 static void unlock_rwlock_v1(PSI_rwlock *rwlock)
 {
   PFS_rwlock *pfs_rwlock= reinterpret_cast<PFS_rwlock*> (rwlock);
+
+  if (unlikely(pfs_rwlock == NULL))
+    return;
+
   DBUG_ASSERT(pfs_rwlock != NULL);
   bool last_writer= false;
   bool last_reader= false;
@@ -2800,7 +2842,9 @@ static void unlock_rwlock_v1(PSI_rwlock 
 static void signal_cond_v1(PSI_cond* cond)
 {
   PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond);
-  DBUG_ASSERT(pfs_cond != NULL);
+
+  if (unlikely(pfs_cond == NULL))
+    return;
 
   pfs_cond->m_cond_stat.m_signal_count++;
 }
@@ -2812,7 +2856,9 @@ static void signal_cond_v1(PSI_cond* con
 static void broadcast_cond_v1(PSI_cond* cond)
 {
   PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond);
-  DBUG_ASSERT(pfs_cond != NULL);
+
+  if (unlikely(pfs_cond == NULL))
+    return;
 
   pfs_cond->m_cond_stat.m_broadcast_count++;
 }
@@ -3940,7 +3986,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<PSI_statement_locker_state*> (LOCKER);        \
-  DBUG_ASSERT(state != NULL);                                           \
+  if (unlikely(state == NULL))                                          \
+    return;                                                             \
   if (state->m_discarded)                                               \
     return;                                                             \
   state->ATTR= VALUE;                                                   \
@@ -3956,7 +4003,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<PSI_statement_locker_state*> (LOCKER);        \
-  DBUG_ASSERT(state != NULL);                                           \
+  if (unlikely(state == NULL))                                          \
+    return;                                                             \
   if (state->m_discarded)                                               \
     return;                                                             \
   state->ATTR+= VALUE;                                                  \

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (marc.alff:3243) Marc Alff5 Jul