3210 Christopher Powers 2010-12-07
WL#4896 Performance schema NET IO
Merge with mysql-trunk
added:
include/mysql/psi/mysql_socket.h
modified:
include/mysql/psi/psi.h
include/mysql/psi/psi_abi_v1.h.pp
include/mysql/psi/psi_abi_v2.h.pp
scripts/mysql_system_tables.sql
sql/mysqld.cc
sql/mysqld.h
storage/perfschema/CMakeLists.txt
storage/perfschema/ha_perfschema.cc
storage/perfschema/pfs.cc
storage/perfschema/pfs_column_types.h
storage/perfschema/pfs_column_values.cc
storage/perfschema/pfs_column_values.h
storage/perfschema/pfs_engine_table.cc
storage/perfschema/pfs_events_waits.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.h
storage/perfschema/pfs_stat.h
storage/perfschema/table_all_instr.cc
storage/perfschema/table_all_instr.h
storage/perfschema/table_events_waits.cc
storage/perfschema/table_events_waits_summary.cc
storage/perfschema/table_events_waits_summary.h
storage/perfschema/table_helper.h
storage/perfschema/table_setup_instruments.cc
vio/vio.c
vio/viosocket.c
3209 Christopher Powers 2010-12-07 [merge]
merge
removed:
BUILD/Makefile.am
Docs/Makefile.am
EXCEPTIONS-CLIENT
Makefile.am
client/Makefile.am
cmake/Makefile.am
cmd-line-utils/Makefile.am
cmd-line-utils/libedit/Makefile.am
cmd-line-utils/readline/Makefile.am
config/
config/ac-macros/
config/ac-macros/alloca.m4
config/ac-macros/character_sets.m4
config/ac-macros/check_cpu.m4
config/ac-macros/compiler_flag.m4
config/ac-macros/dtrace.m4
config/ac-macros/gtest.m4
config/ac-macros/large_file.m4
config/ac-macros/maintainer.m4
config/ac-macros/misc.m4
config/ac-macros/plugins.m4
config/ac-macros/readline.m4
config/ac-macros/ssl.m4
config/ac-macros/zlib.m4
configure.in
dbug/Makefile.am
extra/Makefile.am
extra/yassl/Makefile.am
extra/yassl/src/Makefile.am
extra/yassl/taocrypt/Makefile.am
extra/yassl/taocrypt/benchmark/Makefile.am
extra/yassl/taocrypt/src/Makefile.am
extra/yassl/taocrypt/test/Makefile.am
extra/yassl/testsuite/Makefile.am
include/Makefile.am
libmysql/Makefile.am
libmysql/Makefile.shared
libmysql/acinclude.m4
libmysql_r/
libmysql_r/Makefile.am
libmysqld/Makefile.am
libmysqld/examples/Makefile.am
libservices/Makefile.am
man/Makefile.am
mysql-test/Makefile.am
mysql-test/collections/mysql-next-mr-rpl-merge.push
mysql-test/collections/mysql-next-mr-wl4445.push
mysql-test/collections/mysql-next-mr.push
mysql-test/lib/My/SafeProcess/Makefile.am
mysql-test/suite/innodb/r/innodb_bug54679.result
mysql-test/suite/innodb/r/innodb_bug56632.result
mysql-test/suite/innodb/t/innodb_bug54679.test
mysql-test/suite/innodb/t/innodb_bug56632.test
mysql-test/suite/optimizer_unfixed_bugs/
mysql-test/suite/optimizer_unfixed_bugs/README.txt
mysql-test/suite/optimizer_unfixed_bugs/r/
mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result
mysql-test/suite/optimizer_unfixed_bugs/r/bug49129.result
mysql-test/suite/optimizer_unfixed_bugs/t/
mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test
mysql-test/suite/optimizer_unfixed_bugs/t/bug49129.test
mysql-test/suite/perfschema/r/ddl_threads.result
mysql-test/suite/perfschema/r/dml_threads.result
mysql-test/suite/perfschema/r/thread_cache.result
mysql-test/suite/perfschema/t/ddl_threads.test
mysql-test/suite/perfschema/t/dml_threads.test
mysql-test/suite/perfschema/t/thread_cache.test
mysql-test/t/flush_read_lock_kill-master.opt
mysql-test/t/join_optimizer.test
mysys/Makefile.am
packaging/Makefile.am
packaging/WiX/ca/CustomAction.rc
plugin/Makefile.am
plugin/audit_null/Makefile.am
plugin/audit_null/plug.in
plugin/auth/Makefile.am
plugin/auth/plug.in
plugin/daemon_example/Makefile.am
plugin/daemon_example/configure.in
plugin/daemon_example/plug.in
plugin/fulltext/Makefile.am
plugin/fulltext/configure.in
plugin/fulltext/plug.in
plugin/semisync/Makefile.am
plugin/semisync/configure.in
plugin/semisync/plug.in
regex/Makefile.am
scripts/Makefile.am
scripts/make_sharedlib_distribution.sh
sql-bench/Makefile.am
sql-common/Makefile.am
sql/Makefile.am
sql/share/Makefile.am
storage/Makefile.am
storage/archive/Makefile.am
storage/archive/plug.in
storage/blackhole/Makefile.am
storage/blackhole/plug.in
storage/csv/Makefile.am
storage/csv/plug.in
storage/example/Makefile.am
storage/example/plug.in
storage/federated/Makefile.am
storage/federated/plug.in
storage/heap/Makefile.am
storage/heap/plug.in
storage/innobase/Makefile.am
storage/innobase/plug.in
storage/myisam/Makefile.am
storage/myisam/plug.in
storage/myisammrg/Makefile.am
storage/myisammrg/plug.in
storage/perfschema/Makefile.am
storage/perfschema/plug.in
storage/perfschema/unittest/Makefile.am
strings/Makefile.am
strings/bfill.c
strings/bmove.c
strings/longlong2str-x86.s
strings/longlong2str_asm.c
strings/my_strtoll10-x86.s
strings/str_test.c
strings/strings-x86.s
strings/strstr.c
strings/strto.c
strings/strtol.c
strings/strtoll.c
strings/strtoul.c
strings/strtoull.c
support-files/MacOSX/Makefile.am
support-files/Makefile.am
support-files/RHEL4-SElinux/Makefile.am
support-files/SCO/
support-files/SCO/INSTALL.sh
support-files/SCO/compile.sh
support-files/SCO/doc.sh
support-files/SCO/mkpkg.sh
support-files/SCO/patch
support-files/SCO/pkginfo.ini
support-files/SCO/postinstall
support-files/SCO/preinstall
support-files/SCO/preremove
support-files/SCO/prototype.ini
support-files/SCO/version
tests/Makefile.am
unittest/Makefile.am
unittest/examples/Makefile.am
unittest/gunit/Makefile.am
unittest/mysys/Makefile.am
unittest/mytap/Makefile.am
unittest/mytap/t/Makefile.am
unittest/strings/Makefile.am
vio/Makefile.am
win/Makefile.am
win/README
win/configure.js
win/create_manifest.js
win/mysql_manifest.cmake
zlib/Makefile.am
added:
VERSION
mysql-test/collections/mysql-trunk-bugfixing.daily
mysql-test/collections/mysql-trunk-bugfixing.push
mysql-test/extra/rpl_tests/rpl_change_master_bind.inc
mysql-test/include/check_ftwrl_compatible.inc
mysql-test/include/check_ftwrl_incompatible.inc
mysql-test/include/ctype_8bit.inc
mysql-test/include/ctype_czech.inc
mysql-test/include/ctype_like_ignorable.inc
mysql-test/r/ctype_like_range.result
mysql-test/r/flush_read_lock.result
mysql-test/r/func_in_mrr_cost.result
mysql-test/r/innodb_mrr_cost.result
mysql-test/r/innodb_mrr_cost_all.result
mysql-test/r/innodb_mrr_cost_icp.result
mysql-test/r/myisam_mrr_cost.result
mysql-test/r/myisam_mrr_cost_all.result
mysql-test/r/myisam_mrr_cost_icp.result
mysql-test/r/mysqld--defaults-file.result
mysql-test/r/partition_binlog.result
mysql-test/r/range_mrr_cost.result
mysql-test/suite/binlog/r/binlog_variables_log_bin.result
mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result
mysql-test/suite/binlog/r/binlog_variables_relay_log.result
mysql-test/suite/binlog/r/binlog_variables_relay_log_index.result
mysql-test/suite/binlog/t/binlog_variables_log_bin-master.opt
mysql-test/suite/binlog/t/binlog_variables_log_bin.test
mysql-test/suite/binlog/t/binlog_variables_log_bin_index-master.opt
mysql-test/suite/binlog/t/binlog_variables_log_bin_index.test
mysql-test/suite/binlog/t/binlog_variables_relay_log-master.opt
mysql-test/suite/binlog/t/binlog_variables_relay_log.test
mysql-test/suite/binlog/t/binlog_variables_relay_log_index-master.opt
mysql-test/suite/binlog/t/binlog_variables_relay_log_index.test
mysql-test/suite/federated/federated_bug_35333.result
mysql-test/suite/federated/federated_bug_35333.test
mysql-test/suite/innodb/r/innodb-create-options.result
mysql-test/suite/innodb/r/innodb_bug53046.result
mysql-test/suite/innodb/r/innodb_bug57904.result
mysql-test/suite/innodb/t/innodb-create-options.test
mysql-test/suite/innodb/t/innodb_bug53046.test
mysql-test/suite/innodb/t/innodb_bug57904.test
mysql-test/suite/perfschema/r/dml_threads.result
mysql-test/suite/perfschema/r/thread_cache.result
mysql-test/suite/perfschema/t/dml_threads.test
mysql-test/suite/perfschema/t/thread_cache-master.opt
mysql-test/suite/perfschema/t/thread_cache.test
mysql-test/suite/rpl/r/rpl_slave_start.result
mysql-test/suite/rpl/t/rpl_slave_start.test
mysql-test/t/ctype_like_range.test
mysql-test/t/flush_read_lock.test
mysql-test/t/func_in_mrr_cost.test
mysql-test/t/innodb_mrr_cost-master.opt
mysql-test/t/innodb_mrr_cost.test
mysql-test/t/innodb_mrr_cost_all-master.opt
mysql-test/t/innodb_mrr_cost_all.test
mysql-test/t/innodb_mrr_cost_icp-master.opt
mysql-test/t/innodb_mrr_cost_icp.test
mysql-test/t/myisam_mrr_cost.test
mysql-test/t/myisam_mrr_cost_all.test
mysql-test/t/myisam_mrr_cost_icp.test
mysql-test/t/mysqld--defaults-file.test
mysql-test/t/partition_binlog.test
mysql-test/t/range_mrr_cost.test
mysql-test/t/wl4435_generated.inc
storage/innobase/include/ut0bh.h
storage/innobase/lock/lock0wait.c
storage/innobase/ut/ut0bh.c
storage/perfschema/unittest/stub_server_misc.h.moved
modified:
BUILD/FINISH.sh
BUILD/autorun.sh
BUILD/build_mccge.sh
BUILD/cmake_configure.sh
BUILD/compile-amd64-valgrind-max
BUILD/compile-pentium-valgrind-max
BUILD/compile-pentium-valgrind-max-no-ndb
BUILD/compile-pentium64-valgrind-max
CMakeLists.txt
README
client/client_priv.h
client/mysql.cc
client/mysqlbinlog.cc
client/mysqlcheck.c
client/mysqltest.cc
cmake/build_configurations/mysql_release.cmake
cmake/configure.pl
cmake/do_abi_check.cmake
cmake/dtrace.cmake
cmake/install_macros.cmake
cmake/make_dist.cmake.in
cmake/mysql_version.cmake
cmake/os/Windows.cmake
cmake/os/WindowsCache.cmake
cmake/plugin.cmake
cmake/versioninfo.rc.in
cmd-line-utils/libedit/CMakeLists.txt
cmd-line-utils/readline/bind.c
config.h.cmake
extra/comp_err.c
extra/resolve_stack_dump.c
include/atomic/x86-gcc.h
include/base64.h
include/m_ctype.h
include/m_string.h
include/my_compiler.h
include/my_global.h
include/my_stacktrace.h
include/my_sys.h
include/mysql.h
include/mysql_com.h
libmysql/CMakeLists.txt
libmysql/conf_to_src.c
libmysql/errmsg.c
libmysql/get_password.c
libmysql/libmysql.c
libmysqld/CMakeLists.txt
libservices/CMakeLists.txt
man/CMakeLists.txt
mysql-test/CMakeLists.txt
mysql-test/collections/default.experimental
mysql-test/collections/default.weekly
mysql-test/collections/test-bt
mysql-test/collections/test-bt-debug
mysql-test/collections/test-bt-fast
mysql-test/extra/binlog_tests/binlog.test
mysql-test/extra/binlog_tests/binlog_insert_delayed.test
mysql-test/extra/binlog_tests/binlog_truncate.test
mysql-test/extra/binlog_tests/blackhole.test
mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
mysql-test/extra/rpl_tests/create_recursive_construct.inc
mysql-test/extra/rpl_tests/rpl_change_master.test
mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.inc
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test
mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test
mysql-test/extra/rpl_tests/rpl_insert_delayed.test
mysql-test/extra/rpl_tests/rpl_insert_id_pk.test
mysql-test/extra/rpl_tests/rpl_not_null.test
mysql-test/extra/rpl_tests/rpl_row_empty_imgs.test
mysql-test/extra/rpl_tests/rpl_row_img.test
mysql-test/extra/rpl_tests/rpl_row_img_blobs.test
mysql-test/extra/rpl_tests/rpl_row_img_diff_indexes.test
mysql-test/extra/rpl_tests/rpl_stop_slave.test
mysql-test/include/check_ipv6.inc
mysql-test/include/check_slave_is_running.inc
mysql-test/include/check_slave_param.inc
mysql-test/include/ctype_numconv.inc
mysql-test/include/diff_tables.inc
mysql-test/include/handler.inc
mysql-test/include/have_example_plugin.inc
mysql-test/include/have_semisync_plugin.inc
mysql-test/include/have_simple_parser.inc
mysql-test/include/have_udf.inc
mysql-test/include/icp_tests.inc
mysql-test/include/mtr_warnings.sql
mysql-test/include/mysql_upgrade_preparation.inc
mysql-test/include/no_valgrind_without_big.inc
mysql-test/include/not_parallel.inc
mysql-test/include/restart_mysqld.inc
mysql-test/include/rpl_assert.inc
mysql-test/include/rpl_chained_3_hosts.inc
mysql-test/include/rpl_diff_tables.inc
mysql-test/include/rpl_row_img_set.inc
mysql-test/include/setup_fake_relay_log.inc
mysql-test/include/show_rpl_debug_info.inc
mysql-test/include/show_slave_status.inc
mysql-test/include/subquery_mat.inc
mysql-test/include/subquery_sj.inc
mysql-test/include/truncate_file.inc
mysql-test/include/wait_for_binlog_event.inc
mysql-test/include/wait_for_slave_io_to_stop.inc
mysql-test/include/wait_for_slave_sql_to_stop.inc
mysql-test/include/wait_for_slave_to_stop.inc
mysql-test/include/wait_show_condition.inc
mysql-test/lib/mtr_cases.pm
mysql-test/mysql-test-run.pl
mysql-test/r/archive_gis.result
mysql-test/r/compress.result
mysql-test/r/create.result
mysql-test/r/ctype_binary.result
mysql-test/r/ctype_collate.result
mysql-test/r/ctype_cp1251.result
mysql-test/r/ctype_latin1.result
mysql-test/r/ctype_uca.result
mysql-test/r/ctype_ucs.result
mysql-test/r/ctype_utf16.result
mysql-test/r/ctype_utf16_uca.result
mysql-test/r/ctype_utf32_uca.result
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8mb4.result
mysql-test/r/ctype_utf8mb4_heap.result
mysql-test/r/ctype_utf8mb4_innodb.result
mysql-test/r/ctype_utf8mb4_myisam.result
mysql-test/r/ctype_utf8mb4_uca.result
mysql-test/r/delayed.result
mysql-test/r/derived.result
mysql-test/r/distinct.result
mysql-test/r/error_simulation.result
mysql-test/r/events_2.result
mysql-test/r/explain.result
mysql-test/r/flush.result
mysql-test/r/flush2.result
mysql-test/r/flush_read_lock_kill.result
mysql-test/r/fulltext.result
mysql-test/r/func_gconcat.result
mysql-test/r/func_group.result
mysql-test/r/func_group_innodb.result
mysql-test/r/func_in_all.result
mysql-test/r/func_in_icp_mrr.result
mysql-test/r/func_in_mrr.result
mysql-test/r/func_math.result
mysql-test/r/func_misc.result
mysql-test/r/func_str.result
mysql-test/r/func_time.result
mysql-test/r/gis.result
mysql-test/r/greedy_optimizer.result
mysql-test/r/group_by.result
mysql-test/r/group_min_max.result
mysql-test/r/handler_innodb.result
mysql-test/r/handler_myisam.result
mysql-test/r/index_merge_innodb.result
mysql-test/r/index_merge_myisam.result
mysql-test/r/information_schema-big.result
mysql-test/r/information_schema.result
mysql-test/r/innodb_icp.result
mysql-test/r/innodb_icp_all.result
mysql-test/r/innodb_icp_none.result
mysql-test/r/innodb_mrr.result
mysql-test/r/innodb_mrr_all.result
mysql-test/r/innodb_mrr_icp.result
mysql-test/r/innodb_mrr_none.result
mysql-test/r/join.result
mysql-test/r/join_cache_jcl1.result
mysql-test/r/join_cache_jcl2.result
mysql-test/r/join_cache_jcl3.result
mysql-test/r/join_cache_jcl4.result
mysql-test/r/join_cache_jcl5.result
mysql-test/r/join_cache_jcl6.result
mysql-test/r/join_cache_jcl7.result
mysql-test/r/join_cache_jcl8.result
mysql-test/r/join_nested.result
mysql-test/r/join_nested_jcl6.result
mysql-test/r/join_optimizer.result
mysql-test/r/join_outer.result
mysql-test/r/join_outer_jcl6.result
mysql-test/r/key_diff.result
mysql-test/r/kill.result
mysql-test/r/lock_multi.result
mysql-test/r/mdl_sync.result
mysql-test/r/merge.result
mysql-test/r/mix2_myisam.result
mysql-test/r/myisam.result
mysql-test/r/myisam_icp.result
mysql-test/r/myisam_icp_all.result
mysql-test/r/myisam_icp_none.result
mysql-test/r/myisam_mrr.result
mysql-test/r/myisam_mrr_all.result
mysql-test/r/myisam_mrr_icp.result
mysql-test/r/myisam_mrr_none.result
mysql-test/r/mysql.result
mysql-test/r/mysqld--help-notwin.result
mysql-test/r/mysqld--help-win.result
mysql-test/r/mysqltest.result
mysql-test/r/named_pipe.result
mysql-test/r/not_embedded_server.result
mysql-test/r/null.result
mysql-test/r/optimizer_switch.result
mysql-test/r/order_by_all.result
mysql-test/r/order_by_icp_mrr.result
mysql-test/r/order_by_none.result
mysql-test/r/partition.result
mysql-test/r/partition_debug_sync.result
mysql-test/r/partition_exchange.result
mysql-test/r/partition_innodb.result
mysql-test/r/plugin_auth.result
mysql-test/r/plugin_not_embedded.result
mysql-test/r/ps.result
mysql-test/r/ps_1general.result
mysql-test/r/range_all.result
mysql-test/r/range_icp.result
mysql-test/r/range_icp_mrr.result
mysql-test/r/range_mrr.result
mysql-test/r/range_none.result
mysql-test/r/row.result
mysql-test/r/select_all.result
mysql-test/r/select_all_jcl6.result
mysql-test/r/select_icp_mrr.result
mysql-test/r/select_icp_mrr_jcl6.result
mysql-test/r/select_none.result
mysql-test/r/select_none_jcl6.result
mysql-test/r/shm.result
mysql-test/r/show_check.result
mysql-test/r/sp-lock.result
mysql-test/r/ssl.result
mysql-test/r/ssl_compress.result
mysql-test/r/subquery_all.result
mysql-test/r/subquery_all_jcl6.result
mysql-test/r/subquery_mat.result
mysql-test/r/subquery_mat_all.result
mysql-test/r/subquery_mat_none.result
mysql-test/r/subquery_nomat_nosj.result
mysql-test/r/subquery_nomat_nosj_jcl6.result
mysql-test/r/subquery_none.result
mysql-test/r/subquery_none_jcl6.result
mysql-test/r/subquery_sj_all.result
mysql-test/r/subquery_sj_all_jcl6.result
mysql-test/r/subquery_sj_all_jcl7.result
mysql-test/r/subquery_sj_dupsweed.result
mysql-test/r/subquery_sj_dupsweed_jcl6.result
mysql-test/r/subquery_sj_dupsweed_jcl7.result
mysql-test/r/subquery_sj_firstmatch.result
mysql-test/r/subquery_sj_firstmatch_jcl6.result
mysql-test/r/subquery_sj_firstmatch_jcl7.result
mysql-test/r/subquery_sj_innodb_all.result
mysql-test/r/subquery_sj_innodb_all_jcl6.result
mysql-test/r/subquery_sj_innodb_all_jcl7.result
mysql-test/r/subquery_sj_innodb_none.result
mysql-test/r/subquery_sj_innodb_none_jcl6.result
mysql-test/r/subquery_sj_innodb_none_jcl7.result
mysql-test/r/subquery_sj_loosescan.result
mysql-test/r/subquery_sj_loosescan_jcl6.result
mysql-test/r/subquery_sj_loosescan_jcl7.result
mysql-test/r/subquery_sj_mat.result
mysql-test/r/subquery_sj_mat_jcl6.result
mysql-test/r/subquery_sj_mat_jcl7.result
mysql-test/r/subquery_sj_mat_nosj.result
mysql-test/r/subquery_sj_none.result
mysql-test/r/subquery_sj_none_jcl6.result
mysql-test/r/subquery_sj_none_jcl7.result
mysql-test/r/union.result
mysql-test/r/user_var.result
mysql-test/r/variables-big.result
mysql-test/r/variables-notembedded.result
mysql-test/r/variables.result
mysql-test/r/view.result
mysql-test/r/xml.result
mysql-test/suite/binlog/r/binlog_base64_flag.result
mysql-test/suite/binlog/r/binlog_row_binlog.result
mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result
mysql-test/suite/binlog/r/binlog_stm_binlog.result
mysql-test/suite/binlog/t/binlog_base64_flag.test
mysql-test/suite/binlog/t/binlog_max_extension.test
mysql-test/suite/binlog/t/binlog_row_mysqlbinlog_db_filter.test
mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
mysql-test/suite/binlog/t/binlog_unsafe.test
mysql-test/suite/binlog/t/disabled.def
mysql-test/suite/federated/federated_bug_25714.test
mysql-test/suite/funcs_1/views/views_master.inc
mysql-test/suite/innodb/r/innodb-zip.result
mysql-test/suite/innodb/r/innodb.result
mysql-test/suite/innodb/r/innodb_gis.result
mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result
mysql-test/suite/innodb/r/innodb_mysql.result
mysql-test/suite/innodb/t/disabled.def
mysql-test/suite/innodb/t/innodb-zip.test
mysql-test/suite/innodb/t/innodb_mysql.test
mysql-test/suite/parts/inc/part_exch_qa_1.inc
mysql-test/suite/parts/inc/part_exch_qa_13.inc
mysql-test/suite/parts/inc/partition_auto_increment.inc
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result
mysql-test/suite/parts/r/partition_auto_increment_innodb.result
mysql-test/suite/parts/r/partition_auto_increment_memory.result
mysql-test/suite/parts/r/partition_auto_increment_myisam.result
mysql-test/suite/parts/r/partition_exch_qa_12.result*
mysql-test/suite/parts/r/partition_exch_qa_13.result
mysql-test/suite/parts/r/partition_exch_qa_1_innodb.result*
mysql-test/suite/parts/r/partition_exch_qa_1_myisam.result*
mysql-test/suite/parts/t/partition_exch_qa_12.test
mysql-test/suite/perfschema/include/privilege.inc
mysql-test/suite/perfschema/r/dml_cond_instances.result
mysql-test/suite/perfschema/r/dml_ews_by_instance.result
mysql-test/suite/perfschema/r/dml_ews_by_thread_by_event_name.result
mysql-test/suite/perfschema/r/dml_ews_global_by_event_name.result
mysql-test/suite/perfschema/r/dml_file_instances.result
mysql-test/suite/perfschema/r/dml_file_summary_by_event_name.result
mysql-test/suite/perfschema/r/dml_file_summary_by_instance.result
mysql-test/suite/perfschema/r/dml_mutex_instances.result
mysql-test/suite/perfschema/r/dml_rwlock_instances.result
mysql-test/suite/perfschema/r/dml_setup_instruments.result
mysql-test/suite/perfschema/r/func_mutex.result
mysql-test/suite/perfschema/r/global_read_lock.result
mysql-test/suite/perfschema/r/misc.result
mysql-test/suite/perfschema/r/myisam_file_io.result
mysql-test/suite/perfschema/r/privilege.result
mysql-test/suite/perfschema/r/server_init.result
mysql-test/suite/perfschema/t/dml_cond_instances.test
mysql-test/suite/perfschema/t/dml_ews_by_instance.test
mysql-test/suite/perfschema/t/dml_ews_by_thread_by_event_name.test
mysql-test/suite/perfschema/t/dml_ews_global_by_event_name.test
mysql-test/suite/perfschema/t/dml_file_instances.test
mysql-test/suite/perfschema/t/dml_file_summary_by_event_name.test
mysql-test/suite/perfschema/t/dml_file_summary_by_instance.test
mysql-test/suite/perfschema/t/dml_mutex_instances.test
mysql-test/suite/perfschema/t/dml_rwlock_instances.test
mysql-test/suite/perfschema/t/func_file_io.test
mysql-test/suite/perfschema/t/func_mutex.test
mysql-test/suite/perfschema/t/global_read_lock.test
mysql-test/suite/perfschema/t/misc.test
mysql-test/suite/perfschema/t/myisam_file_io.test
mysql-test/suite/perfschema/t/server_init.test
mysql-test/suite/perfschema/t/setup_actors.test
mysql-test/suite/perfschema/t/threads_mysql.test
mysql-test/suite/perfschema_stress/t/modify.test
mysql-test/suite/perfschema_stress/t/setup.test
mysql-test/suite/perfschema_stress/t/work.test
mysql-test/suite/rpl/r/rpl_change_master.result
mysql-test/suite/rpl/r/rpl_change_master_crash_safe.result
mysql-test/suite/rpl/r/rpl_flushlog_loop.result
mysql-test/suite/rpl/r/rpl_slave_status.result
mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result
mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result
mysql-test/suite/rpl/r/rpl_variables.result
mysql-test/suite/rpl/t/disabled.def
mysql-test/suite/rpl/t/rpl_checksum.test
mysql-test/suite/rpl/t/rpl_concurrency_error.test
mysql-test/suite/rpl/t/rpl_delayed_slave.test
mysql-test/suite/rpl/t/rpl_heartbeat.test
mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
mysql-test/suite/rpl/t/rpl_migration_crash_safe.test
mysql-test/suite/rpl/t/rpl_mysql_upgrade.test
mysql-test/suite/rpl/t/rpl_packet.test
mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test
mysql-test/suite/rpl/t/rpl_seconds_behind_master.test
mysql-test/suite/rpl/t/rpl_semi_sync.test
mysql-test/suite/rpl/t/rpl_semi_sync_event.test
mysql-test/suite/rpl/t/rpl_server_uuid.test
mysql-test/suite/rpl/t/rpl_slave_status.test
mysql-test/suite/rpl/t/rpl_slow_query_log.test
mysql-test/suite/rpl/t/rpl_ssl.test
mysql-test/suite/rpl/t/rpl_sync.test
mysql-test/suite/rpl/t/rpl_trigger.test
mysql-test/suite/rpl/t/rpl_variables.test
mysql-test/suite/sys_vars/r/all_vars.result
mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result
mysql-test/suite/sys_vars/r/optimizer_join_cache_level_basic.result
mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
mysql-test/suite/sys_vars/r/shared_memory_base_name_basic.result
mysql-test/suite/sys_vars/t/shared_memory_base_name_basic.test
mysql-test/suite/sys_vars/t/slow_launch_time_func.test
mysql-test/t/change_user.test
mysql-test/t/ctype_cp1251.test
mysql-test/t/ctype_uca.test
mysql-test/t/ctype_utf16_uca.test
mysql-test/t/ctype_utf32_uca.test
mysql-test/t/ctype_utf8.test
mysql-test/t/ctype_utf8mb4_uca.test
mysql-test/t/delayed.test
mysql-test/t/disabled.def
mysql-test/t/events_2.test
mysql-test/t/execution_constants.test
mysql-test/t/explain.test
mysql-test/t/fix_priv_tables.test
mysql-test/t/flush.test
mysql-test/t/flush2.test
mysql-test/t/flush_block_commit.test
mysql-test/t/flush_block_commit_notembedded.test
mysql-test/t/flush_read_lock_kill.test
mysql-test/t/fulltext.test
mysql-test/t/func_gconcat.test
mysql-test/t/func_group.test
mysql-test/t/func_in_all.test
mysql-test/t/func_in_icp_mrr.test
mysql-test/t/func_in_mrr.test
mysql-test/t/func_math.test
mysql-test/t/func_misc.test
mysql-test/t/func_op.test
mysql-test/t/func_str.test
mysql-test/t/func_time.test
mysql-test/t/group_by.test
mysql-test/t/innodb_mrr.test
mysql-test/t/innodb_mrr_all.test
mysql-test/t/innodb_mrr_icp.test
mysql-test/t/join.test
mysql-test/t/join_cache_jcl1.test
mysql-test/t/join_cache_jcl2.test
mysql-test/t/join_cache_jcl3.test
mysql-test/t/join_cache_jcl4.test
mysql-test/t/join_cache_jcl5.test
mysql-test/t/join_cache_jcl6.test
mysql-test/t/join_cache_jcl7.test
mysql-test/t/join_cache_jcl8.test
mysql-test/t/join_nested.test
mysql-test/t/join_nested_jcl6.test
mysql-test/t/join_outer.test
mysql-test/t/join_outer_jcl6.test
mysql-test/t/kill.test
mysql-test/t/lock_multi.test
mysql-test/t/mdl_sync.test
mysql-test/t/myisam_mrr.test
mysql-test/t/myisam_mrr_all.test
mysql-test/t/myisam_mrr_icp.test
mysql-test/t/mysql.test
mysql-test/t/mysqltest.test
mysql-test/t/named_pipe.test
mysql-test/t/not_embedded_server.test
mysql-test/t/order_by_all.test
mysql-test/t/order_by_icp_mrr.test
mysql-test/t/partition.test
mysql-test/t/partition_debug_sync.test
mysql-test/t/partition_exchange.test
mysql-test/t/partition_innodb.test
mysql-test/t/plugin_auth.test
mysql-test/t/plugin_not_embedded.test
mysql-test/t/ps.test
mysql-test/t/range_all.test
mysql-test/t/range_icp_mrr.test
mysql-test/t/range_mrr.test
mysql-test/t/select_all.test
mysql-test/t/select_all_jcl6.test
mysql-test/t/select_icp_mrr.test
mysql-test/t/select_icp_mrr_jcl6.test
mysql-test/t/select_none_jcl6.test
mysql-test/t/server_uuid.test
mysql-test/t/server_uuid_embedded.test
mysql-test/t/shm.test
mysql-test/t/show_check.test
mysql-test/t/sp-lock.test
mysql-test/t/subquery_all.test
mysql-test/t/subquery_all_jcl6.test
mysql-test/t/subquery_nomat_nosj.test
mysql-test/t/subquery_nomat_nosj_jcl6.test
mysql-test/t/subquery_none_jcl6.test
mysql-test/t/subquery_sj_all.test
mysql-test/t/subquery_sj_all_jcl6.test
mysql-test/t/subquery_sj_all_jcl7.test
mysql-test/t/subquery_sj_dupsweed_jcl6.test
mysql-test/t/subquery_sj_dupsweed_jcl7.test
mysql-test/t/subquery_sj_firstmatch_jcl6.test
mysql-test/t/subquery_sj_firstmatch_jcl7.test
mysql-test/t/subquery_sj_innodb_all.test
mysql-test/t/subquery_sj_innodb_all_jcl6.test
mysql-test/t/subquery_sj_innodb_all_jcl7.test
mysql-test/t/subquery_sj_innodb_none_jcl6.test
mysql-test/t/subquery_sj_innodb_none_jcl7.test
mysql-test/t/subquery_sj_loosescan_jcl6.test
mysql-test/t/subquery_sj_loosescan_jcl7.test
mysql-test/t/subquery_sj_mat_jcl6.test
mysql-test/t/subquery_sj_mat_jcl7.test
mysql-test/t/subquery_sj_none_jcl6.test
mysql-test/t/subquery_sj_none_jcl7.test
mysql-test/t/system_mysql_db_fix40123.test
mysql-test/t/system_mysql_db_fix50030.test
mysql-test/t/system_mysql_db_fix50117.test
mysql-test/t/trigger_notembedded.test
mysql-test/t/union.test
mysql-test/t/user_var.test
mysql-test/t/variables-big.test
mysql-test/t/variables-notembedded.test
mysql-test/t/variables.test
mysql-test/t/view.test
mysql-test/t/xml.test
mysql-test/valgrind.supp
mysys/array.c
mysys/base64.c
mysys/default.c
mysys/mf_format.c
mysys/mf_iocache.c
mysys/mf_keycache.c
mysys/mf_tempdir.c
mysys/my_rdtsc.c
mysys/my_symlink.c
mysys/stacktrace.c
packaging/WiX/ca/CMakeLists.txt
packaging/WiX/create_msi.cmake.in
packaging/WiX/mysql_server.wxs.in
plugin/semisync/semisync_slave_plugin.cc
regex/regexec.c
scripts/CMakeLists.txt
scripts/make_binary_distribution.sh
scripts/make_win_bin_dist
scripts/mysql_system_tables_fix.sql
sql-bench/CMakeLists.txt
sql-common/client.c
sql-common/client_plugin.c
sql/CMakeLists.txt
sql/binlog.cc
sql/binlog.h
sql/debug_sync.cc
sql/event_data_objects.cc
sql/event_data_objects.h
sql/event_db_repository.cc
sql/event_db_repository.h
sql/event_queue.cc
sql/events.cc
sql/events.h
sql/field.cc
sql/field.h
sql/field_conv.cc
sql/ha_ndbcluster.cc
sql/ha_partition.cc
sql/ha_partition.h
sql/handler.cc
sql/handler.h
sql/item.cc
sql/item.h
sql/item_cmpfunc.cc
sql/item_create.cc
sql/item_func.cc
sql/item_func.h
sql/item_strfunc.cc
sql/item_strfunc.h
sql/item_subselect.cc
sql/item_sum.cc
sql/item_timefunc.cc
sql/item_timefunc.h
sql/lex.h
sql/lock.cc
sql/lock.h
sql/log.cc
sql/log.h
sql/log_event.cc
sql/log_event.h
sql/mdl.cc
sql/mdl.h
sql/mysqld.cc
sql/mysqld.h
sql/opt_range.cc
sql/opt_range.h
sql/partition_info.cc
sql/protocol.cc
sql/records.cc
sql/rpl_filter.cc
sql/rpl_handler.cc
sql/rpl_handler.h
sql/rpl_info_table.cc
sql/rpl_mi.cc
sql/rpl_mi.h
sql/rpl_rli.cc
sql/rpl_slave.cc
sql/rpl_slave.h
sql/set_var.h
sql/share/charsets/cp1251.xml
sql/sp.cc
sql/sp.h
sql/sp_head.cc
sql/sp_head.h
sql/sp_pcontext.cc
sql/sp_pcontext.h
sql/sp_rcontext.h
sql/sql_acl.cc
sql/sql_admin.cc
sql/sql_array.h
sql/sql_audit.cc
sql/sql_audit.h
sql/sql_base.cc
sql/sql_base.h
sql/sql_binlog.cc
sql/sql_cache.cc
sql/sql_cache.h
sql/sql_class.cc
sql/sql_class.h
sql/sql_cursor.cc
sql/sql_db.cc
sql/sql_error.cc
sql/sql_error.h
sql/sql_handler.cc
sql/sql_handler.h
sql/sql_insert.cc
sql/sql_lex.cc
sql/sql_lex.h
sql/sql_parse.cc
sql/sql_partition.cc
sql/sql_partition_admin.cc
sql/sql_plugin.cc
sql/sql_plugin.h
sql/sql_prepare.cc
sql/sql_priv.h
sql/sql_rename.cc
sql/sql_select.cc
sql/sql_select.h
sql/sql_show.cc
sql/sql_table.cc
sql/sql_table.h
sql/sql_test.cc
sql/sql_trigger.cc
sql/sql_trigger.h
sql/sql_udf.cc
sql/sql_update.cc
sql/sql_view.cc
sql/sql_yacc.yy
sql/sys_vars.cc
sql/table.cc
sql/table.h
sql/transaction.cc
sql/uniques.cc
storage/federated/ha_federated.cc
storage/innobase/CMakeLists.txt
storage/innobase/btr/btr0cur.c
storage/innobase/buf/buf0buddy.c
storage/innobase/buf/buf0buf.c
storage/innobase/buf/buf0lru.c
storage/innobase/dict/dict0crea.c
storage/innobase/dict/dict0dict.c
storage/innobase/dict/dict0load.c
storage/innobase/dict/dict0stats.c
storage/innobase/fil/fil0fil.c
storage/innobase/fsp/fsp0fsp.c
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/handler0alter.cc
storage/innobase/ibuf/ibuf0ibuf.c
storage/innobase/include/btr0btr.h
storage/innobase/include/btr0btr.ic
storage/innobase/include/btr0cur.h
storage/innobase/include/buf0buf.h
storage/innobase/include/db0err.h
storage/innobase/include/dict0dict.h
storage/innobase/include/dict0mem.h
storage/innobase/include/dict0stats.h
storage/innobase/include/fil0fil.h
storage/innobase/include/lock0lock.h
storage/innobase/include/lock0lock.ic
storage/innobase/include/lock0priv.h
storage/innobase/include/lock0priv.ic
storage/innobase/include/os0sync.h
storage/innobase/include/os0sync.ic
storage/innobase/include/que0que.h
storage/innobase/include/que0que.ic
storage/innobase/include/read0read.h
storage/innobase/include/read0read.ic
storage/innobase/include/row0ins.h
storage/innobase/include/row0mysql.h
storage/innobase/include/row0purge.h
storage/innobase/include/row0row.h
storage/innobase/include/row0upd.h
storage/innobase/include/row0vers.h
storage/innobase/include/srv0srv.h
storage/innobase/include/sync0sync.h
storage/innobase/include/sync0sync.ic
storage/innobase/include/trx0purge.h
storage/innobase/include/trx0purge.ic
storage/innobase/include/trx0rec.h
storage/innobase/include/trx0roll.h
storage/innobase/include/trx0rseg.h
storage/innobase/include/trx0rseg.ic
storage/innobase/include/trx0sys.h
storage/innobase/include/trx0sys.ic
storage/innobase/include/trx0trx.h
storage/innobase/include/trx0trx.ic
storage/innobase/include/trx0types.h
storage/innobase/include/trx0undo.h
storage/innobase/include/univ.i
storage/innobase/include/usr0sess.h
storage/innobase/include/ut0rnd.ic
storage/innobase/lock/lock0iter.c
storage/innobase/lock/lock0lock.c
storage/innobase/log/log0log.c
storage/innobase/pars/pars0pars.c
storage/innobase/que/que0que.c
storage/innobase/read/read0read.c
storage/innobase/row/row0ins.c
storage/innobase/row/row0merge.c
storage/innobase/row/row0mysql.c
storage/innobase/row/row0purge.c
storage/innobase/row/row0sel.c
storage/innobase/row/row0umod.c
storage/innobase/row/row0undo.c
storage/innobase/row/row0upd.c
storage/innobase/row/row0vers.c
storage/innobase/srv/srv0mon.c
storage/innobase/srv/srv0srv.c
storage/innobase/srv/srv0start.c
storage/innobase/sync/sync0arr.c
storage/innobase/sync/sync0rw.c
storage/innobase/sync/sync0sync.c
storage/innobase/thr/thr0loc.c
storage/innobase/trx/trx0i_s.c
storage/innobase/trx/trx0purge.c
storage/innobase/trx/trx0rec.c
storage/innobase/trx/trx0roll.c
storage/innobase/trx/trx0rseg.c
storage/innobase/trx/trx0sys.c
storage/innobase/trx/trx0trx.c
storage/innobase/trx/trx0undo.c
storage/innobase/usr/usr0sess.c
storage/innobase/ut/ut0ut.c
storage/myisam/ft_nlq_search.c
storage/myisam/ha_myisam.cc
storage/myisammrg/myrg_open.c
storage/perfschema/ha_perfschema.cc
storage/perfschema/ha_perfschema.h
storage/perfschema/pfs_engine_table.cc
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_lock.h
storage/perfschema/table_events_waits.cc
storage/perfschema/table_os_global_by_type.cc
storage/perfschema/table_setup_actors.cc
storage/perfschema/table_setup_consumers.cc
storage/perfschema/table_setup_instruments.cc
storage/perfschema/table_setup_objects.cc
storage/perfschema/table_setup_timers.cc
storage/perfschema/table_threads.cc
storage/perfschema/unittest/stub_server_misc.h
strings/CHARSET_INFO.txt
strings/ctype-extra.c
strings/ctype-mb.c
strings/ctype-uca.c
strings/ctype-ucs2.c
strings/ctype-utf8.c
strings/my_strchr.c
support-files/CMakeLists.txt
support-files/MySQL-shared-compat.spec.sh
support-files/my-huge.cnf.sh
support-files/my-innodb-heavy-4G.cnf.sh
support-files/my-large.cnf.sh
support-files/my-medium.cnf.sh
support-files/my-small.cnf.sh
support-files/mysql.spec.sh
tests/mysql_client_test.c
unittest/gunit/CMakeLists.txt
unittest/gunit/mdl-t.cc
unittest/gunit/mdl_mytap-t.cc
unittest/mysys/base64-t.c
unittest/unit.pl
=== added file 'include/mysql/psi/mysql_socket.h'
--- a/include/mysql/psi/mysql_socket.h 1970-01-01 00:00:00 +0000
+++ b/include/mysql/psi/mysql_socket.h 2010-12-07 18:55:54 +0000
@@ -0,0 +1,1001 @@
+/* Copyright (c) 2010, 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA
+*/
+
+#ifndef MYSQL_SOCKET_H
+#define MYSQL_SOCKET_H
+
+/* For strlen() */
+#include <string.h>
+/* For MY_STAT */
+#include <my_dir.h>
+/* For my_chsize */
+#include <my_sys.h>
+/* For socket api */
+//#include <sys/socket.h>
+#include <netinet/in.h>
+/**
+ @file mysql/psi/mysql_socket.h
+[...]
+*/
+
+#include "mysql/psi/psi.h"
+
+/**
+ @defgroup Socket_instrumentation Socket Instrumentation
+ @ingroup Instrumentation_interface
+ @{
+*/
+
+/**
+ @def MYSQL_SOCKET_WAIT_VARIABLES
+ Instrumentation helper for socket waits.
+ This instrumentation declares local variables.
+ Do not use a ';' after this macro
+ @param LOCKER the locker
+ @param STATE the locker state
+ @sa MYSQL_START_SOCKET_WAIT.
+ @sa MYSQL_END_SOCKET_WAIT.
+*/
+#ifdef HAVE_PSI_INTERFACE
+ #define MYSQL_SOCKET_WAIT_VARIABLES(LOCKER, STATE) \
+ struct PSI_socket_locker* LOCKER; \
+ PSI_socket_locker_state STATE;
+#else
+ #define MYSQL_SOCKET_WAIT_VARIABLES(LOCKER, STATE)
+#endif
+
+/**
+ @def MYSQL_START_SOCKET_WAIT
+ Instrumentation helper for socket waits.
+ This instrumentation marks the start of a wait event.
+ @param LOCKER the locker
+ @param STATE the locker state
+ @param PSI The instrumented socket
+ @param OP The socket operation to be performed
+ @param FLAGS Per socket operation flags.
+ @param COUNT Bytes written or -1
+ @sa MYSQL_END_SOCKET_WAIT.
+*/
+#ifdef HAVE_PSI_INTERFACE
+ #define MYSQL_START_SOCKET_WAIT(LOCKER, STATE, PSI, OP, COUNT) \
+ LOCKER= inline_mysql_start_socket_wait(STATE, PSI, OP, COUNT,\
+ __FILE__, __LINE__)
+#else
+ #define MYSQL_START_SOCKET_WAIT(LOCKER, STATE, PSI, OP, COUNT) \
+ do {} while (0)
+#endif
+
+/**
+ @def MYSQL_END_SOCKET_WAIT
+ Instrumentation helper for socket waits.
+ This instrumentation marks the end of a wait event.
+ @sa MYSQL_START_SOCKET_WAIT.
+*/
+#ifdef HAVE_PSI_INTERFACE
+ #define MYSQL_END_SOCKET_WAIT(LOCKER, COUNT) \
+ inline_mysql_end_socket_wait(LOCKER, COUNT)
+#else
+ #define MYSQL_END_SOCKET_WAIT(LOCKER, COUNT) \
+ do {} while (0)
+#endif
+
+
+
+#ifdef HAVE_PSI_INTERFACE
+/**
+ Instrumentation calls for MYSQL_START_SOCKET_WAIT.
+ @sa MYSQL_START_SOCKET_WAIT.
+*/
+static inline struct PSI_socket_locker*
+inline_mysql_start_socket_wait(PSI_socket_locker_state *state,
+ struct PSI_socket *psi, enum PSI_socket_operation op,
+ size_t count,
+ const char *src_file, int src_line)
+{
+ struct PSI_socket_locker *locker= NULL;
+
+ if (likely(PSI_server && psi))
+ {
+ locker= PSI_server->get_thread_socket_locker(state, psi, op);
+ if (likely(locker != NULL))
+ PSI_server->start_socket_wait(locker, count, src_file, src_line);
+ }
+ return locker;
+}
+
+/**
+ Instrumentation calls for MYSQL_END_SOCKET_WAIT.
+ @sa MYSQL_END_SOCKET_WAIT.
+*/
+static inline void
+inline_mysql_end_socket_wait(struct PSI_socket_locker *locker, size_t count)
+{
+ if (likely(locker != NULL))
+ PSI_server->end_socket_wait(locker, count);
+}
+#endif
+
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_socket(K, D, T, P) \
+ inline_mysql_socket_socket(K, D, T, P)
+#else
+ #define mysql_socket_socket(K, D, T, P) \
+ inline_mysql_socket_socket(D, T, P)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_socketpair(K, D, T, P, FDS) \
+ inline_mysql_socket_socketpair(K, D, T, P, FDS)
+#else
+ #define mysql_socket_socketpair(K, D, T, P, FDS) \
+ inline_mysql_socket_socketpair(D, T, P, FDS)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_bind(FD, A, L) \
+ inline_mysql_socket_bind(__FILE__, __LINE__, FD, A, L)
+#else
+ #define mysql_socket_bind(FD, A, L) \
+ inline_mysql_socket_bind(FD, A, L)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_getsockname(FD, A, LP) \
+ inline_mysql_socket_getsockname(__FILE__, __LINE__, FD, A, LP)
+#else
+ #define mysql_socket_getsockname(FD, A, LP) \
+ inline_mysql_socket_getsockname(FD, A, LP)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_connect(FD, A, L) \
+ inline_mysql_socket_connect(__FILE__, __LINE__, FD, A, L)
+#else
+ #define mysql_socket_connect(FD, A, L) \
+ inline_mysql_socket_connect(FD, A, L)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_getpeername(FD, A, LP) \
+ inline_mysql_socket_getpeername(__FILE__, __LINE__, FD, A, LP)
+#else
+ #define mysql_socket_getpeername(FD, A, LP) \
+ inline_mysql_socket_getpeername(FD, A, LP)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_send(FD, B, N, FL) \
+ inline_mysql_socket_send(__FILE__, __LINE__, FD, B, N, FL)
+#else
+ #define mysql_socket_send(FD, B, N, FL) \
+ inline_mysql_socket_send(FD, B, N, FL)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_recv(FD, B, N, FL) \
+ inline_mysql_socket_recv(__FILE__, __LINE__, FD, B, N, FL)
+#else
+ #define mysql_socket_recv(FD, B, N, FL) \
+ inline_mysql_socket_recv(FD, B, N, FL)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_sendto(FD, B, N, FL, A, L) \
+ inline_mysql_socket_sendto(__FILE__, __LINE__, FD, B, N, FL, A, L)
+#else
+ #define mysql_socket_sendto(FD, B, N, FL, A, L) \
+ inline_mysql_socket_sendto(FD, B, N, FL, A, L)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_recvfrom(FD, B, N, FL, A, LP) \
+ inline_mysql_socket_recvfrom(__FILE__, __LINE__, FD, B, N, FL, A, LP)
+#else
+ #define mysql_socket_recvfrom(FD, B, N, FL, A, LP) \
+ inline_mysql_socket_recvfrom(FD, B, N, FL, A, LP)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_sendmsg(FD, M, FL) \
+ inline_mysql_socket_sendmsg(__FILE__, __LINE__, FD, M, FL)
+#else
+ #define mysql_socket_sendmsg(FD, M, FL) \
+ inline_mysql_socket_sendmsg(FD, M, FL)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_recvmsg(FD, M, FL) \
+ inline_mysql_socket_recvmsg(__FILE__, __LINE__, FD, M, FL)
+#else
+ #define_mysql_socket_recvmsg(FD, M, FL) \
+ inline_mysql_socket_recvmsg(FD, M, FL)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_getsockopt(FD, LV, ON, OP, OL) \
+ inline_mysql_socket_getsockopt(__FILE__, __LINE__, FD, LV, ON, OP, OL)
+#else
+ #define mysql_socket_getsockopt(FD, LV, ON, OP, OL) \
+ inline_mysql_socket_getsockopt(FD, LV, ON, OP, OL)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_setsockopt(FD, LV, ON, OP, OL) \
+ inline_mysql_socket_setsockopt(__FILE__, __LINE__, FD, LV, ON, OP, OL)
+#else
+ #define mysql_socket_setsockopt(FD, LV, ON, OP, OL) \
+ inline_mysql_socket_setsockopt(FD, LV, ON, OP, OL)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_listen(FD, N) \
+ inline_mysql_socket_listen(__FILE__, __LINE__, FD, N)
+#else
+ #define mysql_socket_listen(FD, N) \
+ inline_mysql_socket_listen(FD, N)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_accept(K, FD, A, LP) \
+ inline_mysql_socket_accept(K, __FILE__, __LINE__, FD, A, LP)
+#else
+ #define mysql_socket_accept(FD, A, LP) \
+ inline_mysql_socket_accept(FD, A, LP)
+#endif
+
+#if 0
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_accept4(K, FD, A, LP, FL) \
+ inline_mysql_socket_accept4(K, __FILE__, __LINE__, FD, A, LP, FL)
+#else
+ #define mysql_socket_accept4(FD, A, LP, FL) \
+ inline_mysql_socket_accept4(FD, A, LP, FL)
+#endif
+
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_close(FD) \
+ inline_mysql_socket_close(__FILE__, __LINE__, FD)
+#else
+ #define mysql_socket_close(FD) \
+ inline_mysql_socket_close(FD)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_shutdown(FD, H) \
+ inline_mysql_socket_shutdown(__FILE__, __LINE__, FD, H)
+#else
+ #define mysql_socket_shutdown(FD, H) \
+ inline_mysql_socket_shutdown(FD, H)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_sockatmark(FD) \
+ inline_mysql_socket_sockatmark(__FILE__, __LINE__, FD)
+#else
+ #define mysql_socket_sockatmark(FD) \
+ inline_mysql_socket_sockatmark(FD)
+#endif
+
+#ifdef HAVE_PSI_INTERFACE
+ #define mysql_socket_isfdtype(FD, FT) \
+ inline_mysql_socket_isfdtype(__FILE__, __LINE__, FD, FT)
+#else
+ #define mysql_socket_isfdtype(FD, FT) \
+ inline_mysql_socket_isfdtype(FD, FT)
+#endif
+
+struct st_mysql_socket
+{
+ /** The real socket identifier. */
+ my_socket fd;
+
+ /**
+ The instrumentation hook.
+ Note that this hook is not conditionally defined,
+ for binary compatibility of the @c MYSQL_FILE interface.
+ */
+
+ struct PSI_socket *m_psi;
+};
+
+/**
+ Type of an instrumented socket.
+ @c MYSQL_SOCKET is a replacement for @c my_socket.
+ @sa mysql_file_open
+*/
+
+typedef struct st_mysql_socket MYSQL_SOCKET;
+
+#define mysql_socket_getfd(FD) ((FD).fd)
+
+/** mysql_socket_socket */
+
+static inline MYSQL_SOCKET
+inline_mysql_socket_socket
+(
+#ifdef HAVE_PSI_INTERFACE
+ PSI_socket_key key,
+#endif
+ int domain, int type, int protocol)
+{
+ MYSQL_SOCKET mysql_socket = {0, NULL};
+#ifdef HAVE_PSI_INTERFACE
+ mysql_socket.m_psi = PSI_server ? PSI_server->init_socket(key, &mysql_socket.fd)
+ : NULL;
+#endif
+ mysql_socket.fd= socket(domain, type, protocol);
+
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(mysql_socket.m_psi != NULL))
+ PSI_server->set_socket_descriptor(mysql_socket.m_psi, mysql_socket.fd);
+#endif
+ return mysql_socket;
+}
+
+/** mysql_socket_socketpair */
+
+static inline int
+inline_mysql_socket_socketpair
+(
+#ifdef HAVE_PSI_INTERFACE
+ PSI_socket_key key,
+#endif
+ int domain, int type, int protocol, MYSQL_SOCKET mysql_socket[2])
+{
+ int result= 0;
+ int fds[2]= {0, 0};
+
+ mysql_socket[0].m_psi= PSI_server ? PSI_server->init_socket(key, &mysql_socket[0].fd)
+ : NULL;
+ mysql_socket[1].m_psi= PSI_server ? PSI_server->init_socket(key, &mysql_socket[1].fd)
+ : NULL;
+
+ result= socketpair(domain, type, protocol, fds);
+
+ mysql_socket[0].fd = fds[0];
+ mysql_socket[1].fd = fds[1];
+
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(mysql_socket[0].m_psi != NULL && mysql_socket[1].m_psi != NULL))
+ {
+ PSI_server->set_socket_descriptor(mysql_socket[0].m_psi, fds[0]);
+ PSI_server->set_socket_descriptor(mysql_socket[1].m_psi, fds[1]);
+ }
+#endif
+ return result;
+}
+
+/** mysql_socket_bind */
+
+static inline int
+inline_mysql_socket_bind
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, const struct sockaddr *addr, socklen_t len)
+{
+ int result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_BIND);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= bind(mysql_socket.fd, addr, len);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL
+ && result == 0))
+ PSI_server->set_socket_address(mysql_socket.m_psi, addr);
+
+ if (likely(locker != NULL))
+ PSI_server->end_socket_wait(locker, (size_t)0);
+#endif
+ return result;
+}
+
+/** mysql_socket_getsockname */
+
+static inline int
+inline_mysql_socket_getsockname
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, __SOCKADDR_ARG addr, socklen_t *len)
+{
+ int result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_BIND);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= getsockname(mysql_socket.fd, addr, len);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ PSI_server->end_socket_wait(locker, (size_t)0);
+#endif
+ return result;
+}
+
+/** mysql_socket_connect */
+
+static inline int
+inline_mysql_socket_connect
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, __CONST_SOCKADDR_ARG addr, socklen_t len)
+{
+ int result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= connect(mysql_socket.fd, addr, len);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ PSI_server->end_socket_wait(locker, (size_t)0);
+#endif
+ return result;
+}
+
+/** mysql_socket_getpeername */
+
+static inline int
+inline_mysql_socket_getpeername
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, __SOCKADDR_ARG addr, socklen_t *len)
+{
+ int result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_BIND);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= getpeername(mysql_socket.fd, addr, len);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ PSI_server->end_socket_wait(locker, (size_t)0);
+#endif
+ return result;
+}
+
+/** mysql_socket_send */
+
+static inline ssize_t
+inline_mysql_socket_send
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, const void *buf, size_t n, int flags)
+{
+ ssize_t result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_SEND);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= send(mysql_socket.fd, buf, n, flags);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ {
+ size_t bytes_written = (result > -1) ? result : 0;
+ PSI_server->end_socket_wait(locker, bytes_written);
+ }
+#endif
+ return result;
+}
+
+/** mysql_socket_recv */
+
+static inline ssize_t
+inline_mysql_socket_recv
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, void *buf, size_t n, int flags)
+{
+ ssize_t result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_RECV);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= recv(mysql_socket.fd, buf, n, flags);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ {
+ size_t bytes_read = (result > -1) ? result : 0;
+ PSI_server->end_socket_wait(locker, bytes_read);
+ }
+#endif
+ return result;
+}
+
+/** mysql_socket_sendto */
+
+static inline ssize_t
+inline_mysql_socket_sendto
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, const void *buf, size_t n, int flags, __CONST_SOCKADDR_ARG addr, socklen_t addr_len)
+{
+ ssize_t result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_SEND);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= sendto(mysql_socket.fd, buf, n, flags, addr, addr_len);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ {
+ size_t bytes_written = (result > -1) ? result : 0;
+ PSI_server->end_socket_wait(locker, bytes_written);
+ }
+#endif
+ return result;
+}
+
+/** mysql_socket_recvfrom */
+
+static inline ssize_t
+inline_mysql_socket_recvfrom
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, void *buf, size_t n, int flags, __SOCKADDR_ARG addr, socklen_t *addr_len)
+{
+ ssize_t result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_RECV);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= recvfrom(mysql_socket.fd, buf, n, flags, addr, addr_len);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ {
+ size_t bytes_read = (result > -1) ? result : 0;
+ PSI_server->end_socket_wait(locker, bytes_read);
+ }
+#endif
+ return result;
+}
+
+/** mysql_socket_sendmsg */
+
+static inline ssize_t
+inline_mysql_socket_sendmsg
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, const struct msghdr *message, int flags)
+{
+ ssize_t result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_SEND);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= sendmsg(mysql_socket.fd, message, flags);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ {
+ size_t bytes_written = (result > -1) ? result : 0;
+ PSI_server->end_socket_wait(locker, bytes_written);
+ }
+#endif
+ return result;
+}
+
+/** mysql_socket_recvmsg */
+
+static inline ssize_t
+inline_mysql_socket_recvmsg
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, struct msghdr *message, int flags)
+{
+ ssize_t result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_RECV);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= recvmsg(mysql_socket.fd, message, flags);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ {
+ size_t bytes_written = (result > -1) ? result : 0;
+ PSI_server->end_socket_wait(locker, bytes_written);
+ }
+#endif
+ return result;
+}
+
+/** mysql_socket_getsockopt */
+
+static inline int
+inline_mysql_socket_getsockopt
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, int level, int optname, void *optval, socklen_t *optlen)
+{
+ int result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_OPT);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= getsockopt(mysql_socket.fd, level, optname, optval, optlen);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ PSI_server->end_socket_wait(locker, (size_t)0);
+#endif
+ return result;
+}
+
+/** mysql_socket_setsockopt */
+
+static inline int
+inline_mysql_socket_setsockopt
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, int level, int optname, const void *optval, socklen_t optlen)
+{
+ int result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_OPT);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= setsockopt(mysql_socket.fd, level, optname, optval, optlen);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ PSI_server->end_socket_wait(locker, (size_t)0);
+#endif
+ return result;
+}
+
+/** mysql_socket_listen */
+
+static inline int
+inline_mysql_socket_listen
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, int n)
+{
+ int result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= listen(mysql_socket.fd, n);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ PSI_server->end_socket_wait(locker, (size_t)0);
+#endif
+ return result;
+}
+
+/** mysql_socket_accept */
+
+static inline MYSQL_SOCKET
+inline_mysql_socket_accept
+(
+#ifdef HAVE_PSI_INTERFACE
+ PSI_socket_key key, const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET socket_listen, struct sockaddr *addr, socklen_t *addr_len)
+{
+ MYSQL_SOCKET socket_accept = {0, NULL};
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ socket_accept.m_psi = PSI_server ? PSI_server->init_socket(key, &socket_accept.fd)
+ : NULL;
+ if (likely(PSI_server != NULL && socket_accept.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, socket_accept.m_psi, PSI_SOCKET_CONNECT);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ socket_accept.fd= accept(socket_listen.fd, addr, addr_len);
+
+#ifdef HAVE_PSI_INTERFACE
+ /** Set socket address info */
+ if (likely(PSI_server != NULL && socket_accept.m_psi != NULL
+ && socket_accept.fd > -1))
+ PSI_server->set_socket_info(socket_accept.m_psi, socket_accept.fd, addr);
+
+ if (likely(locker != NULL))
+ PSI_server->end_socket_wait(locker, (size_t)0);
+#endif
+ return socket_accept;
+}
+
+/** mysql_socket_accept4 */
+#if 0
+
+static inline MYSQL_SOCKET
+inline_mysql_socket_accept4
+(
+#ifdef HAVE_PSI_INTERFACE
+ PSI_socket_key key, const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET socket_listen, __SOCKADDR_ARG addr, socklen_t *addr_len, int flags)
+{
+ MYSQL_SOCKET socket_accept = {0, NULL};
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ socket_accept.m_psi = PSI_server ? PSI_server->init_socket(key, &socket_accept.fd)
+ : NULL;
+ if (likely(PSI_server != NULL && socket_accept.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(socket_accept.m_psi, PSI_SOCKET_CONNECT);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ socket_accept.fd= accept4(socket_listen.fd, addr, addr_len, flags);
+#ifdef HAVE_PSI_INTERFACE
+ /** Set socket address info */
+ if (likely(PSI_server != NULL && socket_accept.m_psi != NULL
+ && socket_accept.fd > -1))
+ PSI_server->set_socket_info(socket_accept.m_psi, socket_accept.fd, addr);
+
+ if (likely(locker != NULL))
+ PSI_server->end_socket_wait(locker, (size_t)0);
+#endif
+ return socket_accept;
+}
+
+#endif
+
+
+/** mysql_socket_close */
+
+static inline int
+inline_mysql_socket_close
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket)
+{
+ int result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_CLOSE);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= closesocket(mysql_socket.fd);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ PSI_server->end_socket_wait(locker, (size_t)0);
+#endif
+ return result;
+}
+
+/** mysql_socket_shutdown */
+
+static inline int
+inline_mysql_socket_shutdown
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, int how)
+{
+ int result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_SHUTDOWN);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= shutdown(mysql_socket.fd, how);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ PSI_server->end_socket_wait(locker, (size_t)0);
+#endif
+ return result;
+}
+
+/** mysql_socket_sockatmark */
+
+static inline int
+inline_mysql_socket_sockatmark
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket)
+{
+ int result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_STAT);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= sockatmark(mysql_socket.fd);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ PSI_server->end_socket_wait(locker, (size_t)0);
+#endif
+ return result;
+}
+
+/** mysql_socket_isfdtype */
+
+static inline int
+inline_mysql_socket_isfdtype
+(
+#ifdef HAVE_PSI_INTERFACE
+ const char *src_file, uint src_line,
+#endif
+ MYSQL_SOCKET mysql_socket, int fdtype)
+{
+ int result;
+#ifdef HAVE_PSI_INTERFACE
+ struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
+ if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
+ {
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_STAT);
+ if (likely(locker !=NULL))
+ PSI_server->start_socket_wait(locker, (size_t)0, src_file, src_line);
+ }
+#endif
+ result= isfdtype(mysql_socket.fd, fdtype);
+#ifdef HAVE_PSI_INTERFACE
+ if (likely(locker != NULL))
+ PSI_server->end_socket_wait(locker, (size_t)0);
+#endif
+ return result;
+}
+
+/** @} (end of group Socket_instrumentation) */
+
+#endif
+
=== modified file 'include/mysql/psi/psi.h'
--- a/include/mysql/psi/psi.h 2010-07-30 09:02:32 +0000
+++ b/include/mysql/psi/psi.h 2010-12-07 18:55:54 +0000
@@ -83,6 +83,12 @@ struct PSI_thread;
struct PSI_file;
/**
+ Interface for an instrumented socket descriptor.
+ This is an opaque structure.
+*/
+struct PSI_socket;
+
+/**
Interface for an instrumented table operation.
This is an opaque structure.
*/
@@ -254,6 +260,40 @@ enum PSI_table_operation
PSI_TABLE_DELETE_ROW= 5
};
+/** Operation performed on an instrumented socket. */
+enum PSI_socket_operation
+{
+ /** Socket creation, as in @c socket() or @c socketpair(). */
+ PSI_SOCKET_CREATE= 0,
+
+ /** Socket connection, as in @c connect(), @c listen() and @c accept(). */
+ PSI_SOCKET_CONNECT= 1,
+
+ /** Socket bind, as in @c bind(), @c getsockname() and @c getpeername(). */
+ PSI_SOCKET_BIND= 2,
+
+ /** Socket close, as in @c shutdown(). */
+ PSI_SOCKET_CLOSE= 3,
+ /**
+ Generic socket send, such as @c send(), @c sendto(), @c sendmsg(). */
+ PSI_SOCKET_SEND= 4,
+ /**
+ Generic socket receive, such as @c recv(), @c recvfrom), @c recvmsg(). */
+ PSI_SOCKET_RECV= 5,
+
+ /** Generic socket seek, such as @c fseek() or @c seek(). */
+ PSI_SOCKET_SEEK= 6,
+
+ /** Socket options, as in @c getsockopt() and @c setsockopt(). */
+ PSI_SOCKET_OPT= 7,
+
+ /** Socket status, as in @c sockatmark() and @c isfdtype(). */
+ PSI_SOCKET_STAT= 8,
+
+ /** Socket shutdown, as in @c shutdown(). */
+ PSI_SOCKET_SHUTDOWN= 9
+};
+
/**
Instrumented mutex key.
To instrument a mutex, a mutex key must be obtained using @c register_mutex.
@@ -293,6 +333,13 @@ typedef unsigned int PSI_thread_key;
typedef unsigned int PSI_file_key;
/**
+ Instrumented socket key.
+ To instrument a socket, a socket key must be obtained using @c register_socket.
+ Using a zero key always disable the instrumentation.
+*/
+typedef unsigned int PSI_socket_key;
+
+/**
@def USE_PSI_1
Define USE_PSI_1 to use the interface version 1.
*/
@@ -442,6 +489,28 @@ struct PSI_file_info_v1
};
/**
+ Socket instrument information.
+ @since PSI_VERSION_1
+ This structure is used to register an instrumented socket.
+*/
+struct PSI_socket_info_v1
+{
+ /**
+ Pointer to the key assigned to the registered socket.
+ */
+ PSI_socket_key *m_key;
+ /**
+ The name of the socket instrument to register.
+ */
+ const char *m_name;
+ /**
+ The flags of the socket instrument to register.
+ @sa PSI_FLAG_GLOBAL
+ */
+ int m_flags;
+};
+
+/**
State data storage for @c get_thread_mutex_locker_v1_t.
This structure provide temporary storage to a mutex locker.
The content of this structure is considered opaque,
@@ -610,6 +679,39 @@ struct PSI_table_locker_state_v1
void *m_wait;
};
+/**
+ State data storage for @c get_thread_socket_locker_v1_t.
+ This structure provide temporary storage to a socket locker.
+ The content of this structure is considered opaque,
+ the fields are only hints of what an implementation
+ of the psi interface can use.
+ This memory is provided by the instrumented code for performance reasons.
+ @sa get_thread_socket_locker_v1_t
+*/
+struct PSI_socket_locker_state_v1
+{
+ /** Internal state. */
+ uint m_flags;
+ /** Current socket. */
+ struct PSI_socket *m_socket;
+ /** Current thread. */
+ struct PSI_thread *m_thread;
+ /** Operation number of bytes. */
+ size_t m_number_of_bytes;
+ /** Timer start. */
+ ulonglong m_timer_start;
+ /** Timer function. */
+ ulonglong (*m_timer)(void);
+ /** Current operation. */
+ enum PSI_socket_operation m_operation;
+ /** Source file. */
+ const char* m_src_file;
+ /** Source line number. */
+ int m_src_line;
+ /** Internal data. */
+ void *m_wait;
+};
+
/* Using typedef to make reuse between PSI_v1 and PSI_v2 easier later. */
/**
@@ -658,6 +760,15 @@ typedef void (*register_file_v1_t)
(const char *category, struct PSI_file_info_v1 *info, int count);
/**
+ Socket registration API.
+ @param category a category name (typically a plugin name)
+ @param info an array of socket info to register
+ @param count the size of the info array
+*/
+typedef void (*register_socket_v1_t)
+ (const char *category, struct PSI_socket_info_v1 *info, int count);
+
+/**
Mutex instrumentation initialisation API.
@param key the registered mutex key
@param identity the address of the mutex itself
@@ -703,6 +814,21 @@ typedef struct PSI_cond* (*init_cond_v1_
typedef void (*destroy_cond_v1_t)(struct PSI_cond *cond);
/**
+ Socket instrumentation initialisation API.
+ @param key the registered mutex key
+ @param identity the address of the socket itself
+ @return an instrumented socket
+*/
+typedef struct PSI_socket* (*init_socket_v1_t)
+ (PSI_socket_key key, const void *identity);
+
+/**
+ socket instrumentation destruction API.
+ @param socket the socket to destroy
+*/
+typedef void (*destroy_socket_v1_t)(struct PSI_socket *socket);
+
+/**
Acquire a table share instrumentation.
@param temporary True for temporary tables
@param share The SQL layer table share
@@ -942,6 +1068,16 @@ typedef struct PSI_file_locker* (*get_th
typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t)
(struct PSI_file_locker_state_v1 *state,
File file, enum PSI_file_operation op);
+/**
+ Get a socket instrumentation locker.
+ @param state data storage for the locker
+ @param socket the socket to access
+ @param op the operation to perform
+ @return a socket locker, or NULL
+*/
+typedef struct PSI_socket_locker* (*get_thread_socket_locker_v1_t)
+ (struct PSI_socket_locker_state_v1 *state,
+ struct PSI_socket *socket, enum PSI_socket_operation op);
/**
Record a mutex instrumentation unlock event.
@@ -1103,6 +1239,57 @@ typedef void (*end_file_wait_v1_t)
(struct PSI_file_locker *locker, size_t count);
/**
+ Record a socket instrumentation start event.
+ @param locker a socket locker for the running thread
+ @param op socket operation to be performed
+ @param count the number of bytes requested, or 0 if not applicable
+ @param src_file the source file name
+ @param src_line the source line number
+*/
+typedef void (*start_socket_wait_v1_t)
+ (struct PSI_socket_locker *locker, size_t count,
+ const char *src_file, uint src_line);
+
+/**
+ Record a socket instrumentation end event.
+ Note that for socket close operations, the instrumented socket handle
+ associated with the socket (which was provided to obtain a locker)
+ is invalid after this call.
+ @param locker a socket locker for the running thread
+ @param count the number of bytes actually used in the operation,
+ or 0 if not applicable, or -1 if the operation failed
+ @sa get_thread_socket_locker
+*/
+typedef void (*end_socket_wait_v1_t)
+ (struct PSI_socket_locker *locker, size_t count);
+
+/**
+ Set the socket descriptor for an instrumented socket.
+ @param socket the instrumented socket
+ @param fd socket descriptor
+ */
+typedef void (*set_socket_descriptor_v1_t)(struct PSI_socket *socket,
+ uint fd);
+
+/**
+ Set the socket address for an instrumented socket.
+ @param socket the instrumented socket
+ @param addr socket address information
+ */
+typedef void (*set_socket_address_v1_t)(struct PSI_socket *socket,
+ const struct sockaddr * addr);
+
+/**
+ Set the socket info for an instrumented socket.
+ @param socket the instrumented socket
+ @param fd the socket descriptor
+ @param addr the socket ip address
+*/
+typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket,
+ uint fd,
+ const struct sockaddr * addr);
+
+/**
Performance Schema Interface, version 1.
@since PSI_VERSION_1
*/
@@ -1118,6 +1305,8 @@ struct PSI_v1
register_thread_v1_t register_thread;
/** @sa register_file_v1_t. */
register_file_v1_t register_file;
+ /** @sa register_socket_v1_t. */
+ register_socket_v1_t register_socket;
/** @sa init_mutex_v1_t. */
init_mutex_v1_t init_mutex;
/** @sa destroy_mutex_v1_t. */
@@ -1130,6 +1319,10 @@ struct PSI_v1
init_cond_v1_t init_cond;
/** @sa destroy_cond_v1_t. */
destroy_cond_v1_t destroy_cond;
+ /** @sa init_socket_v1_t. */
+ init_socket_v1_t init_socket;
+ /** @sa destroy_socket_v1_t. */
+ destroy_socket_v1_t destroy_socket;
/** @sa get_table_share_v1_t. */
get_table_share_v1_t get_table_share;
/** @sa release_table_share_v1_t. */
@@ -1184,6 +1377,8 @@ struct PSI_v1
get_thread_file_stream_locker_v1_t get_thread_file_stream_locker;
/** @sa get_thread_file_descriptor_locker_v1_t. */
get_thread_file_descriptor_locker_v1_t get_thread_file_descriptor_locker;
+ /** @sa get_thread_socket_locker_v1_t. */
+ get_thread_socket_locker_v1_t get_thread_socket_locker;
/** @sa unlock_mutex_v1_t. */
unlock_mutex_v1_t unlock_mutex;
/** @sa unlock_rwlock_v1_t. */
@@ -1223,6 +1418,16 @@ struct PSI_v1
start_file_wait_v1_t start_file_wait;
/** @sa end_file_wait_v1_t. */
end_file_wait_v1_t end_file_wait;
+ /** @sa start_file_wait_v1_t. */
+ start_socket_wait_v1_t start_socket_wait;
+ /** @sa end_file_wait_v1_t. */
+ end_socket_wait_v1_t end_socket_wait;
+ /** @sa set_socket_descriptor_v1_t. */
+ set_socket_descriptor_v1_t set_socket_descriptor;
+ /** @sa set_socket_address_v1_t. */
+ set_socket_address_v1_t set_socket_address;
+ /** @sa set_socket_info_v1_t. */
+ set_socket_info_v1_t set_socket_info;
};
/** @} (end of group Group_PSI_v1) */
@@ -1318,6 +1523,12 @@ struct PSI_table_locker_state_v2
int placeholder;
};
+struct PSI_socket_locker_state_v2
+{
+ /** Placeholder */
+ int placeholder;
+};
+
/** @} (end of group Group_PSI_v2) */
#endif /* HAVE_PSI_2 */
@@ -1361,11 +1572,13 @@ typedef struct PSI_rwlock_info_v1 PSI_rw
typedef struct PSI_cond_info_v1 PSI_cond_info;
typedef struct PSI_thread_info_v1 PSI_thread_info;
typedef struct PSI_file_info_v1 PSI_file_info;
+typedef struct PSI_socket_info_v1 PSI_socket_info;
typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state;
typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state;
typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state;
typedef struct PSI_file_locker_state_v1 PSI_file_locker_state;
typedef struct PSI_table_locker_state_v1 PSI_table_locker_state;
+typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state;
#endif
#ifdef USE_PSI_2
@@ -1375,11 +1588,13 @@ typedef struct PSI_rwlock_info_v2 PSI_rw
typedef struct PSI_cond_info_v2 PSI_cond_info;
typedef struct PSI_thread_info_v2 PSI_thread_info;
typedef struct PSI_file_info_v2 PSI_file_info;
+typedef struct PSI_socket_info_v2 PSI_socket_info;
typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state;
typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state;
typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state;
typedef struct PSI_file_locker_state_v2 PSI_file_locker_state;
typedef struct PSI_table_locker_state_v2 PSI_table_locker_state;
+typedef struct PSI_socket_locker_state_v2 PSI_socket_locker_state;
#endif
#else /* HAVE_PSI_INTERFACE */
=== modified file 'include/mysql/psi/psi_abi_v1.h.pp'
--- a/include/mysql/psi/psi_abi_v1.h.pp 2010-07-30 09:02:32 +0000
+++ b/include/mysql/psi/psi_abi_v1.h.pp 2010-12-07 18:55:54 +0000
@@ -8,6 +8,7 @@ struct PSI_table_share;
struct PSI_table;
struct PSI_thread;
struct PSI_file;
+struct PSI_socket;
struct PSI_table_locker;
struct PSI_bootstrap
{
@@ -63,11 +64,25 @@ enum PSI_table_operation
PSI_TABLE_UPDATE_ROW= 4,
PSI_TABLE_DELETE_ROW= 5
};
+enum PSI_socket_operation
+{
+ PSI_SOCKET_CREATE= 0,
+ PSI_SOCKET_CONNECT= 1,
+ PSI_SOCKET_BIND= 2,
+ PSI_SOCKET_CLOSE= 3,
+ PSI_SOCKET_SEND= 4,
+ PSI_SOCKET_RECV= 5,
+ PSI_SOCKET_SEEK= 6,
+ PSI_SOCKET_OPT= 7,
+ PSI_SOCKET_STAT= 8,
+ PSI_SOCKET_SHUTDOWN= 9
+};
typedef unsigned int PSI_mutex_key;
typedef unsigned int PSI_rwlock_key;
typedef unsigned int PSI_cond_key;
typedef unsigned int PSI_thread_key;
typedef unsigned int PSI_file_key;
+typedef unsigned int PSI_socket_key;
struct PSI_mutex_info_v1
{
PSI_mutex_key *m_key;
@@ -98,6 +113,12 @@ struct PSI_file_info_v1
const char *m_name;
int m_flags;
};
+struct PSI_socket_info_v1
+{
+ PSI_socket_key *m_key;
+ const char *m_name;
+ int m_flags;
+};
struct PSI_mutex_locker_state_v1
{
uint m_flags;
@@ -164,6 +185,19 @@ struct PSI_table_locker_state_v1
int m_src_line;
void *m_wait;
};
+struct PSI_socket_locker_state_v1
+{
+ uint m_flags;
+ struct PSI_socket *m_socket;
+ struct PSI_thread *m_thread;
+ size_t m_number_of_bytes;
+ ulonglong m_timer_start;
+ ulonglong (*m_timer)(void);
+ enum PSI_socket_operation m_operation;
+ const char* m_src_file;
+ int m_src_line;
+ void *m_wait;
+};
typedef void (*register_mutex_v1_t)
(const char *category, struct PSI_mutex_info_v1 *info, int count);
typedef void (*register_rwlock_v1_t)
@@ -174,6 +208,8 @@ typedef void (*register_thread_v1_t)
(const char *category, struct PSI_thread_info_v1 *info, int count);
typedef void (*register_file_v1_t)
(const char *category, struct PSI_file_info_v1 *info, int count);
+typedef void (*register_socket_v1_t)
+ (const char *category, struct PSI_socket_info_v1 *info, int count);
typedef struct PSI_mutex* (*init_mutex_v1_t)
(PSI_mutex_key key, const void *identity);
typedef void (*destroy_mutex_v1_t)(struct PSI_mutex *mutex);
@@ -183,6 +219,9 @@ typedef void (*destroy_rwlock_v1_t)(stru
typedef struct PSI_cond* (*init_cond_v1_t)
(PSI_cond_key key, const void *identity);
typedef void (*destroy_cond_v1_t)(struct PSI_cond *cond);
+typedef struct PSI_socket* (*init_socket_v1_t)
+ (PSI_socket_key key, const void *identity);
+typedef void (*destroy_socket_v1_t)(struct PSI_socket *socket);
typedef struct PSI_table_share* (*get_table_share_v1_t)
(my_bool temporary, struct TABLE_SHARE *share);
typedef void (*release_table_share_v1_t)(struct PSI_table_share *share);
@@ -239,6 +278,9 @@ typedef struct PSI_file_locker* (*get_th
typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t)
(struct PSI_file_locker_state_v1 *state,
File file, enum PSI_file_operation op);
+typedef struct PSI_socket_locker* (*get_thread_socket_locker_v1_t)
+ (struct PSI_socket_locker_state_v1 *state,
+ struct PSI_socket *socket, enum PSI_socket_operation op);
typedef void (*unlock_mutex_v1_t)
(struct PSI_mutex *mutex);
typedef void (*unlock_rwlock_v1_t)
@@ -276,6 +318,18 @@ typedef void (*start_file_wait_v1_t)
const char *src_file, uint src_line);
typedef void (*end_file_wait_v1_t)
(struct PSI_file_locker *locker, size_t count);
+typedef void (*start_socket_wait_v1_t)
+ (struct PSI_socket_locker *locker, size_t count,
+ const char *src_file, uint src_line);
+typedef void (*end_socket_wait_v1_t)
+ (struct PSI_socket_locker *locker, size_t count);
+typedef void (*set_socket_descriptor_v1_t)(struct PSI_socket *socket,
+ uint fd);
+typedef void (*set_socket_address_v1_t)(struct PSI_socket *socket,
+ const struct sockaddr * addr);
+typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket,
+ uint fd,
+ const struct sockaddr * addr);
struct PSI_v1
{
register_mutex_v1_t register_mutex;
@@ -283,12 +337,15 @@ struct PSI_v1
register_cond_v1_t register_cond;
register_thread_v1_t register_thread;
register_file_v1_t register_file;
+ register_socket_v1_t register_socket;
init_mutex_v1_t init_mutex;
destroy_mutex_v1_t destroy_mutex;
init_rwlock_v1_t init_rwlock;
destroy_rwlock_v1_t destroy_rwlock;
init_cond_v1_t init_cond;
destroy_cond_v1_t destroy_cond;
+ init_socket_v1_t init_socket;
+ destroy_socket_v1_t destroy_socket;
get_table_share_v1_t get_table_share;
release_table_share_v1_t release_table_share;
drop_table_share_v1_t drop_table_share;
@@ -316,6 +373,7 @@ struct PSI_v1
get_thread_file_name_locker_v1_t get_thread_file_name_locker;
get_thread_file_stream_locker_v1_t get_thread_file_stream_locker;
get_thread_file_descriptor_locker_v1_t get_thread_file_descriptor_locker;
+ get_thread_socket_locker_v1_t get_thread_socket_locker;
unlock_mutex_v1_t unlock_mutex;
unlock_rwlock_v1_t unlock_rwlock;
signal_cond_v1_t signal_cond;
@@ -336,6 +394,11 @@ struct PSI_v1
end_file_open_wait_and_bind_to_descriptor;
start_file_wait_v1_t start_file_wait;
end_file_wait_v1_t end_file_wait;
+ start_socket_wait_v1_t start_socket_wait;
+ end_socket_wait_v1_t end_socket_wait;
+ set_socket_descriptor_v1_t set_socket_descriptor;
+ set_socket_address_v1_t set_socket_address;
+ set_socket_info_v1_t set_socket_info;
};
typedef struct PSI_v1 PSI;
typedef struct PSI_mutex_info_v1 PSI_mutex_info;
@@ -343,10 +406,12 @@ typedef struct PSI_rwlock_info_v1 PSI_rw
typedef struct PSI_cond_info_v1 PSI_cond_info;
typedef struct PSI_thread_info_v1 PSI_thread_info;
typedef struct PSI_file_info_v1 PSI_file_info;
+typedef struct PSI_socket_info_v1 PSI_socket_info;
typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state;
typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state;
typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state;
typedef struct PSI_file_locker_state_v1 PSI_file_locker_state;
typedef struct PSI_table_locker_state_v1 PSI_table_locker_state;
+typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state;
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
C_MODE_END
=== modified file 'include/mysql/psi/psi_abi_v2.h.pp'
--- a/include/mysql/psi/psi_abi_v2.h.pp 2010-07-23 17:08:41 +0000
+++ b/include/mysql/psi/psi_abi_v2.h.pp 2010-12-07 18:55:54 +0000
@@ -8,6 +8,7 @@ struct PSI_table_share;
struct PSI_table;
struct PSI_thread;
struct PSI_file;
+struct PSI_socket;
struct PSI_table_locker;
struct PSI_bootstrap
{
@@ -63,11 +64,25 @@ enum PSI_table_operation
PSI_TABLE_UPDATE_ROW= 4,
PSI_TABLE_DELETE_ROW= 5
};
+enum PSI_socket_operation
+{
+ PSI_SOCKET_CREATE= 0,
+ PSI_SOCKET_CONNECT= 1,
+ PSI_SOCKET_BIND= 2,
+ PSI_SOCKET_CLOSE= 3,
+ PSI_SOCKET_SEND= 4,
+ PSI_SOCKET_RECV= 5,
+ PSI_SOCKET_SEEK= 6,
+ PSI_SOCKET_OPT= 7,
+ PSI_SOCKET_STAT= 8,
+ PSI_SOCKET_SHUTDOWN= 9
+};
typedef unsigned int PSI_mutex_key;
typedef unsigned int PSI_rwlock_key;
typedef unsigned int PSI_cond_key;
typedef unsigned int PSI_thread_key;
typedef unsigned int PSI_file_key;
+typedef unsigned int PSI_socket_key;
struct PSI_v2
{
int placeholder;
@@ -112,16 +127,22 @@ struct PSI_table_locker_state_v2
{
int placeholder;
};
+struct PSI_socket_locker_state_v2
+{
+ int placeholder;
+};
typedef struct PSI_v2 PSI;
typedef struct PSI_mutex_info_v2 PSI_mutex_info;
typedef struct PSI_rwlock_info_v2 PSI_rwlock_info;
typedef struct PSI_cond_info_v2 PSI_cond_info;
typedef struct PSI_thread_info_v2 PSI_thread_info;
typedef struct PSI_file_info_v2 PSI_file_info;
+typedef struct PSI_socket_info_v2 PSI_socket_info;
typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state;
typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state;
typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state;
typedef struct PSI_file_locker_state_v2 PSI_file_locker_state;
typedef struct PSI_table_locker_state_v2 PSI_table_locker_state;
+typedef struct PSI_socket_locker_state_v2 PSI_socket_locker_state;
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
C_MODE_END
=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql 2010-12-02 15:05:07 +0000
+++ b/scripts/mysql_system_tables.sql 2010-12-07 18:55:54 +0000
@@ -374,6 +374,27 @@ EXECUTE stmt;
DROP PREPARE stmt;
--
+-- TABLE SOCKET_INSTANCES
+--
+
+SET @l1="CREATE TABLE performance_schema.socket_instances(";
+SET @l2="EVENT_NAME varchar(128) not null,";
+SET @l3="OBJECT_INSTANCE_BEGIN bigint(20) not null,";
+SET @l4="SOCKET_ID int(11) not null,";
+SET @l5="IP varchar(128) not null,";
+SET @l6="PORT int(11) not null,";
+SET @l7="BYTES_READ bigint(20) not null,";
+SET @l8="BYTES_WRITE bigint(20) not null";
+SET @l9=")ENGINE=PERFORMANCE_SCHEMA;";
+SET @cmd=concat(@l1,@l2,@l3,@l4,@l5,@l6,@l7,@l8,@l9);
+
+SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+
+--
-- TABLE MUTEX_INSTANCES
--
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2010-11-30 19:09:11 +0000
+++ b/sql/mysqld.cc 2010-12-07 18:55:54 +0000
@@ -70,6 +70,7 @@
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
#include "../storage/perfschema/pfs_server.h"
+#include <mysql/psi/mysql_socket.h>
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
#include "keycaches.h"
@@ -838,7 +839,7 @@ C_MODE_END
#endif /* !EMBEDDED_LIBRARY */
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
-static my_socket unix_sock,ip_sock;
+static MYSQL_SOCKET unix_sock, ip_sock;
struct rand_struct sql_rand; ///< used by sql_class.cc:THD::THD()
#ifndef EMBEDDED_LIBRARY
@@ -1026,11 +1027,11 @@ static void close_connections(void)
DBUG_PRINT("quit",("Closing sockets"));
if (!opt_disable_networking )
{
- if (ip_sock != INVALID_SOCKET)
+ if (mysql_socket_getfd(ip_sock) != INVALID_SOCKET)
{
- (void) shutdown(ip_sock, SHUT_RDWR);
- (void) closesocket(ip_sock);
- ip_sock= INVALID_SOCKET;
+ (void) mysql_socket_shutdown(ip_sock, SHUT_RDWR);
+ (void) mysql_socket_close(ip_sock);
+ mysql_socket_getfd(ip_sock)= INVALID_SOCKET;
}
}
#ifdef _WIN32
@@ -1058,12 +1059,12 @@ static void close_connections(void)
}
#endif
#ifdef HAVE_SYS_UN_H
- if (unix_sock != INVALID_SOCKET)
+ if (mysql_socket_getfd(unix_sock) != INVALID_SOCKET)
{
- (void) shutdown(unix_sock, SHUT_RDWR);
- (void) closesocket(unix_sock);
+ (void) mysql_socket_shutdown(unix_sock, SHUT_RDWR);
+ (void) mysql_socket_close(unix_sock);
(void) unlink(mysqld_unix_port);
- unix_sock= INVALID_SOCKET;
+ mysql_socket_getfd(unix_sock)= INVALID_SOCKET;
}
#endif
end_thr_alarm(0); // Abort old alarms.
@@ -1161,20 +1162,20 @@ static void close_server_sock()
{
#ifdef HAVE_CLOSE_SERVER_SOCK
DBUG_ENTER("close_server_sock");
- my_socket tmp_sock;
+ MYSQL_SOCKET tmp_sock;
tmp_sock=ip_sock;
- if (tmp_sock != INVALID_SOCKET)
+ if (mysql_socket_getfd(tmp_sock) != INVALID_SOCKET)
{
- ip_sock=INVALID_SOCKET;
+ mysql_socket_getfd(ip_sock)= INVALID_SOCKET;
DBUG_PRINT("info",("calling shutdown on TCP/IP socket"));
- (void) shutdown(tmp_sock, SHUT_RDWR);
+ (void) mysql_socket_shutdown(tmp_sock, SHUT_RDWR);
}
tmp_sock=unix_sock;
- if (tmp_sock != INVALID_SOCKET)
+ if (mysql_socket_getfd(tmp_sock) != INVALID_SOCKET)
{
- unix_sock=INVALID_SOCKET;
+ mysql_socket_getfd(unix_sock)= INVALID_SOCKET;
DBUG_PRINT("info",("calling shutdown on unix socket"));
- (void) shutdown(tmp_sock, SHUT_RDWR);
+ (void) mysql_socket_shutdown(tmp_sock, SHUT_RDWR);
(void) unlink(mysqld_unix_port);
}
DBUG_VOID_RETURN;
@@ -1783,12 +1784,12 @@ static void network_init(void)
for (a= ai; a != NULL; a= a->ai_next)
{
- ip_sock= socket(a->ai_family, a->ai_socktype, a->ai_protocol);
- if (ip_sock != INVALID_SOCKET)
+ ip_sock= mysql_socket_socket(key_socket_network_init, a->ai_family, a->ai_socktype, a->ai_protocol);
+ if (mysql_socket_getfd(ip_sock) != INVALID_SOCKET)
break;
}
- if (ip_sock == INVALID_SOCKET)
+ if (mysql_socket_getfd(ip_sock) == INVALID_SOCKET)
{
DBUG_PRINT("error",("Got error: %d from socket()",socket_errno));
sql_perror(ER_DEFAULT(ER_IPSOCK_ERROR)); /* purecov: tested */
@@ -1801,7 +1802,7 @@ static void network_init(void)
user to open two mysqld servers with the same TCP/IP port.
*/
arg= 1;
- (void) setsockopt(ip_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg,sizeof(arg));
+ (void) mysql_socket_setsockopt(ip_sock, SOL_SOCKET, SO_REUSEADDR, (char*)&arg,sizeof(arg));
#endif /* __WIN__ */
#ifdef IPV6_V6ONLY
@@ -1817,7 +1818,7 @@ static void network_init(void)
if (a->ai_family == AF_INET6)
{
arg= 0;
- (void) setsockopt(ip_sock, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&arg,
+ (void) mysql_socket_setsockopt(ip_sock, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&arg,
sizeof(arg));
}
#endif
@@ -1831,7 +1832,7 @@ static void network_init(void)
*/
for (waited= 0, retry= 1; ; retry++, waited+= this_wait)
{
- if (((ret= bind(ip_sock, a->ai_addr, a->ai_addrlen)) >= 0 ) ||
+ if (((ret= mysql_socket_bind(ip_sock, a->ai_addr, a->ai_addrlen)) >= 0 ) ||
(socket_errno != SOCKET_EADDRINUSE) ||
(waited >= mysqld_port_timeout))
break;
@@ -1847,7 +1848,7 @@ static void network_init(void)
sql_print_error("Do you already have another mysqld server running on port: %d ?",mysqld_port);
unireg_abort(1);
}
- if (listen(ip_sock,(int) back_log) < 0)
+ if (mysql_socket_listen(ip_sock, (int)back_log) < 0)
{
sql_perror("Can't start server: listen() on TCP/IP port");
sql_print_error("listen() on TCP/IP failed with error %d",
@@ -1917,7 +1918,7 @@ static void network_init(void)
(uint) sizeof(UNIXaddr.sun_path) - 1, mysqld_unix_port);
unireg_abort(1);
}
- if ((unix_sock= socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
+ if (mysql_socket_getfd((unix_sock= mysql_socket_socket(key_socket_network_init, AF_UNIX, SOCK_STREAM, 0))) < 0)
{
sql_perror("Can't start server : UNIX Socket "); /* purecov: inspected */
unireg_abort(1); /* purecov: inspected */
@@ -1927,10 +1928,10 @@ static void network_init(void)
strmov(UNIXaddr.sun_path, mysqld_unix_port);
(void) unlink(mysqld_unix_port);
arg= 1;
- (void) setsockopt(unix_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg,
+ (void) mysql_socket_setsockopt(unix_sock, SOL_SOCKET, SO_REUSEADDR, (char*)&arg,
sizeof(arg));
umask(0);
- if (bind(unix_sock, reinterpret_cast<struct sockaddr *>(&UNIXaddr),
+ if (bind(mysql_socket_getfd(unix_sock), reinterpret_cast<struct sockaddr *> (&UNIXaddr),
sizeof(UNIXaddr)) < 0)
{
sql_perror("Can't start server : Bind on unix socket"); /* purecov: tested */
@@ -1941,7 +1942,7 @@ static void network_init(void)
#if defined(S_IFSOCK) && defined(SECURE_SOCKETS)
(void) chmod(mysqld_unix_port,S_IFSOCK); /* Fix solaris 2.6 bug */
#endif
- if (listen(unix_sock,(int) back_log) < 0)
+ if (mysql_socket_listen(unix_sock, (int)back_log) < 0)
sql_print_warning("listen() on Unix socket failed with error %d",
socket_errno);
}
@@ -4717,7 +4718,7 @@ int mysqld_main(int argc, char **argv)
if (!opt_bootstrap)
mysql_file_delete(key_file_pid, pidfile_name, MYF(MY_WME)); // Not needed anymore
- if (unix_sock != INVALID_SOCKET)
+ if (mysql_socket_getfd(unix_sock) != INVALID_SOCKET)
unlink(mysqld_unix_port);
exit(1);
}
@@ -4788,7 +4789,7 @@ int mysqld_main(int argc, char **argv)
start_handle_manager();
sql_print_information(ER_DEFAULT(ER_STARTUP),my_progname,server_version,
- ((unix_sock == INVALID_SOCKET) ? (char*) ""
+ ((mysql_socket_getfd(unix_sock) == INVALID_SOCKET) ? (char*) ""
: mysqld_unix_port),
mysqld_port,
MYSQL_COMPILATION_COMMENT);
@@ -5267,7 +5268,7 @@ inline void kill_broken_server()
{
/* hack to get around signals ignored in syscalls for problem OS's */
if (unix_sock == INVALID_SOCKET ||
- (!opt_disable_networking && ip_sock == INVALID_SOCKET))
+ (!opt_disable_networking && mysql_socket_getfd(ip_sock) == INVALID_SOCKET))
{
select_thread_in_use = 0;
/* The following call will never return */
@@ -5285,7 +5286,8 @@ inline void kill_broken_server()
void handle_connections_sockets()
{
- my_socket UNINIT_VAR(sock), UNINIT_VAR(new_sock);
+ //my_socket UNINIT_VAR(sock), UNINIT_VAR(new_sock);
+ MYSQL_SOCKET sock, new_sock;
uint error_count=0;
THD *thd;
struct sockaddr_storage cAddr;
@@ -5296,7 +5298,7 @@ void handle_connections_sockets()
struct pollfd fds[2]; // for ip_sock and unix_sock
#else
fd_set readFDs,clientFDs;
- uint max_used_connection= (uint) (max(ip_sock,unix_sock)+1);
+ uint max_used_connection= (uint)(max(mysql_socket_getfd(ip_sock), mysql_socket_getfd(unix_sock))+1);
#endif
DBUG_ENTER("handle_connections_sockets");
@@ -5305,29 +5307,29 @@ void handle_connections_sockets()
FD_ZERO(&clientFDs);
#endif
- if (ip_sock != INVALID_SOCKET)
+ if (mysql_socket_getfd(ip_sock) != INVALID_SOCKET)
{
#ifdef HAVE_POLL
- fds[socket_count].fd= ip_sock;
+ fds[socket_count].fd= mysql_socket_getfd(ip_sock);
fds[socket_count].events= POLLIN;
socket_count++;
#else
- FD_SET(ip_sock,&clientFDs);
-#endif
+ FD_SET(mysql_socket_getfd(ip_sock), &clientFDs);
+#endif
#ifdef HAVE_FCNTL
- ip_flags = fcntl(ip_sock, F_GETFL, 0);
+ ip_flags = fcntl(mysql_socket_getfd(ip_sock), F_GETFL, 0);
#endif
}
#ifdef HAVE_SYS_UN_H
#ifdef HAVE_POLL
- fds[socket_count].fd= unix_sock;
+ fds[socket_count].fd= mysql_socket_getfd(unix_sock);
fds[socket_count].events= POLLIN;
socket_count++;
#else
- FD_SET(unix_sock,&clientFDs);
+ FD_SET(mysql_socket_getfd(unix_sock), &clientFDs);
#endif
#ifdef HAVE_FCNTL
- socket_flags=fcntl(unix_sock, F_GETFL, 0);
+ socket_flags=fcntl(mysql_socket_getfd(unix_sock), F_GETFL, 0);
#endif
#endif
@@ -5347,8 +5349,8 @@ void handle_connections_sockets()
{
if (socket_errno != SOCKET_EINTR)
{
- if (!select_errors++ && !abort_loop) /* purecov: inspected */
- sql_print_error("mysqld: Got error %d from select",socket_errno); /* purecov: inspected */
+ if (!select_errors++ && !abort_loop) /* purecov: inspected */
+ sql_print_error("mysqld: Got error %d from select",socket_errno); /* purecov: inspected */
}
MAYBE_BROKEN_SYSCALL
continue;
@@ -5362,13 +5364,13 @@ void handle_connections_sockets()
/* Is this a new connection request ? */
#ifdef HAVE_POLL
- for (int i= 0; i < socket_count; ++i)
+ for (int i= 0; i < socket_count; ++i)
{
if (fds[i].revents & POLLIN)
{
- sock= fds[i].fd;
+ mysql_socket_getfd(sock)= fds[i].fd;
#ifdef HAVE_FCNTL
- flags= fcntl(sock, F_GETFL, 0);
+ flags= fcntl(mysql_socket_getfd(sock), F_GETFL, 0);
#else
flags= 0;
#endif // HAVE_FCNTL
@@ -5377,7 +5379,7 @@ void handle_connections_sockets()
}
#else // HAVE_POLL
#ifdef HAVE_SYS_UN_H
- if (FD_ISSET(unix_sock,&readFDs))
+ if (FD_ISSET(mysql_socket_getfd(unix_sock), &readFDs))
{
sock = unix_sock;
flags= socket_flags;
@@ -5394,51 +5396,52 @@ void handle_connections_sockets()
if (!(test_flags & TEST_BLOCKING))
{
#if defined(O_NONBLOCK)
- fcntl(sock, F_SETFL, flags | O_NONBLOCK);
+ fcntl(mysql_socket_getfd(sock), F_SETFL, flags | O_NONBLOCK);
#elif defined(O_NDELAY)
- fcntl(sock, F_SETFL, flags | O_NDELAY);
+ fcntl(mysql_socket_getfd(sock), F_SETFL, flags | O_NDELAY);
#endif
}
#endif /* NO_FCNTL_NONBLOCK */
for (uint retry=0; retry < MAX_ACCEPT_RETRY; retry++)
{
size_socket length= sizeof(struct sockaddr_storage);
- new_sock= accept(sock, (struct sockaddr *)(&cAddr),
- &length);
- if (new_sock != INVALID_SOCKET ||
- (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN))
- break;
+ new_sock= mysql_socket_accept(key_socket_handle_connection, sock,
+ (struct sockaddr *)(&cAddr), &length);
+ if (mysql_socket_getfd(new_sock) != INVALID_SOCKET ||
+ (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN))
+ break;
MAYBE_BROKEN_SYSCALL;
#if !defined(NO_FCNTL_NONBLOCK)
if (!(test_flags & TEST_BLOCKING))
{
- if (retry == MAX_ACCEPT_RETRY - 1)
- fcntl(sock, F_SETFL, flags); // Try without O_NONBLOCK
+ if (retry == MAX_ACCEPT_RETRY - 1)
+ fcntl(mysql_socket_getfd(sock), F_SETFL, flags); // Try without O_NONBLOCK
}
#endif
}
#if !defined(NO_FCNTL_NONBLOCK)
if (!(test_flags & TEST_BLOCKING))
- fcntl(sock, F_SETFL, flags);
+ fcntl(mysql_socket_getfd(sock), F_SETFL, flags);
#endif
- if (new_sock == INVALID_SOCKET)
+ if (mysql_socket_getfd(new_sock) == INVALID_SOCKET)
{
if ((error_count++ & 255) == 0) // This can happen often
- sql_perror("Error in accept");
+ sql_perror("Error in accept");
MAYBE_BROKEN_SYSCALL;
if (socket_errno == SOCKET_ENFILE || socket_errno == SOCKET_EMFILE)
- sleep(1); // Give other threads some time
+ sleep(1); // Give other threads some time
continue;
}
#ifdef HAVE_LIBWRAP
{
- if (sock == ip_sock)
+ if (mysql_socket_getfd(sock) == mysql_socket_getfd(ip_sock))
{
- struct request_info req;
- signal(SIGCHLD, SIG_DFL);
- request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, new_sock, NULL);
- my_fromhost(&req);
+ struct request_info req;
+ signal(SIGCHLD, SIG_DFL);
+ request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, mysql_socket_getfd(new_sock), NULL); //TBD cwp
+ my_fromhost(&req);
+
if (!my_hosts_access(&req))
{
/*
@@ -5458,10 +5461,10 @@ void handle_connections_sockets()
if (req.sink)
((void (*)(int))req.sink)(req.fd);
- (void) shutdown(new_sock, SHUT_RDWR);
- (void) closesocket(new_sock);
- continue;
- }
+ (void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
+ (void) mysql_socket_ closesocket(new_sock);
+ continue;
+ }
}
}
#endif /* HAVE_LIBWRAP */
@@ -5470,13 +5473,13 @@ void handle_connections_sockets()
size_socket dummyLen;
struct sockaddr_storage dummy;
dummyLen = sizeof(dummy);
- if ( getsockname(new_sock,(struct sockaddr *)&dummy,
+ if ( mysql_socket_getsockname(new_sock, (struct sockaddr *)&dummy,
(SOCKET_SIZE_TYPE *)&dummyLen) < 0 )
{
- sql_perror("Error on new connection socket");
- (void) shutdown(new_sock, SHUT_RDWR);
- (void) closesocket(new_sock);
- continue;
+ sql_perror("Error on new connection socket");
+ (void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
+ (void) mysql_socket_close(new_sock);
+ continue;
}
}
@@ -5486,15 +5489,15 @@ void handle_connections_sockets()
if (!(thd= new THD))
{
- (void) shutdown(new_sock, SHUT_RDWR);
- (void) closesocket(new_sock);
+ (void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
+ (void) mysql_socket_close(new_sock);
continue;
}
- if (!(vio_tmp=vio_new(new_sock,
- sock == unix_sock ? VIO_TYPE_SOCKET :
- VIO_TYPE_TCPIP,
- sock == unix_sock ? VIO_LOCALHOST: 0)) ||
- my_net_init(&thd->net,vio_tmp))
+ if (!(vio_tmp=mysql_socket_vio_new(new_sock,
+ mysql_socket_getfd(sock) == mysql_socket_getfd(unix_sock) ? VIO_TYPE_SOCKET :
+ VIO_TYPE_TCPIP,
+ mysql_socket_getfd(sock) == mysql_socket_getfd(unix_sock) ? VIO_LOCALHOST: 0)) ||
+ my_net_init(&thd->net,vio_tmp))
{
/*
Only delete the temporary vio if we didn't already attach it to the
@@ -5505,13 +5508,13 @@ void handle_connections_sockets()
vio_delete(vio_tmp);
else
{
- (void) shutdown(new_sock, SHUT_RDWR);
- (void) closesocket(new_sock);
+ (void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
+ (void) mysql_socket_close(new_sock);
}
delete thd;
continue;
}
- if (sock == unix_sock)
+ if (mysql_socket_getfd(sock) == mysql_socket_getfd(unix_sock))
thd->security_ctx->host=(char*) my_localhost;
create_new_thread(thd);
@@ -5880,7 +5883,7 @@ DYNAMIC_ARRAY all_options;
struct my_option my_long_options[]=
{
- {"help", '?', "Display this help and exit.",
+ {"help", '?', "Display this help and exit.",
&opt_help, &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
#ifdef HAVE_REPLICATION
@@ -6942,7 +6945,7 @@ static int mysql_init_variables(void)
character_set_filesystem= &my_charset_bin;
opt_specialflag= SPECIAL_ENGLISH;
- unix_sock= ip_sock= INVALID_SOCKET;
+ mysql_socket_getfd(unix_sock)= mysql_socket_getfd(ip_sock)= INVALID_SOCKET;
mysql_home_ptr= mysql_home;
pidfile_name_ptr= pidfile_name;
log_error_file_ptr= log_error_file;
@@ -8090,6 +8093,14 @@ static PSI_file_info all_server_files[]=
{ &key_file_init, "init", 0}
};
+PSI_socket_key key_socket_network_init, key_socket_handle_connection;
+
+static PSI_socket_info all_server_sockets[]=
+{
+ { &key_socket_network_init, "network_init", 0},
+ { &key_socket_handle_connection, "handle_connection", 0}
+};
+
/**
Initialise all the performance schema instrumentation points
used by the server.
=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h 2010-11-29 11:28:55 +0000
+++ b/sql/mysqld.h 2010-12-07 18:55:54 +0000
@@ -283,6 +283,7 @@ extern PSI_file_key key_file_binlog, key
key_file_pid, key_file_relay_log_info, key_file_send_file, key_file_tclog,
key_file_trg, key_file_trn, key_file_init;
extern PSI_file_key key_file_query_log, key_file_slow_log;
+extern PSI_socket_key key_socket_network_init, key_socket_handle_connection;
void init_server_psi_keys();
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'storage/perfschema/CMakeLists.txt'
--- a/storage/perfschema/CMakeLists.txt 2010-09-23 16:08:54 +0000
+++ b/storage/perfschema/CMakeLists.txt 2010-12-07 18:55:54 +0000
@@ -45,6 +45,7 @@ SET(PERFSCHEMA_SOURCES ha_perfschema.h
table_ews_global_by_event_name.h
table_file_instances.h
table_file_summary.h
+ table_socket_instances.h
table_helper.h
table_os_global_by_type.h
table_performance_timers.h
@@ -75,6 +76,7 @@ SET(PERFSCHEMA_SOURCES ha_perfschema.h
table_ews_global_by_event_name.cc
table_file_instances.cc
table_file_summary.cc
+ table_socket_instances.cc
table_helper.cc
table_os_global_by_type.cc
table_performance_timers.cc
=== modified file 'storage/perfschema/ha_perfschema.cc'
--- a/storage/perfschema/ha_perfschema.cc 2010-12-01 18:46:51 +0000
+++ b/storage/perfschema/ha_perfschema.cc 2010-12-07 18:55:54 +0000
@@ -138,6 +138,8 @@ static struct st_mysql_show_var pfs_stat
(char*) &file_lost, SHOW_LONG},
{"Performance_schema_file_handles_lost",
(char*) &file_handle_lost, SHOW_LONG},
+ {"Performance_schema_socket_instances_lost",
+ (char*) &socket_instances_lost, SHOW_LONG},
{"Performance_schema_locker_lost",
(char*) &locker_lost, SHOW_LONG},
/* table shares, can be flushed */
=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc 2010-10-25 14:43:00 +0000
+++ b/storage/perfschema/pfs.cc 2010-12-07 18:55:54 +0000
@@ -17,7 +17,7 @@
@file storage/perfschema/pfs.cc
The performance schema implementation of all instruments.
*/
-
+#include <arpa/inet.h>
#include "my_global.h"
#include "my_pthread.h"
#include "sql_const.h"
@@ -963,6 +963,24 @@ static enum_operation_type table_operati
OPERATION_TYPE_TABLE_DELETE_ROW
};
+/**
+ Conversion map from PSI_socket_operation to enum_operation_type.
+ Indexed by enum PSI_socket_operation.
+*/
+static enum_operation_type socket_operation_map[]=
+{
+ OPERATION_TYPE_SOCKETCREATE,
+ OPERATION_TYPE_SOCKETCONNECT,
+ OPERATION_TYPE_SOCKETBIND,
+ OPERATION_TYPE_SOCKETCLOSE,
+ OPERATION_TYPE_SOCKETSEND,
+ OPERATION_TYPE_SOCKETRECV,
+ OPERATION_TYPE_SOCKETSEEK,
+ OPERATION_TYPE_SOCKETOPT,
+ OPERATION_TYPE_SOCKETSTAT,
+ OPERATION_TYPE_SOCKETSHUTDOWN
+};
+
static void aggregate_table(PFS_table *pfs)
{
DBUG_ASSERT(pfs);
@@ -1118,6 +1136,16 @@ static void register_file_v1(const char
register_file_class)
}
+static void register_socket_v1(const char *category,
+ PSI_socket_info_v1 *info,
+ int count)
+{
+ REGISTER_BODY_V1(PSI_socket_key,
+ socket_instrument_prefix,
+ register_socket_class)
+}
+
+
#define INIT_BODY_V1(T, KEY, ID) \
PFS_##T##_class *klass; \
PFS_##T *pfs; \
@@ -1264,6 +1292,32 @@ static void close_table_v1(PSI_table *ta
destroy_table(pfs);
}
+static PSI_socket*
+init_socket_v1(PSI_socket_key key, const void *identity)
+{
+// INIT_BODY_V1(socket, key, identity);
+ PFS_socket_class *klass;
+ PFS_socket *pfs;
+ PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
+ if (unlikely(pfs_thread == NULL))
+ return NULL;
+ if (!pfs_thread->m_enabled)
+ return NULL;
+ klass= find_socket_class(key);
+ if (unlikely(klass == NULL))
+ return NULL;
+ if (!klass->m_enabled)
+ return NULL;
+ pfs= create_socket(klass, identity);
+ return reinterpret_cast<PSI_socket *> (pfs);
+}
+
+static void destroy_socket_v1(PSI_socket* socket)
+{
+ PFS_socket *pfs= reinterpret_cast<PFS_socket*> (socket);
+ destroy_socket(pfs);
+}
+
/**
Implementation of the file instrumentation interface.
@sa PSI_v1::create_file.
@@ -2321,6 +2375,102 @@ get_thread_file_descriptor_locker_v1(PSI
return reinterpret_cast<PSI_file_locker*> (state);
}
+/** Socket locker */
+
+static PSI_socket_locker*
+get_thread_socket_locker_v1(PSI_socket_locker_state *state,
+ PSI_socket *socket, PSI_socket_operation op)
+{
+ PFS_socket *pfs_socket= reinterpret_cast<PFS_socket*> (socket);
+
+ DBUG_ASSERT(static_cast<int> (op) >= 0);
+ DBUG_ASSERT(static_cast<uint> (op) < array_elements(socket_operation_map));
+ DBUG_ASSERT(state != NULL);
+ DBUG_ASSERT(pfs_socket != NULL);
+ DBUG_ASSERT(pfs_socket->m_class != NULL);
+
+ if (!flag_global_instrumentation)
+ return NULL;
+ if (!pfs_socket->m_class->m_enabled)
+ return NULL;
+ PFS_socket_class *klass= pfs_socket->m_class;
+ if (!klass->m_enabled)
+ return NULL;
+
+ register uint flags;
+
+ if (klass->m_timed)
+ state->m_flags= STATE_FLAG_TIMED;
+ else
+ state->m_flags= 0;
+
+ if (flag_thread_instrumentation)
+ {
+ PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
+
+ if (unlikely(pfs_thread == NULL))
+ return NULL;
+
+ if (! pfs_thread->m_enabled)
+ return NULL;
+
+ state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
+ flags= STATE_FLAG_THREAD;
+
+ if (klass->m_timed)
+ flags|= STATE_FLAG_TIMED;
+
+ if (flag_events_waits_current)
+ {
+ if (unlikely(pfs_thread->m_wait_waits_count >= WAIT_STACK_SIZE))
+ {
+ locker_lost++;
+ return NULL;
+ }
+ PFS_events_waits *wait= &pfs_thread->m_events_waits_stack[pfs_thread->m_events_waits_count];
+ state->m_wait= wait;
+ flags|= STATE_FLAG_WAIT;
+
+#ifdef HAVE_NESTED_EVENTS
+ wait->m_nesting_event_id= (wait - 1)->m_event_id;
+#endif
+ wait->m_thread= pfs_thread;
+ wait->m_class= klass;
+ wait->m_timer_start= 0;
+ wait->m_timer_end= 0;
+ wait->m_object_instance_addr= pfs_socket;
+ wait->m_object_name= pfs_socket->m_ip;
+ wait->m_object_name_length= pfs_socket->m_ip_length;
+ wait->m_event_id= pfs_thread->m_event_id++;
+ wait->m_operation= socket_operation_map[static_cast<int>(op)];
+ wait->m_wait_class= WAIT_CLASS_SOCKET;
+
+ pfs_thread->m_events_waits_count++;
+ }
+ }
+ else
+ {
+ if (klass->m_timed)
+ flags= STATE_FLAG_TIMED;
+ else
+ {
+ /*
+ Complete shortcut.
+ */
+ PFS_socket *pfs_socket= reinterpret_cast<PFS_socket *> (socket);
+ /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (counted) */
+ pfs_socket->m_wait_stat.aggregate_counted();
+ return NULL;
+ }
+ }
+
+ state->m_flags= flags;
+ state->m_socket= socket;
+ state->m_class= klass;
+ state->m_operation= op;
+ return reinterpret_cast<PSI_socket_locker*> (state);
+}
+
static void unlock_mutex_v1(PSI_mutex *mutex)
{
PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex*> (mutex);
@@ -3152,6 +3302,146 @@ static void end_file_wait_v1(PSI_file_lo
}
}
+/** Socket operations */
+
+static void start_socket_wait_v1(PSI_socket_locker *locker,
+ size_t count,
+ const char *src_file,
+ uint src_line);
+
+static void end_socket_wait_v1(PSI_socket_locker *locker, size_t count);
+
+static void start_socket_wait_v1(PSI_socket_locker *locker,
+ size_t count,
+ const char *src_file,
+ uint src_line)
+{
+ PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker);
+ DBUG_ASSERT(pfs_locker != NULL);
+
+ PFS_events_waits *wait=&pfs_locker->m_waits_current;
+ if (wait->m_timer_state == TIMER_STATE_STARTING)
+ {
+ wait->m_timer_start= get_timer_value(pfs_locker->m_timer_name);
+ wait->m_timer_state= TIMER_STATE_STARTED;
+ }
+ wait->m_source_file= src_file;
+ wait->m_source_line= src_line;
+ wait->m_number_of_bytes= count;
+}
+
+static void end_socket_wait_v1(PSI_socket_locker *locker, size_t count)
+{
+ PFS_wait_locker *pfs_locker= reinterpret_cast<PFS_wait_locker*> (locker);
+ DBUG_ASSERT(pfs_locker != NULL);
+ PFS_events_waits *wait= &pfs_locker->m_waits_current;
+
+ wait->m_number_of_bytes= count;
+ if (wait->m_timer_state == TIMER_STATE_STARTED)
+ {
+ wait->m_timer_end= get_timer_value(pfs_locker->m_timer_name);
+ wait->m_timer_state= TIMER_STATE_TIMED;
+ }
+ if (flag_events_waits_history)
+ insert_events_waits_history(wait->m_thread, wait);
+ if (flag_events_waits_history_long)
+ insert_events_waits_history_long(wait);
+
+ PFS_single_stat_chain *stat;
+ PFS_socket *socket= pfs_locker->m_target.m_socket;
+
+ ulonglong wait_time= wait->m_timer_end - wait->m_timer_start;
+ aggregate_single_stat_chain(&socket->m_wait_stat, wait_time);
+ stat= find_per_thread_socket_class_wait_stat(wait->m_thread,
+ socket->m_class);
+ aggregate_single_stat_chain(stat, wait_time);
+
+ PFS_socket_class *klass= socket->m_class;
+
+ switch(wait->m_operation)
+ {
+ case OPERATION_TYPE_SOCKETCREATE:
+ socket->m_socket_stat.m_open_count++;
+ klass->m_socket_stat.m_open_count++;
+ break;
+ case OPERATION_TYPE_SOCKETSEND:
+ socket->m_socket_stat.m_count_send++;
+ socket->m_socket_stat.m_send_bytes+= count;
+ klass->m_socket_stat.m_send_bytes+= count;
+ break;
+ case OPERATION_TYPE_SOCKETRECV:
+ socket->m_socket_stat.m_count_recv++;
+ socket->m_socket_stat.m_recv_bytes+= count;
+ klass->m_socket_stat.m_recv_bytes+= count;
+ break;
+ case OPERATION_TYPE_SOCKETCLOSE:
+ /** close() frees the file descriptor, shutdown() does not */
+ release_socket(pfs_locker->m_target.m_socket);
+ destroy_socket(pfs_locker->m_target.m_socket);
+ break;
+ case OPERATION_TYPE_SOCKETCONNECT:
+ case OPERATION_TYPE_SOCKETBIND:
+ case OPERATION_TYPE_SOCKETSTAT:
+ case OPERATION_TYPE_SOCKETOPT:
+ case OPERATION_TYPE_SOCKETSEEK:
+ case OPERATION_TYPE_SOCKETSHUTDOWN:
+ break;
+ default:
+ break;
+ }
+
+ wait->m_thread->m_wait_locker_count--;
+}
+
+static void set_socket_descriptor_v1(PSI_socket *socket, uint fd)
+{
+ DBUG_ASSERT(socket);
+ PFS_socket *pfs= reinterpret_cast<PFS_socket*>(socket);
+ pfs->m_fd= fd;
+}
+
+static void set_socket_address_v1(PSI_socket *socket,
+ const struct sockaddr * socket_addr)
+{
+ DBUG_ASSERT(socket);
+ PFS_socket *pfs= reinterpret_cast<PFS_socket*>(socket);
+
+ switch (socket_addr->sa_family)
+ {
+ case AF_INET:
+ {
+ struct sockaddr_in * sa4= (struct sockaddr_in *)(socket_addr);
+ pfs->m_ip_length= INET_ADDRSTRLEN;
+ inet_ntop(AF_INET, &(sa4->sin_addr), pfs->m_ip, pfs->m_ip_length);
+ pfs->m_port= ntohs(sa4->sin_port);
+ }
+ break;
+
+ case AF_INET6:
+ {
+ struct sockaddr_in6 * sa6= (struct sockaddr_in6 *)(socket_addr);
+ pfs->m_ip_length= INET6_ADDRSTRLEN;
+ inet_ntop(AF_INET6, &(sa6->sin6_addr), pfs->m_ip, pfs->m_ip_length);
+ pfs->m_port= ntohs(sa6->sin6_port);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+static void set_socket_info_v1(PSI_socket *socket,
+ uint fd,
+ const struct sockaddr * addr)
+{
+ DBUG_ASSERT(socket);
+ PFS_socket *pfs= reinterpret_cast<PFS_socket*>(socket);
+
+ pfs->m_fd= fd;
+ set_socket_address_v1(socket, addr);
+}
+
/**
Implementation of the instrumentation interface.
@sa PSI_v1.
@@ -3163,12 +3453,15 @@ PSI_v1 PFS_v1=
register_cond_v1,
register_thread_v1,
register_file_v1,
+ register_socket_v1,
init_mutex_v1,
destroy_mutex_v1,
init_rwlock_v1,
destroy_rwlock_v1,
init_cond_v1,
destroy_cond_v1,
+ init_socket_v1,
+ destroy_socket_v1,
get_table_share_v1,
release_table_share_v1,
drop_table_share_v1,
@@ -3196,6 +3489,7 @@ PSI_v1 PFS_v1=
get_thread_file_name_locker_v1,
get_thread_file_stream_locker_v1,
get_thread_file_descriptor_locker_v1,
+ get_thread_socket_locker_v1,
unlock_mutex_v1,
unlock_rwlock_v1,
signal_cond_v1,
@@ -3214,7 +3508,12 @@ PSI_v1 PFS_v1=
end_file_open_wait_v1,
end_file_open_wait_and_bind_to_descriptor_v1,
start_file_wait_v1,
- end_file_wait_v1
+ end_file_wait_v1,
+ start_socket_wait_v1,
+ end_socket_wait_v1,
+ set_socket_descriptor_v1,
+ set_socket_address_v1,
+ set_socket_info_v1
};
static void* get_interface(int version)
=== modified file 'storage/perfschema/pfs_column_types.h'
--- a/storage/perfschema/pfs_column_types.h 2010-07-23 17:08:41 +0000
+++ b/storage/perfschema/pfs_column_types.h 2010-12-07 18:55:54 +0000
@@ -116,10 +116,21 @@ enum enum_operation_type
OPERATION_TYPE_TABLE_FETCH= 28,
OPERATION_TYPE_TABLE_WRITE_ROW= 29,
OPERATION_TYPE_TABLE_UPDATE_ROW= 30,
- OPERATION_TYPE_TABLE_DELETE_ROW= 31
+ OPERATION_TYPE_TABLE_DELETE_ROW= 31,
+
+ OPERATION_TYPE_SOCKETCREATE = 32,
+ OPERATION_TYPE_SOCKETCONNECT = 33,
+ OPERATION_TYPE_SOCKETBIND = 34,
+ OPERATION_TYPE_SOCKETCLOSE = 35,
+ OPERATION_TYPE_SOCKETSEND = 36,
+ OPERATION_TYPE_SOCKETRECV = 37,
+ OPERATION_TYPE_SOCKETSEEK = 38,
+ OPERATION_TYPE_SOCKETOPT = 39,
+ OPERATION_TYPE_SOCKETSTAT = 40,
+ OPERATION_TYPE_SOCKETSHUTDOWN = 41
};
#define FIRST_OPERATION_TYPE (static_cast<int> (OPERATION_TYPE_LOCK))
-#define LAST_OPERATION_TYPE (static_cast<int> (OPERATION_TYPE_TABLE_DELETE_ROW))
+#define LAST_OPERATION_TYPE (static_cast<int> (OPERATION_TYPE_SOCKETSHUTDOWN)
#define COUNT_OPERATION_TYPE (LAST_OPERATION_TYPE - FIRST_OPERATION_TYPE + 1)
enum enum_object_type
=== modified file 'storage/perfschema/pfs_column_values.cc'
--- a/storage/perfschema/pfs_column_values.cc 2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/pfs_column_values.cc 2010-12-07 18:55:54 +0000
@@ -39,3 +39,5 @@ LEX_STRING thread_instrument_prefix=
LEX_STRING file_instrument_prefix=
{ C_STRING_WITH_LEN("wait/io/file/") };
+LEX_STRING socket_instrument_prefix=
+{ C_STRING_WITH_LEN("wait/io/socket/") };
=== modified file 'storage/perfschema/pfs_column_values.h'
--- a/storage/perfschema/pfs_column_values.h 2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/pfs_column_values.h 2010-12-07 18:55:54 +0000
@@ -31,6 +31,7 @@ extern LEX_STRING rwlock_instrument_pref
extern LEX_STRING cond_instrument_prefix;
extern LEX_STRING thread_instrument_prefix;
extern LEX_STRING file_instrument_prefix;
+extern LEX_STRING socket_instrument_prefix;
#endif
=== modified file 'storage/perfschema/pfs_engine_table.cc'
--- a/storage/perfschema/pfs_engine_table.cc 2010-12-02 15:05:07 +0000
+++ b/storage/perfschema/pfs_engine_table.cc 2010-12-07 18:55:54 +0000
@@ -35,6 +35,7 @@
#include "table_file_instances.h"
#include "table_file_summary.h"
#include "table_threads.h"
+#include "table_socket_instances.h"
/* For show status */
#include "pfs_column_values.h"
@@ -73,6 +74,7 @@ static PFS_engine_table_share *all_share
&table_setup_objects::m_share,
&table_setup_timers::m_share,
&table_threads::m_share,
+ &table_socket_instances::m_share,
NULL
};
@@ -896,11 +898,24 @@ bool pfs_show_status(handlerton *hton, T
size= max_instrument_class * sizeof(PFS_single_stat);
total_memory+= size;
break;
+ case 59:
+ name= "(PFS_SOCKET_CLASS).ROW_SIZE";
+ size= sizeof(PFS_socket_class);
+ break;
+ case 60:
+ name= "(PFS_SOCKET_CLASS).ROW_COUNT";
+ size= socket_class_max;
+ break;
+ case 61:
+ name= "(PFS_SOCKET_CLASS).MEMORY";
+ size= socket_class_max * sizeof(PFS_socket_class);
+ total_memory+= size;
+ break;
/*
This case must be last,
for aggregation in total_memory.
*/
- case 59:
+ case 62:
name= "PERFORMANCE_SCHEMA.MEMORY";
size= total_memory;
/* This will fail if something is not advertised here */
=== modified file 'storage/perfschema/pfs_events_waits.h'
--- a/storage/perfschema/pfs_events_waits.h 2010-09-23 16:08:54 +0000
+++ b/storage/perfschema/pfs_events_waits.h 2010-12-07 18:55:54 +0000
@@ -30,6 +30,7 @@ struct PFS_cond;
struct PFS_table;
struct PFS_file;
struct PFS_thread;
+struct PFS_socket;
struct PFS_instr_class;
/** Class of a wait event. */
@@ -40,7 +41,8 @@ enum events_waits_class
WAIT_CLASS_RWLOCK,
WAIT_CLASS_COND,
WAIT_CLASS_TABLE,
- WAIT_CLASS_FILE
+ WAIT_CLASS_FILE,
+ WAIT_CLASS_SOCKET
};
/** Target object a wait event is waiting on. */
@@ -56,6 +58,8 @@ union events_waits_target
PFS_table *m_table;
/** File waited on. */
PFS_file *m_file;
+ /** Socket waited on. */
+ PFS_socket *m_socket;
};
/** A wait event record. */
=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc 2010-12-02 16:38:55 +0000
+++ b/storage/perfschema/pfs_instr.cc 2010-12-07 18:55:54 +0000
@@ -64,6 +64,10 @@ ulong file_handle_lost;
ulong table_max;
/** Number of table instances lost. @sa table_array */
ulong table_lost;
+/** Size of the socket instances array. @sa socket_array */
+ulong socket_instances_max;
+/** Number of socket instances lost. @sa socket_array */
+ulong socket_instances_lost;
/** Number of EVENTS_WAITS_HISTORY records per thread. */
ulong events_waits_history_per_thread;
/** Number of locker lost. @sa LOCKER_STACK_SIZE. */
@@ -119,6 +123,13 @@ PFS_file **file_handle_array= NULL;
*/
PFS_table *table_array= NULL;
+/**
+ Socket instrumentation instances array.
+ @sa socket_instances_max
+ @sa socket_instances_lost
+*/
+PFS_socket *socket_array= NULL;
+
PFS_single_stat *global_instr_class_waits_array= NULL;
static volatile uint32 thread_internal_id_counter= 0;
@@ -164,6 +175,8 @@ int init_instruments(const PFS_global_pa
table_lost= 0;
thread_max= param->m_thread_sizing;
thread_lost= 0;
+ socket_instances_max= param->m_socket_sizing;
+ socket_instances_lost= 0;
events_waits_history_per_thread= param->m_events_waits_history_sizing;
thread_history_sizing= param->m_thread_sizing
@@ -178,6 +191,7 @@ int init_instruments(const PFS_global_pa
file_array= NULL;
file_handle_array= NULL;
table_array= NULL;
+ socket_array= NULL;
thread_array= NULL;
thread_history_array= NULL;
thread_instr_class_waits_array= NULL;
@@ -225,6 +239,13 @@ int init_instruments(const PFS_global_pa
return 1;
}
+ if (socket_instances_max > 0)
+ {
+ socket_array= PFS_MALLOC_ARRAY(socket_instances_max, PFS_socket, MYF(MY_ZEROFILL));
+ if (unlikely(socket_array == NULL))
+ return 1;
+ }
+
if (thread_max > 0)
{
thread_array= PFS_MALLOC_ARRAY(thread_max, PFS_thread, MYF(MY_ZEROFILL));
@@ -310,6 +331,9 @@ void cleanup_instruments(void)
pfs_free(table_array);
table_array= NULL;
table_max= 0;
+ pfs_free(socket_array);
+ socket_array= NULL;
+ socket_instances_max= 0;
pfs_free(thread_array);
thread_array= NULL;
thread_max= 0;
@@ -1045,6 +1069,65 @@ void destroy_table(PFS_table *pfs)
pfs->m_lock.allocated_to_free();
}
+/**
+ Create instrumentation for a socket instance.
+ @param klass the socket class
+ @param identity the socket address
+ @return a socket instance, or NULL
+*/
+PFS_socket* create_socket(PFS_socket_class *klass, const void *identity)
+{
+ PFS_scan scan;
+ uint random= randomized_index(identity, socket_instances_max);
+
+ for (scan.init(random, socket_instances_max);
+ scan.has_pass();
+ scan.next_pass())
+ {
+ PFS_socket *pfs= socket_array + scan.first();
+ PFS_socket *pfs_last= socket_array + scan.last();
+ for ( ; pfs < pfs_last; pfs++)
+ {
+ if (pfs->m_lock.is_free())
+ {
+ if (pfs->m_lock.free_to_dirty())
+ {
+ pfs->m_identity= identity;
+ pfs->m_class= klass;
+ pfs->m_wait_stat.reset();
+ // TBD socket_io_stat
+ pfs->m_lock.dirty_to_allocated();
+ return pfs;
+ }
+ }
+ }
+ }
+
+ socket_instances_lost++;
+ return NULL;
+}
+
+/**
+ Release instrumentation for a socket instance.
+ @param pfs the socket to release
+*/
+void release_socket(PFS_socket *pfs)
+{
+ DBUG_ASSERT(pfs != NULL);
+ pfs->m_socket_stat.m_open_count--;
+}
+
+/**
+ Destroy instrumentation for a socket instance.
+ @param pfs the socket to destroy
+*/
+void destroy_socket(PFS_socket *pfs)
+{
+ DBUG_ASSERT(pfs != NULL);
+ // TBD aggregate
+ pfs->m_lock.allocated_to_free();
+}
+
static void reset_mutex_waits_by_instance(void)
{
PFS_mutex *pfs= mutex_array;
@@ -1081,6 +1164,15 @@ static void reset_file_waits_by_instance
pfs->m_wait_stat.reset();
}
+static void reset_socket_waits_by_instance(void)
+{
+ PFS_socket *pfs= socket_array;
+ PFS_socket *pfs_last= socket_array + sockets_max;
+
+ for ( ; pfs < pfs_last; pfs++)
+ pfs->m_wait_stat.reset();
+}
+
/** Reset the wait statistics per object instance. */
void reset_events_waits_by_instance(void)
{
@@ -1088,6 +1180,7 @@ void reset_events_waits_by_instance(void
reset_rwlock_waits_by_instance();
reset_cond_waits_by_instance();
reset_file_waits_by_instance();
+ reset_socket_waits_by_instance();
}
/** Reset the io statistics per file instance. */
=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h 2010-12-02 15:05:07 +0000
+++ b/storage/perfschema/pfs_instr.h 2010-12-07 18:55:54 +0000
@@ -27,7 +27,9 @@ struct PFS_cond_class;
struct PFS_file_class;
struct PFS_table_share;
struct PFS_thread_class;
+struct PFS_socket_class;
+#include <netinet/in.h>
#include "pfs_lock.h"
#include "pfs_stat.h"
#include "pfs_instr_class.h"
@@ -143,6 +145,25 @@ struct PFS_table
PFS_table_stat m_table_stat;
};
+/** Instrumented socket implementation. @see PSI_socket. */
+struct PFS_socket : public PFS_instr
+{
+ /** Socket identity, typically int */
+ const void *m_identity;
+ /** Socket file descriptor */
+ uint m_fd;
+ /** Socket ip address, IPV4 or IPV6 */
+ char m_ip[INET6_ADDRSTRLEN];
+ /** Socket ip address length in bytes */
+ uint m_ip_length;
+ /** Socket ip port */
+ uint m_port;
+ /** Socket class. */
+ PFS_socket_class *m_class;
+ /** Socket usage statistics. */
+ PFS_socket_stat m_socket_stat;
+};
+
/**
@def WAIT_STACK_SIZE
Maximum number of nested waits.
@@ -176,7 +197,7 @@ public:
void next_pass()
{ m_pass++; }
-
+
uint first() const
{ return m_first[m_pass]; }
@@ -307,6 +328,10 @@ PFS_table* create_table(PFS_table_share
const void *identity);
void destroy_table(PFS_table *pfs);
+PFS_socket* create_socket(PFS_socket_class *socket_class, const void *identity);
+void release_socket(PFS_socket *pfs);
+void destroy_socket(PFS_socket *pfs);
+
/* For iterators and show status. */
extern ulong mutex_max;
@@ -323,6 +348,8 @@ extern long file_handle_max;
extern ulong file_handle_lost;
extern ulong table_max;
extern ulong table_lost;
+extern ulong socket_instances_max;
+extern ulong socket_instances_lost;
extern ulong events_waits_history_per_thread;
extern ulong locker_lost;
@@ -335,6 +362,7 @@ extern PFS_thread *thread_array;
extern PFS_file *file_array;
extern PFS_file **file_handle_array;
extern PFS_table *table_array;
+extern PFS_socket *socket_array;
void reset_events_waits_by_instance();
void reset_per_thread_wait_stat();
=== modified file 'storage/perfschema/pfs_instr_class.cc'
--- a/storage/perfschema/pfs_instr_class.cc 2010-12-02 15:05:07 +0000
+++ b/storage/perfschema/pfs_instr_class.cc 2010-12-07 18:55:54 +0000
@@ -83,6 +83,10 @@ ulong file_class_lost= 0;
ulong table_share_max= 0;
/** Number of table share lost. @sa table_share_array */
ulong table_share_lost= 0;
+/** Size of the socket class array. @sa socket_class_array */
+ulong socket_class_max= 0;
+/** Number of socket class lost. @sa socket_class_array */
+ulong socket_class_lost= 0;
static PFS_mutex_class *mutex_class_array= NULL;
static PFS_rwlock_class *rwlock_class_array= NULL;
@@ -132,11 +136,17 @@ static volatile uint32 file_class_alloca
static PFS_file_class *file_class_array= NULL;
+static volatile uint32 socket_class_dirty_count= 0;
+static volatile uint32 socket_class_allocated_count= 0;
+
+static PFS_socket_class *socket_class_array= NULL;
+
uint mutex_class_start= 0;
uint rwlock_class_start= 0;
uint cond_class_start= 0;
uint file_class_start= 0;
uint table_class_start= 0;
+uint socket_class_start= 0;
uint max_instrument_class= 0;
void init_event_name_sizing(const PFS_global_param *param)
@@ -146,7 +156,8 @@ void init_event_name_sizing(const PFS_gl
cond_class_start= rwlock_class_start + param->m_rwlock_class_sizing;
file_class_start= cond_class_start + param->m_cond_class_sizing;
table_class_start= file_class_start + param->m_file_class_sizing;
- max_instrument_class= table_class_start + 1; /* global table io */
+ socket_class_start= table_class_start + param->m_table_class_sizing;
+ max_instrument_class= socket_class_start + 1; /* global table io */
memcpy(global_table_io_class.m_name, "wait/io/table/sql/handler", 25);
global_table_io_class.m_name_length= 25;
@@ -416,6 +427,39 @@ void cleanup_file_class(void)
file_class_max= 0;
}
+/**
+ Initialize the socket class buffer.
+ @param socket_class_sizing max number of socket class
+ @return 0 on success
+*/
+int init_socket_class(uint socket_class_sizing)
+{
+ int result= 0;
+ socket_class_dirty_count= socket_class_allocated_count= 0;
+ socket_class_max= socket_class_sizing;
+ socket_class_lost= 0;
+
+ if (socket_class_max > 0)
+ {
+ socket_class_array= PFS_MALLOC_ARRAY(socket_class_max, PFS_socket_class, MYF(MY_ZEROFILL));
+ if (unlikely(socket_class_array == NULL))
+ return 1;
+ }
+ else
+ socket_class_array= NULL;
+
+ return result;
+}
+
+/** Cleanup the socket class buffers. */
+void cleanup_socket_class(void)
+{
+ pfs_free(socket_class_array);
+ socket_class_array= NULL;
+ socket_class_dirty_count= socket_class_allocated_count= 0;
+ socket_class_max= 0;
+}
+
static void init_instr_class(PFS_instr_class *klass,
const char *name,
uint name_length,
@@ -752,6 +796,67 @@ PFS_file_class *find_file_class(PFS_file
PFS_file_class *sanitize_file_class(PFS_file_class *unsafe)
{
SANITIZE_ARRAY_BODY(PFS_file_class, file_class_array, file_class_max, unsafe);
+
+/**
+ Register a socket instrumentation metadata.
+ @param name the instrumented name
+ @param name_length length in bytes of name
+ @param flags the instrumentation flags
+ @return a socket instrumentation key
+*/
+PFS_socket_key register_socket_class(const char *name, uint name_length,
+ int flags)
+{
+ /* See comments in register_mutex_class */
+ uint32 index;
+ PFS_socket_class *entry;
+
+// TBD REGISTER_CLASS_BODY_PART(index, socket_class_array, socket_class_max, name, name_length)
+
+ for (index= 0; index < socket_class_max; index++)
+ {
+ entry= &socket_class_array[index];
+ if ((entry->m_name_length == name_length) &&
+ (strncmp(entry->m_name, name, name_length) == 0))
+ {
+ DBUG_ASSERT(entry->m_flags == flags);
+ return (index + 1);
+ }
+ }
+
+ index= PFS_atomic::add_u32(&socket_class_dirty_count, 1);
+
+ if (index < socket_class_max)
+ {
+ entry= &socket_class_array[index];
+ init_instr_class(entry, name, name_length, flags);
+ entry->m_index= index;
+ entry->m_event_name_index= file_class_start + index;
+ entry->m_singleton- NULL;
+ PFS_atomic::add_u32(&socket_class_allocated_count, 1);
+ return (index + 1);
+ }
+
+ socket_class_lost++;
+ return 0;
+}
+
+/**
+ Find a socket instrumentation class by key.
+ @param key the instrument key
+ @return the instrument class, or NULL
+*/
+PFS_socket_class *find_socket_class(PFS_socket_key key)
+{
+// FIND_CLASS_BODY(key, socket_class_allocated_count, socket_class_array);
+ if ((key == 0) || (key > socket_class_allocated_count))
+ return NULL;
+ return &socket_class_array[key - 1];
+}
+
+PFS_socket_class *sanitize_socket_class(PFS_socket_class *unsafe)
+{
+ SANITIZE_ARRAY_BODY(socket_class_array, socket_class_max, unsafe);
}
PFS_instr_class *find_table_class(uint index)
=== modified file 'storage/perfschema/pfs_instr_class.h'
--- a/storage/perfschema/pfs_instr_class.h 2010-12-02 15:05:07 +0000
+++ b/storage/perfschema/pfs_instr_class.h 2010-12-07 18:55:54 +0000
@@ -59,6 +59,8 @@ typedef unsigned int PFS_sync_key;
typedef unsigned int PFS_thread_key;
/** Key, naming a file instrument. */
typedef unsigned int PFS_file_key;
+/** Key, naming a socket instrument. */
+typedef unsigned int PFS_socket_key;
struct PFS_thread;
@@ -67,6 +69,7 @@ extern uint rwlock_class_start;
extern uint cond_class_start;
extern uint file_class_start;
extern uint table_class_start;
+extern uint socket_class_start;
extern uint max_instrument_class;
/** Information for all instrumentation. */
@@ -278,6 +281,8 @@ int init_table_share_hash();
void cleanup_table_share_hash();
int init_file_class(uint file_class_sizing);
void cleanup_file_class();
+int init_socket_class(uint socket_class_sizing);
+void cleanup_socket_class();
PFS_sync_key register_mutex_class(const char *name, uint name_length,
int flags);
@@ -294,6 +299,9 @@ PFS_thread_key register_thread_class(con
PFS_file_key register_file_class(const char *name, uint name_length,
int flags);
+PFS_socket_key register_socket_class(const char *name, uint name_length,
+ int flags);
+
PFS_mutex_class *find_mutex_class(PSI_mutex_key key);
PFS_mutex_class *sanitize_mutex_class(PFS_mutex_class *unsafe);
PFS_rwlock_class *find_rwlock_class(PSI_rwlock_key key);
@@ -308,6 +316,8 @@ const char *sanitize_table_schema_name(c
const char *sanitize_table_object_name(const char *unsafe);
PFS_instr_class *find_table_class(uint index);
PFS_instr_class *sanitize_table_class(PFS_instr_class *unsafe);
+PFS_socket_class *find_socket_class(PSI_socket_key key);
+PFS_socket_class *sanitize_socket_class(PFS_socket_class *unsafe);
PFS_table_share *find_or_create_table_share(PFS_thread *thread,
bool temporary,
@@ -331,6 +341,7 @@ extern ulong thread_class_max;
extern ulong thread_class_lost;
extern ulong file_class_max;
extern ulong file_class_lost;
+extern ulong socket_class_max;
extern ulong table_share_max;
extern ulong table_share_lost;
extern PFS_table_share *table_share_array;
=== modified file 'storage/perfschema/pfs_server.h'
--- a/storage/perfschema/pfs_server.h 2010-09-23 16:08:54 +0000
+++ b/storage/perfschema/pfs_server.h 2010-12-07 18:55:54 +0000
@@ -54,6 +54,12 @@
#ifndef PFS_MAX_FILE_HANDLE
#define PFS_MAX_FILE_HANDLE 32768
#endif
+#ifndef PFS_MAX_SOCKETS
+ #define PFS_MAX_SOCKETS 10000
+#endif
+#ifndef PFS_MAX_SOCKET_CLASS
+ #define PFS_MAX_SOCKET_CLASS 50
+#endif
#ifndef PFS_MAX_TABLE_SHARE
#define PFS_MAX_TABLE_SHARE 1000
#endif
@@ -98,6 +104,8 @@ struct PFS_global_param
ulong m_table_sizing;
ulong m_file_sizing;
ulong m_file_handle_sizing;
+ ulong m_socket_sizing;
+ ulong m_socket_class_sizing;
ulong m_events_waits_history_sizing;
ulong m_events_waits_history_long_sizing;
ulong m_setup_actor_sizing;
=== modified file 'storage/perfschema/pfs_stat.h'
--- a/storage/perfschema/pfs_stat.h 2010-09-23 16:08:54 +0000
+++ b/storage/perfschema/pfs_stat.h 2010-12-07 18:55:54 +0000
@@ -222,6 +222,66 @@ struct PFS_table_stat
}
};
+/** Statistics for SOCKET usage. */
+struct PFS_socket_stat
+{
+ /** Number of current open sockets. */
+ ulong m_open_count;
+ /** Count of RECV operations. */
+ ulonglong m_count_recv;
+ /** Count of SEND operations. */
+ ulonglong m_count_send;
+ /** Number of bytes received. */
+ ulonglong m_recv_bytes;
+ /** Number of bytes sent. */
+ ulonglong m_send_bytes;
+
+ /** Reset socket statistics. */
+ inline void reset(void)
+ {
+ m_open_count= 0;
+ m_count_recv= 0;
+ m_count_send= 0;
+ m_count_recv_bytes= 0;
+ m_count_send_bytes= 0;
+ }
+
+ inline void aggregate(const PFS_file_io_stat *stat)
+ {
+ m_count_read+= stat->m_count_read;
+ m_count_write+= stat->m_count_write;
+ m_read_bytes+= stat->m_read_bytes;
+ m_write_bytes+= stat->m_write_bytes;
+ }
+
+ inline void aggregate_recv(ulonglong bytes)
+ {
+ m_count_recv++;
+ m_recv_bytes+= bytes;
+ }
+
+ inline void aggregate_send(ulonglong bytes)
+ {
+ m_count_send++;
+ m_send_bytes+= bytes;
+ }
+
+};
+
+/**
+ Reset socket statistic.
+ @param stat the statistics to reset
+*/
+inline void reset_socket_stat(PFS_socket_stat *stat)
+{
+ stat->m_open_count= 0;
+ stat->m_count_recv= 0;
+ stat->m_count_send= 0;
+ stat->m_recv_bytes= 0;
+ stat->m_send_bytes= 0;
+}
+
+
/** @} */
#endif
=== modified file 'storage/perfschema/table_all_instr.cc'
--- a/storage/perfschema/table_all_instr.cc 2010-09-23 16:08:54 +0000
+++ b/storage/perfschema/table_all_instr.cc 2010-12-07 18:55:54 +0000
@@ -40,6 +40,7 @@ int table_all_instr::rnd_next(void)
PFS_rwlock *rwlock;
PFS_cond *cond;
PFS_file *file;
+ PFS_socket *socket;
for (m_pos.set_at(&m_next_pos);
m_pos.has_more_view();
@@ -94,6 +95,18 @@ int table_all_instr::rnd_next(void)
}
}
break;
+ case pos_all_instr::VIEW_SOCKET:
+ for ( ; m_pos.m_index_2 < socket_instances_max; m_pos.m_index_2++)
+ {
+ socket= &socket_array[m_pos.m_index_2];
+ if (socket->m_lock.is_populated())
+ {
+ make_socket_row(socket);
+ m_next_pos.set_after(&m_pos);
+ return 0;
+ }
+ }
+ break;
}
}
@@ -106,6 +119,7 @@ int table_all_instr::rnd_pos(const void
PFS_rwlock *rwlock;
PFS_cond *cond;
PFS_file *file;
+ PFS_socket *socket;
set_position(pos);
@@ -146,8 +160,16 @@ int table_all_instr::rnd_pos(const void
return 0;
}
break;
+ case pos_all_instr::VIEW_SOCKET:
+ DBUG_ASSERT(m_pos.m_index_2 < socket_instances_max);
+ socket= &socket_array[m_pos.m_index_2];
+ if (socket->m_lock.is_populated())
+ {
+ make_socket_row(socket);
+ return 0;
+ }
+ break;
}
return HA_ERR_RECORD_DELETED;
}
-
=== modified file 'storage/perfschema/table_all_instr.h'
--- a/storage/perfschema/table_all_instr.h 2010-09-23 16:08:54 +0000
+++ b/storage/perfschema/table_all_instr.h 2010-12-07 18:55:54 +0000
@@ -98,6 +98,11 @@ protected:
@param pfs the file instance
*/
virtual void make_file_row(PFS_file *pfs)= 0;
+ /**
+ Build a row in the socket instance view.
+ @param pfs the socket instance
+ */
+ virtual void make_socket_row(PFS_socket *pfs)= 0;
/** Current position. */
pos_all_instr m_pos;
=== modified file 'storage/perfschema/table_events_waits.cc'
--- a/storage/perfschema/table_events_waits.cc 2010-12-02 15:05:07 +0000
+++ b/storage/perfschema/table_events_waits.cc 2010-12-07 18:55:54 +0000
@@ -395,7 +395,19 @@ static const LEX_STRING operation_names_
{ C_STRING_WITH_LEN("fetch") },
{ C_STRING_WITH_LEN("insert") }, /* write row */
{ C_STRING_WITH_LEN("update") }, /* update row */
- { C_STRING_WITH_LEN("delete") } /* delete row */
+ { C_STRING_WITH_LEN("delete") }, /* delete row */
+
+ /* Socket operations */
+ { C_STRING_WITH_LEN("create") },
+ { C_STRING_WITH_LEN("connect") },
+ { C_STRING_WITH_LEN("bind") },
+ { C_STRING_WITH_LEN("close") },
+ { C_STRING_WITH_LEN("send") },
+ { C_STRING_WITH_LEN("receive") },
+ { C_STRING_WITH_LEN("seek") },
+ { C_STRING_WITH_LEN("opt") },
+ { C_STRING_WITH_LEN("stat") },
+ { C_STRING_WITH_LEN("shutdown") }
};
=== modified file 'storage/perfschema/table_events_waits_summary.cc'
--- a/storage/perfschema/table_events_waits_summary.cc 2010-11-15 07:40:07 +0000
+++ b/storage/perfschema/table_events_waits_summary.cc 2010-12-07 18:55:54 +0000
@@ -188,6 +188,24 @@ void table_events_waits_summary_by_insta
make_instr_row(pfs, safe_class, pfs);
}
+/**
+ Build a row, for socket statistics in a thread.
+ @param pfs the socket this cursor is reading
+*/
+void table_events_waits_summary_by_instance::make_socket_row(PFS_socket *pfs)
+{
+ PFS_socket_class *safe_class;
+ safe_class= sanitize_socket_class(pfs->m_class);
+ if (unlikely(safe_class == NULL))
+ return;
+
+ /*
+ Files don't have a in memory structure associated to it,
+ so we use the address of the PFS_socket buffer as object_instance_begin
+ */
+ make_instr_row(pfs, safe_class, pfs);
+}
+
int table_events_waits_summary_by_instance
::read_row_values(TABLE *table, unsigned char *, Field **fields,
bool read_all)
=== modified file 'storage/perfschema/table_events_waits_summary.h'
--- a/storage/perfschema/table_events_waits_summary.h 2010-09-23 16:08:54 +0000
+++ b/storage/perfschema/table_events_waits_summary.h 2010-12-07 18:55:54 +0000
@@ -62,6 +62,7 @@ protected:
virtual void make_rwlock_row(PFS_rwlock *pfs);
virtual void make_cond_row(PFS_cond *pfs);
virtual void make_file_row(PFS_file *pfs);
+ virtual void make_socket_row(PFS_socket *pfs);
virtual int read_row_values(TABLE *table,
unsigned char *buf,
=== modified file 'storage/perfschema/table_helper.h'
--- a/storage/perfschema/table_helper.h 2010-09-24 18:21:22 +0000
+++ b/storage/perfschema/table_helper.h 2010-12-07 18:55:54 +0000
@@ -38,7 +38,8 @@ struct PFS_instrument_view_constants
static const uint VIEW_COND= 3;
static const uint VIEW_FILE= 4;
static const uint VIEW_TABLE= 5;
- static const uint LAST_VIEW= 5;
+ static const uint VIEW_SOCKET= 6;
+ static const uint LAST_VIEW= 6;
};
struct PFS_object_view_constants
=== modified file 'storage/perfschema/table_setup_instruments.cc'
--- a/storage/perfschema/table_setup_instruments.cc 2010-12-02 15:05:07 +0000
+++ b/storage/perfschema/table_setup_instruments.cc 2010-12-07 18:55:54 +0000
@@ -89,7 +89,7 @@ int table_setup_instruments::rnd_next(vo
PFS_rwlock_class *rwlock_class;
PFS_cond_class *cond_class;
PFS_file_class *file_class;
- PFS_instr_class *table_class;
+ PFS_socket_class *socket_class;
for (m_pos.set_at(&m_next_pos);
m_pos.has_more_view();
@@ -135,6 +135,15 @@ int table_setup_instruments::rnd_next(vo
return 0;
}
break;
+ case pos_setup_instruments::VIEW_SOCKET:
+ socket_class= find_socket_class(m_pos.m_index_2);
+ if (socket_class)
+ {
+ make_row(socket_class);
+ m_next_pos.set_after(&m_pos);
+ return 0;
+ }
+ break;
case pos_setup_instruments::VIEW_TABLE:
table_class= find_table_class(m_pos.m_index_2);
if (table_class)
@@ -157,7 +166,7 @@ int table_setup_instruments::rnd_pos(con
PFS_cond_class *cond_class;
PFS_file_class *file_class;
PFS_instr_class *table_class;
-
+ PFS_socket_class *socket_class;
set_position(pos);
switch (m_pos.m_index_1) {
@@ -196,6 +205,14 @@ int table_setup_instruments::rnd_pos(con
return 0;
}
break;
+ case pos_setup_instruments::VIEW_SOCKET:
+ socket_class= find_socket_class(m_pos.m_index_2);
+ if (socket_class)
+ {
+ make_row(socket_class);
+ return 0;
+ }
+ break;
case pos_setup_instruments::VIEW_TABLE:
table_class= find_table_class(m_pos.m_index_2);
if (table_class)
=== modified file 'vio/vio.c'
--- a/vio/vio.c 2010-08-16 12:50:27 +0000
+++ b/vio/vio.c 2010-12-07 18:55:54 +0000
@@ -165,6 +165,10 @@ static void vio_init(Vio* vio, enum enum
vio->is_connected =vio_is_connected;
vio->has_data= (flags & VIO_BUFFERED_READ) ?
vio_buff_has_data : has_no_data;
+#ifdef HAVE_PSI_INTERFACE
+ vio->mysql_socket.fd= sd; // TBDs
+ vio->mysql_socket.m_psi= NULL;
+#endif
DBUG_VOID_RETURN;
}
@@ -178,6 +182,17 @@ void vio_reset(Vio* vio, enum enum_vio_t
vio_init(vio, type, sd, hPipe, flags);
}
+Vio *mysql_socket_vio_new(MYSQL_SOCKET mysql_socket, enum enum_vio_type type, uint flags)
+{
+ Vio *vio = vio_new(mysql_socket_getfd(mysql_socket), type, flags);
+
+ if (vio)
+ {
+ vio->mysql_socket= mysql_socket;
+ }
+
+ return (vio);
+}
/* Open the socket or TCP/IP connection and read the fnctl() status */
=== modified file 'vio/viosocket.c'
--- a/vio/viosocket.c 2010-08-16 12:50:27 +0000
+++ b/vio/viosocket.c 2010-12-07 18:55:54 +0000
@@ -28,12 +28,15 @@ int vio_errno(Vio *vio __attribute__((un
}
-size_t vio_read(Vio * vio, uchar* buf, size_t size)
+size_t vio_read(Vio* vio, uchar* buf, size_t size)
{
size_t r;
+ size_t bytes_read= 0;
+ MYSQL_SOCKET_WAIT_VARIABLES(locker, state) /* no ';' */
DBUG_ENTER("vio_read");
DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %u", vio->sd, (long) buf,
- (uint) size));
+ (uint) size));
+ MYSQL_START_SOCKET_WAIT(locker, &state, vio->mysql_socket.m_psi, PSI_SOCKET_RECV, 0);
/* Ensure nobody uses vio_read_buff and vio_read simultaneously */
DBUG_ASSERT(vio->read_end == vio->read_pos);
@@ -43,12 +46,19 @@ size_t vio_read(Vio * vio, uchar* buf, s
errno=0; /* For linux */
r = read(vio->sd, buf, size);
#endif /* __WIN__ */
+
+#ifdef HAVE_PSI_INTERFACE
+ bytes_read= (r != (size_t)-1) ? r : 0;
+#endif
+ MYSQL_END_SOCKET_WAIT(locker, bytes_read);
+
#ifndef DBUG_OFF
if (r == (size_t) -1)
{
DBUG_PRINT("vio_error", ("Got error %d during read",errno));
}
#endif /* DBUG_OFF */
+
DBUG_PRINT("exit", ("%ld", (long) r));
DBUG_RETURN(r);
}
@@ -106,14 +116,24 @@ my_bool vio_buff_has_data(Vio *vio)
size_t vio_write(Vio * vio, const uchar* buf, size_t size)
{
size_t r;
+ size_t bytes_written= 0;
+ MYSQL_SOCKET_WAIT_VARIABLES(locker, state) /* no ';' */
DBUG_ENTER("vio_write");
DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %u", vio->sd, (long) buf,
(uint) size));
+ MYSQL_START_SOCKET_WAIT(locker, &state, vio->mysql_socket.m_psi, PSI_SOCKET_SEND, 0);
+
#ifdef __WIN__
r = send(vio->sd, buf, size,0);
#else
r = write(vio->sd, buf, size);
#endif /* __WIN__ */
+
+#ifdef HAVE_PSI_INTERFACE
+ bytes_written= (r != (size_t)-1) ? r : 0;
+#endif
+MYSQL_END_SOCKET_WAIT(locker, bytes_written);
+
#ifndef DBUG_OFF
if (r == (size_t) -1)
{
@@ -158,7 +178,7 @@ int vio_blocking(Vio * vio __attribute__
#endif /* !defined(NO_FCNTL_NONBLOCK) */
#else /* !defined(__WIN__) */
if (vio->type != VIO_TYPE_NAMEDPIPE && vio->type != VIO_TYPE_SHARED_MEMORY)
- {
+ {
ulong arg;
int old_fcntl=vio->fcntl_mode;
if (set_blocking_mode)
@@ -192,7 +212,7 @@ vio_is_blocking(Vio * vio)
}
-int vio_fastsend(Vio * vio __attribute__((unused)))
+int vio_fastsend(Vio* vio __attribute__((unused)))
{
int r=0;
DBUG_ENTER("vio_fastsend");
@@ -739,7 +759,7 @@ static size_t pipe_complete_io(Vio* vio,
if (!GetOverlappedResult(vio->hPipe,&(vio->pipe_overlapped),&length, FALSE))
{
- DBUG_PRINT("error",("GetOverlappedResult() returned last error %d",
+ DBUG_PRINT("error",("GetOverlappedResult() returned last error %d",
GetLastError()));
DBUG_RETURN((size_t)-1);
}
@@ -785,7 +805,7 @@ size_t vio_write_pipe(Vio * vio, const u
DBUG_PRINT("enter", ("sd: %d buf: 0x%lx size: %u", vio->sd, (long) buf,
(uint) size));
- if (WriteFile(vio->hPipe, buf, (DWORD)size, &bytes_written,
+ if (WriteFile(vio->hPipe, buf, (DWORD)size, &bytes_written,
&(vio->pipe_overlapped)))
{
retval= bytes_written;
@@ -839,7 +859,7 @@ void vio_win32_timeout(Vio *vio, uint wh
{
DWORD timeout_ms;
/*
- Windows is measuring timeouts in milliseconds. Check for possible int
+ Windows is measuring timeouts in milliseconds. Check for possible int
overflow.
*/
if (timeout_sec > UINT_MAX/1000)
@@ -991,7 +1011,7 @@ int vio_close_shared_memory(Vio * vio)
Close all handlers. UnmapViewOfFile and CloseHandle return non-zero
result if they are success.
*/
- if (UnmapViewOfFile(vio->handle_map) == 0)
+ if (UnmapViewOfFile(vio->handle_map) == 0)
{
error_count++;
DBUG_PRINT("vio_error", ("UnmapViewOfFile() failed"));
Attachment: [text/bzr-bundle] bzr/chris.powers@oracle.com-20101207185554-9l7lxv5inoxu0f2f.bundle
| Thread |
|---|
| • bzr push into mysql-trunk-wl4896 branch (chris.powers:3209 to 3210) WL#4896 | Christopher Powers | 8 Dec |