List:Commits« Previous MessageNext Message »
From:Marc Alff Date:November 4 2011 11:30pm
Subject:bzr push into mysql-trunk-pfs-tuning branch (marc.alff:3432 to 3433)
View as plain text  
 3433 Marc Alff	2011-11-04
      Performance tuning, continued

    modified:
      include/mysql/psi/psi.h
      sql/sql_class.h
      storage/innobase/include/os0sync.ic
      storage/innobase/include/sync0rw.ic
      storage/innobase/include/sync0sync.ic
      storage/perfschema/pfs.cc
      storage/perfschema/unittest/pfs_benchmark-t.cc
 3432 Marc Alff	2011-11-04 [merge]
      Merge mysql-trunk --> mysql-trunk-pfs-tuning
      
      Revisited instrumentation in psi

    removed:
      BUILD/compile-alpha-debug
      BUILD/compile-darwin-mwcc
      BUILD/compile-irix-mips64-mipspro
      BUILD/compile-pentium-icc
      BUILD/compile-pentium-icc-valgrind-max
      BUILD/compile-pentium-icc-yassl
      BUILD/compile-pentium-pgcc
      mysys/my_new.cc
    added:
      mysys/my_isnan.c
      unittest/gunit/stdcxx-t.cc
    renamed:
      mysys/psi_noop.cc => mysys/psi_noop.c
      sql/udf_example.c => sql/udf_example.cc
    modified:
      .bzr-mysql/default.conf
      BUILD/SETUP.sh
      BUILD/build_mccge.sh
      BUILD/compile-dist
      BUILD/compile-solaris-amd64
      BUILD/compile-solaris-amd64-forte
      BUILD/compile-solaris-amd64-forte-debug
      BUILD/compile-solaris-sparc
      BUILD/compile-solaris-sparc-debug
      BUILD/compile-solaris-sparc-forte
      BUILD/compile-solaris-sparc-purify
      client/CMakeLists.txt
      client/mysql.cc
      client/mysql_upgrade.c
      client/mysqlbinlog.cc
      client/mysqldump.c
      client/mysqltest.cc
      client/sql_string.cc
      cmake/build_configurations/mysql_release.cmake
      cmake/configure.pl
      cmake/info_macros.cmake.in
      cmake/os/Windows.cmake
      cmake/readline.cmake
      config.h.cmake
      configure.cmake
      dbug/dbug.c
      include/m_string.h
      include/my_global.h
      include/my_pthread.h
      include/mysql.h
      include/mysql/psi/mysql_thread.h
      include/mysql/psi/psi.h
      include/mysql/psi/psi_abi_v0.h.pp
      include/mysql/psi/psi_abi_v1.h
      include/mysql/psi/psi_abi_v1.h.pp
      include/mysql/psi/psi_abi_v2.h.pp
      include/mysql_com.h
      include/waiting_threads.h
      libmysql/libmysql.c
      libmysqld/lib_sql.cc
      mysql-test/mysql-test-run.pl
      mysql-test/r/udf.result
      mysql-test/suite/funcs_1/t/storedproc.test
      mysql-test/suite/perfschema/t/socket_instances_func.test
      mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
      mysql-test/suite/rpl/t/rpl_temporary.test
      mysql-test/t/csv.test
      mysql-test/t/disabled.def
      mysql-test/t/information_schema_parameters.test
      mysql-test/t/information_schema_routines.test
      mysql-test/t/lock.test
      mysql-test/t/mysql_plugin.test
      mysql-test/t/mysqlbinlog2.test
      mysql-test/t/ps.test
      mysql-test/t/ps_ddl.test
      mysql-test/t/sp-error.test
      mysql-test/t/sp.test
      mysql-test/t/trigger.test
      mysql-test/t/udf.test
      mysql-test/t/view_grant.test
      mysys/CMakeLists.txt
      mysys/array.c
      mysys/default.c
      mysys/lf_alloc-pin.c
      mysys/lf_dynarray.c
      mysys/mf_format.c
      mysys/mf_iocache.c
      mysys/my_alloc.c
      mysys/my_bitmap.c
      mysys/my_compare.c
      mysys/my_compress.c
      mysys/my_file.c
      mysys/stacktrace.c
      mysys/waiting_threads.c
      sql-common/client.c
      sql-common/client_plugin.c
      sql-common/my_time.c
      sql/CMakeLists.txt
      sql/binlog.cc
      sql/debug_sync.cc
      sql/field.cc
      sql/field.h
      sql/filesort.cc
      sql/ha_partition.cc
      sql/handler.cc
      sql/handler.h
      sql/item.cc
      sql/item_buff.cc
      sql/item_cmpfunc.cc
      sql/item_func.cc
      sql/item_func.h
      sql/item_strfunc.cc
      sql/item_strfunc.h
      sql/item_sum.cc
      sql/item_timefunc.cc
      sql/item_timefunc.h
      sql/key.cc
      sql/log.cc
      sql/log_event.cc
      sql/log_event.h
      sql/log_event_old.cc
      sql/mdl.cc
      sql/mdl.h
      sql/mysqld.cc
      sql/net_serv.cc
      sql/opt_range.cc
      sql/opt_range.h
      sql/opt_trace.cc
      sql/opt_trace.h
      sql/protocol.cc
      sql/rpl_mi.cc
      sql/rpl_record.cc
      sql/rpl_rli.cc
      sql/rpl_slave.cc
      sql/rpl_utility.cc
      sql/rpl_utility.h
      sql/set_var.cc
      sql/set_var.h
      sql/sp_head.cc
      sql/spatial.h
      sql/sql_acl.cc
      sql/sql_analyse.cc
      sql/sql_cache.cc
      sql/sql_class.cc
      sql/sql_client.cc
      sql/sql_connect.cc
      sql/sql_const.h
      sql/sql_error.cc
      sql/sql_join_cache.cc
      sql/sql_load.cc
      sql/sql_parse.cc
      sql/sql_partition.cc
      sql/sql_plugin.cc
      sql/sql_plugin.h
      sql/sql_prepare.cc
      sql/sql_profile.cc
      sql/sql_select.cc
      sql/sql_select.h
      sql/sql_show.cc
      sql/sql_string.cc
      sql/sql_table.cc
      sql/sql_table.h
      sql/sql_yacc.yy
      sql/thr_malloc.cc
      sql/tztime.cc
      sql/udf_example.def
      sql/unireg.cc
      storage/csv/ha_tina.cc
      storage/federated/ha_federated.cc
      storage/heap/hp_create.c
      storage/heap/hp_static.c
      storage/heap/hp_test2.c
      storage/innobase/sync/sync0rw.c
      storage/myisam/ha_myisam.cc
      storage/myisam/mi_cache.c
      storage/myisam/mi_check.c
      storage/myisam/mi_create.c
      storage/myisam/mi_dynrec.c
      storage/myisam/mi_extra.c
      storage/myisam/mi_open.c
      storage/myisam/mi_packrec.c
      storage/myisam/mi_static.c
      storage/myisam/myisamlog.c
      storage/myisam/myisampack.c
      storage/myisam/rt_mbr.c
      storage/myisam/sort.c
      storage/myisammrg/ha_myisammrg.cc
      strings/ctype-big5.c
      strings/ctype-bin.c
      strings/ctype-gbk.c
      strings/ctype-mb.c
      strings/ctype-simple.c
      strings/ctype-tis620.c
      strings/ctype-uca.c
      strings/ctype-ucs2.c
      strings/ctype-utf8.c
      strings/ctype.c
      strings/decimal.c
      strings/dtoa.c
      strings/my_vsnprintf.c
      support-files/mysql.spec.sh
      tests/mysql_client_test.c
      unittest/gunit/CMakeLists.txt
      unittest/gunit/gunit_test_main.cc
      unittest/gunit/item-t.cc
      unittest/mysys/lf-t.c
      unittest/mysys/my_atomic-t.c
      unittest/mysys/thr_template.c
      unittest/mysys/waiting_threads-t.c
      vio/viosocket.c
      win/create_def_file.js
      mysys/psi_noop.c
      sql/udf_example.cc
=== modified file 'include/mysql/psi/psi.h'
--- a/include/mysql/psi/psi.h	2011-11-04 16:34:00 +0000
+++ b/include/mysql/psi/psi.h	2011-11-04 23:30:07 +0000
@@ -16,10 +16,6 @@
 #ifndef MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H
 #define MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H
 
-/* temporary, Investigate build failures on embedded */
-#define DISABLE_PSI_STATEMENT
-#define DISABLE_PSI_IDLE
-
 #ifndef MY_GLOBAL_INCLUDED
 /*
   Make sure a .c or .cc file contains an include to my_global.h first.

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2011-11-02 23:29:01 +0000
+++ b/sql/sql_class.h	2011-11-04 23:30:07 +0000
@@ -2362,20 +2362,15 @@ public:
 
   /** Current statement instrumentation. */
   PSI_statement_locker *m_statement_psi;
-#ifdef HAVE_PSI_STATEMENT_INTERFACE
   /** Current statement instrumentation state. */
   PSI_statement_locker_state m_statement_state;
-#endif
   /** Idle instrumentation. */
   PSI_idle_locker *m_idle_psi;
-#ifdef HAVE_PSI_IDLE_INTERFACE
   /** Idle instrumentation state. */
   PSI_idle_locker_state m_idle_state;
-#endif
   /** True if the server code is IDLE for this connection. */
   bool m_server_idle;
 
-
   /*
     Id of current query. Statement can be reused to execute several queries
     query_id is global in context of the whole MySQL server.

=== modified file 'storage/innobase/include/os0sync.ic'
--- a/storage/innobase/include/os0sync.ic	2011-09-26 23:52:40 +0000
+++ b/storage/innobase/include/os0sync.ic	2011-11-04 23:30:07 +0000
@@ -106,18 +106,25 @@ pfs_os_fast_mutex_lock(
 	ulint			line)		/*!< in: line where locked */
 {
 #ifdef HAVE_PSI_MUTEX_INTERFACE
-	struct PSI_mutex_locker*        locker;
-	PSI_mutex_locker_state          state;
-
-	locker = PSI_CALL(start_mutex_wait)(&state, fast_mutex->pfs_psi,
-		 PSI_MUTEX_LOCK, file_name, line);
+	if (fast_mutex->pfs_psi != NULL)
+	{
+		PSI_mutex_locker* 	locker;
+		PSI_mutex_locker_state	state;
+
+		locker = PSI_CALL(start_mutex_wait)(&state, fast_mutex->pfs_psi,
+			PSI_MUTEX_LOCK, file_name, line);
+
+		os_fast_mutex_lock_func(&fast_mutex->mutex);
+
+		if (locker != NULL)
+			PSI_CALL(end_mutex_wait)(locker, 0);
+	}
+	else
 #endif
+	{
+		os_fast_mutex_lock_func(&fast_mutex->mutex);
+	}
 
-	os_fast_mutex_lock_func(&fast_mutex->mutex);
-
-#ifdef HAVE_PSI_MUTEX_INTERFACE
-	PSI_CALL(end_mutex_wait)(locker, 0);
-#endif
 	return;
 }
 /**********************************************************//**

=== modified file 'storage/innobase/include/sync0rw.ic'
--- a/storage/innobase/include/sync0rw.ic	2011-10-27 20:14:43 +0000
+++ b/storage/innobase/include/sync0rw.ic	2011-11-04 23:30:07 +0000
@@ -678,16 +678,24 @@ pfs_rw_lock_x_lock_func(
 	const char*	file_name,/*!< in: file name where lock requested */
 	ulint		line)	/*!< in: line where requested */
 {
-	struct PSI_rwlock_locker*	locker;
-	PSI_rwlock_locker_state		state;
-
-	/* Record the entry of rw x lock request in performance schema */
-	locker = PSI_CALL(start_rwlock_wrwait)(
-		&state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK, file_name, line);
-
-	rw_lock_x_lock_func(lock, pass, file_name, line);
-
-	PSI_CALL(end_rwlock_wrwait)(locker, 0);
+	if (lock->pfs_psi != NULL)
+	{
+		PSI_rwlock_locker*	locker;
+		PSI_rwlock_locker_state	state;
+
+		/* Record the entry of rw x lock request in performance schema */
+		locker = PSI_CALL(start_rwlock_wrwait)(
+			&state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK, file_name, line);
+
+		rw_lock_x_lock_func(lock, pass, file_name, line);
+
+		if (locker != NULL)
+			PSI_CALL(end_rwlock_wrwait)(locker, 0);
+	}
+	else
+	{
+		rw_lock_x_lock_func(lock, pass, file_name, line);
+	}
 }
 /******************************************************************//**
 Performance schema instrumented wrap function for
@@ -704,17 +712,27 @@ pfs_rw_lock_x_lock_func_nowait(
 				requested */
 	ulint		line)	/*!< in: line where requested */
 {
-	struct PSI_rwlock_locker*	locker;
-	PSI_rwlock_locker_state		state;
 	ibool	ret;
 
-	/* Record the entry of rw x lock request in performance schema */
-	locker = PSI_CALL(start_rwlock_wrwait)(
-		&state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK, file_name, line);
-
-	ret = rw_lock_x_lock_func_nowait(lock, file_name, line);
+	if (lock->pfs_psi != NULL)
+	{
+		PSI_rwlock_locker*	locker;
+		PSI_rwlock_locker_state		state;
+
+		/* Record the entry of rw x lock request in performance schema */
+		locker = PSI_CALL(start_rwlock_wrwait)(
+			&state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK, file_name, line);
+
+		ret = rw_lock_x_lock_func_nowait(lock, file_name, line);
+
+		if (locker != NULL)
+			PSI_CALL(end_rwlock_wrwait)(locker, 0);
+	}
+	else
+	{
+		ret = rw_lock_x_lock_func_nowait(lock, file_name, line);
+	}
 
-	PSI_CALL(end_rwlock_wrwait)(locker, 0);
 	return(ret);
 }
 /******************************************************************//**
@@ -748,16 +766,25 @@ pfs_rw_lock_s_lock_func(
 				requested */
 	ulint		line)	/*!< in: line where requested */
 {
-	struct PSI_rwlock_locker*	locker;
-	PSI_rwlock_locker_state		state;
+	if (lock->pfs_psi != NULL)
+	{
+		PSI_rwlock_locker*	locker;
+		PSI_rwlock_locker_state	state;
+
+		/* Instrumented to inform we are aquiring a shared rwlock */
+		locker = PSI_CALL(start_rwlock_rdwait)(
+			&state, lock->pfs_psi, PSI_RWLOCK_READLOCK, file_name, line);
+
+		rw_lock_s_lock_func(lock, pass, file_name, line);
+
+		if (locker != NULL)
+			PSI_CALL(end_rwlock_rdwait)(locker, 0);
+	}
+	else
+	{
+		rw_lock_s_lock_func(lock, pass, file_name, line);
+	}
 
-	/* Instrumented to inform we are aquiring a shared rwlock */
-	locker = PSI_CALL(start_rwlock_rdwait)(
-		&state, lock->pfs_psi, PSI_RWLOCK_READLOCK, file_name, line);
-
-	rw_lock_s_lock_func(lock, pass, file_name, line);
-
-	PSI_CALL(end_rwlock_rdwait)(locker, 0);
 	return;
 }
 /******************************************************************//**
@@ -776,17 +803,26 @@ pfs_rw_lock_s_lock_low(
 	const char*	file_name, /*!< in: file name where lock requested */
 	ulint		line)	/*!< in: line where requested */
 {
-	struct PSI_rwlock_locker*	locker;
-	PSI_rwlock_locker_state		state;
 	ibool	ret;
+	if (lock->pfs_psi != NULL)
+	{
+		PSI_rwlock_locker*	locker;
+		PSI_rwlock_locker_state	state;
+
+		/* Instrumented to inform we are aquiring a shared rwlock */
+		locker = PSI_CALL(start_rwlock_rdwait)(
+			&state, lock->pfs_psi, PSI_RWLOCK_READLOCK, file_name, line);
+
+		ret = rw_lock_s_lock_low(lock, pass, file_name, line);
+
+		if (locker != NULL)
+			PSI_CALL(end_rwlock_rdwait)(locker, 0);
+	}
+	else
+	{
+		ret = rw_lock_s_lock_low(lock, pass, file_name, line);
+	}
 
-	/* Instrumented to inform we are aquiring a shared rwlock */
-	locker = PSI_CALL(start_rwlock_rdwait)(
-		&state, lock->pfs_psi, PSI_RWLOCK_READLOCK, file_name, line);
-
-	ret = rw_lock_s_lock_low(lock, pass, file_name, line);
-
-	PSI_CALL(end_rwlock_rdwait)(locker, 0);
 	return(ret);
 }
 

=== modified file 'storage/innobase/include/sync0sync.ic'
--- a/storage/innobase/include/sync0sync.ic	2011-09-26 23:52:40 +0000
+++ b/storage/innobase/include/sync0sync.ic	2011-11-04 23:30:07 +0000
@@ -236,13 +236,23 @@ pfs_mutex_enter_func(
 	const char*	file_name,	/*!< in: file name where locked */
 	ulint		line)		/*!< in: line where locked */
 {
-	struct PSI_mutex_locker*	locker;
-	PSI_mutex_locker_state		state;
-
-	locker = PSI_CALL(start_mutex_wait)(&state, mutex->pfs_psi,
-		PSI_MUTEX_LOCK, file_name, line);
-	mutex_enter_func(mutex, file_name, line);
-	PSI_CALL(end_mutex_wait)(locker, 0);
+	if (mutex->pfs_psi != NULL)
+	{
+		PSI_mutex_locker*	locker;
+		PSI_mutex_locker_state	state;
+
+		locker = PSI_CALL(start_mutex_wait)(&state, mutex->pfs_psi,
+			PSI_MUTEX_LOCK, file_name, line);
+
+		mutex_enter_func(mutex, file_name, line);
+
+		if (locker != NULL)
+			PSI_CALL(end_mutex_wait)(locker, 0);
+	}
+	else
+	{
+		mutex_enter_func(mutex, file_name, line);
+	}
 }
 /********************************************************************//**
 NOTE! Please use the corresponding macro mutex_enter_nowait(), not directly
@@ -260,13 +270,23 @@ pfs_mutex_enter_nowait_func(
 	ulint		line)		/*!< in: line where requested */
 {
 	ulint	ret;
-	struct PSI_mutex_locker*	locker;
-	PSI_mutex_locker_state		state;
-
-	locker = PSI_CALL(start_mutex_wait)(&state, mutex->pfs_psi,
-		 PSI_MUTEX_TRYLOCK, file_name, line);
-	ret = mutex_enter_nowait_func(mutex, file_name, line);
-	PSI_CALL(end_mutex_wait)(locker, (int) ret);
+	if (mutex->pfs_psi != NULL)
+	{
+		PSI_mutex_locker*	locker;
+		PSI_mutex_locker_state		state;
+
+		locker = PSI_CALL(start_mutex_wait)(&state, mutex->pfs_psi,
+			PSI_MUTEX_TRYLOCK, file_name, line);
+
+		ret = mutex_enter_nowait_func(mutex, file_name, line);
+
+		if (locker != NULL)
+			PSI_CALL(end_mutex_wait)(locker, (int) ret);
+	}
+	else
+	{
+		ret = mutex_enter_nowait_func(mutex, file_name, line);
+	}
 	return(ret);
 }
 /******************************************************************//**

=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc	2011-11-02 13:43:41 +0000
+++ b/storage/perfschema/pfs.cc	2011-11-04 23:30:07 +0000
@@ -1533,6 +1533,10 @@ open_table_v1(PSI_table_share *share, co
   if (unlikely(pfs_table_share == NULL))
     return NULL;
 
+  // FIXME: full life cycle, with rebind, table cache, etc
+  if (! pfs_table_share->m_enabled)
+    return NULL;
+
   PFS_thread *thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
   if (unlikely(thread == NULL))
     return NULL;
@@ -2027,9 +2031,7 @@ start_mutex_wait_v1(PSI_mutex_locker_sta
   DBUG_ASSERT((uint) op < array_elements(mutex_operation_map));
   DBUG_ASSERT(state != NULL);
 
-  if (unlikely(pfs_mutex == NULL))
-    return NULL;
-
+  DBUG_ASSERT(pfs_mutex != NULL);
   DBUG_ASSERT(pfs_mutex->m_class != NULL);
 
   if (! pfs_mutex->m_enabled)
@@ -2125,10 +2127,7 @@ start_rwlock_wait_v1(PSI_rwlock_locker_s
   DBUG_ASSERT(static_cast<int> (op) >= 0);
   DBUG_ASSERT(static_cast<uint> (op) < array_elements(rwlock_operation_map));
   DBUG_ASSERT(state != NULL);
-
-  if (unlikely(pfs_rwlock == NULL))
-    return NULL;
-
+  DBUG_ASSERT(pfs_rwlock != NULL);
   DBUG_ASSERT(pfs_rwlock->m_class != NULL);
 
   if (! pfs_rwlock->m_enabled)
@@ -2234,10 +2233,7 @@ start_cond_wait_v1(PSI_cond_locker_state
   DBUG_ASSERT(static_cast<int> (op) >= 0);
   DBUG_ASSERT(static_cast<uint> (op) < array_elements(cond_operation_map));
   DBUG_ASSERT(state != NULL);
-
-  if (unlikely(pfs_cond == NULL))
-    return NULL;
-
+  DBUG_ASSERT(pfs_cond != NULL);
   DBUG_ASSERT(pfs_cond->m_class != NULL);
 
   if (! pfs_cond->m_enabled)
@@ -2378,10 +2374,7 @@ start_table_io_wait_v1(PSI_table_locker_
   DBUG_ASSERT(static_cast<uint> (op) < array_elements(table_io_operation_map));
   DBUG_ASSERT(state != NULL);
   PFS_table *pfs_table= reinterpret_cast<PFS_table*> (table);
-
-  if (unlikely(pfs_table == NULL))
-    return NULL;
-
+  DBUG_ASSERT(pfs_table != NULL);
   DBUG_ASSERT(pfs_table->m_share != NULL);
 
   if (! pfs_table->m_io_enabled)
@@ -2487,9 +2480,7 @@ start_table_lock_wait_v1(PSI_table_locke
 
   PFS_table *pfs_table= reinterpret_cast<PFS_table*> (table);
 
-  if (unlikely(pfs_table == NULL))
-    return NULL;
-
+  DBUG_ASSERT(pfs_table != NULL);
   DBUG_ASSERT(pfs_table->m_share != NULL);
 
   if (! pfs_table->m_lock_enabled)
@@ -3298,8 +3289,7 @@ static void end_idle_wait_v1(PSI_idle_lo
 static void end_mutex_wait_v1(PSI_mutex_locker* locker, int rc)
 {
   PSI_mutex_locker_state *state= reinterpret_cast<PSI_mutex_locker_state*> (locker);
-  if (state == NULL)
-    return;
+  DBUG_ASSERT(state != NULL);
 
   ulonglong timer_end= 0;
   ulonglong wait_time= 0;
@@ -3369,8 +3359,7 @@ static void end_mutex_wait_v1(PSI_mutex_
 static void end_rwlock_rdwait_v1(PSI_rwlock_locker* locker, int rc)
 {
   PSI_rwlock_locker_state *state= reinterpret_cast<PSI_rwlock_locker_state*> (locker);
-  if (state == NULL)
-    return;
+  DBUG_ASSERT(state != NULL);
 
   ulonglong timer_end= 0;
   ulonglong wait_time= 0;
@@ -3520,8 +3509,7 @@ static void end_rwlock_wrwait_v1(PSI_rwl
 static void end_cond_wait_v1(PSI_cond_locker* locker, int rc)
 {
   PSI_cond_locker_state *state= reinterpret_cast<PSI_cond_locker_state*> (locker);
-  if (state == NULL)
-    return;
+  DBUG_ASSERT(state != NULL);
 
   ulonglong timer_end= 0;
   ulonglong wait_time= 0;
@@ -3585,8 +3573,7 @@ static void end_cond_wait_v1(PSI_cond_lo
 static void end_table_io_wait_v1(PSI_table_locker* locker)
 {
   PSI_table_locker_state *state= reinterpret_cast<PSI_table_locker_state*> (locker);
-  if (state == NULL)
-    return;
+  DBUG_ASSERT(state != NULL);
 
   ulonglong timer_end= 0;
   ulonglong wait_time= 0;
@@ -3660,8 +3647,7 @@ static void end_table_io_wait_v1(PSI_tab
 static void end_table_lock_wait_v1(PSI_table_locker* locker)
 {
   PSI_table_locker_state *state= reinterpret_cast<PSI_table_locker_state*> (locker);
-  if (state == NULL)
-    return;
+  DBUG_ASSERT(state != NULL);
 
   ulonglong timer_end= 0;
   ulonglong wait_time= 0;

=== modified file 'storage/perfschema/unittest/pfs_benchmark-t.cc'
--- a/storage/perfschema/unittest/pfs_benchmark-t.cc	2011-11-04 14:19:54 +0000
+++ b/storage/perfschema/unittest/pfs_benchmark-t.cc	2011-11-04 23:30:07 +0000
@@ -390,204 +390,252 @@ void benchmark_file_open(uint count, con
        count, timer_cycles, timer_cycles/count);
 }
 
-void fake_TABLE_SHARE(TABLE_SHARE *fake)
+void fake_TABLE_SHARE(TABLE_SHARE *fake, bool alive)
 {
-  fake->db.str = (char*) "test";
-  fake->db.length = 4;
-  fake->table_name.str = (char*) "t1";
-  fake->table_name.length = 2;
-  fake->keys= 0;
+  if (alive)
+  {
+    /* ENABLED in SETUP_OBJECTS */
+    fake->db.str = (char*) "test";
+    fake->db.length = 4;
+    fake->table_name.str = (char*) "t1";
+    fake->table_name.length = 2;
+    fake->keys= 0;
+  }
+  else
+  {
+    /* DISABLED in SETUP_OBJECTS */
+    fake->db.str = (char*) "mysql";
+    fake->db.length = 5;
+    fake->table_name.str = (char*) "user";
+    fake->table_name.length = 4;
+    fake->keys= 0;
+  }
 }
 
 void benchmark_create_table_share(uint count, const char *test)
 {
-  ulonglong timer_start;
-  ulonglong timer_end;
-  ulonglong timer_cycles;
-
-  TABLE_SHARE table_share;
-  fake_TABLE_SHARE(& table_share);
-
-  PSI_table_share *that;
-
-  timer_start= my_timer_cycles();
-
-  uint i;
-  start_some_work();
-  for (i= 0 ; i<count; i++)
+  int l;
+  for (l=1; l<=2; l++)
   {
-    that= PSI_CALL(get_table_share)(false, &table_share);
-    do_some_work();
-    PSI_CALL(drop_table_share)("test", 4, "t1", 2);
+    bool alive= (l == 1);
+    ulonglong timer_start;
+    ulonglong timer_end;
+    ulonglong timer_cycles;
+
+    TABLE_SHARE table_share;
+    fake_TABLE_SHARE(& table_share, alive);
+
+    PSI_table_share *that;
+
+    timer_start= my_timer_cycles();
+
+    uint i;
+    start_some_work();
+    for (i= 0 ; i<count; i++)
+    {
+      that= PSI_CALL(get_table_share)(false, &table_share);
+      do_some_work();
+      PSI_CALL(drop_table_share)(table_share.db.str, table_share.db.length,
+                                 table_share.table_name.str, table_share.table_name.length);
+    }
+
+    timer_end= my_timer_cycles();
+    timer_cycles= timer_end-timer_start;
+    // ok(get_work_done() == count, "work done");
+
+    diag("CREATE_TABLE_SHARE benchmark: %s, object %s, %d calls, %13llu cycles, %13llu avg",
+         test,
+         (alive ? "alive" : "dead"),
+         count, timer_cycles, timer_cycles/count);
   }
-
-  timer_end= my_timer_cycles();
-  timer_cycles= timer_end-timer_start;
-  // ok(get_work_done() == count, "work done");
-
-  diag("CREATE_TABLE_SHARE benchmark: %s, %d calls, %13llu cycles, %13llu avg",
-       test,
-       count, timer_cycles, timer_cycles/count);
 }
 
 void benchmark_find_table_share(uint count, const char *test)
 {
-  ulonglong timer_start;
-  ulonglong timer_end;
-  ulonglong timer_cycles;
-
-  TABLE_SHARE table_share;
-  fake_TABLE_SHARE(& table_share);
-
-  PSI_table_share *that_1;
-  PSI_table_share *that_2;
-
-  timer_start= my_timer_cycles();
-
-  uint i;
-  start_some_work();
-  that_1= PSI_CALL(get_table_share)(false, &table_share);
-  for (i= 0 ; i<count; i++)
+  int l;
+  for (l=1; l<=2; l++)
   {
-    that_2= PSI_CALL(get_table_share)(false, &table_share);
-    do_some_work();
-    PSI_CALL(release_table_share)(that_2);
+    bool alive= (l == 1);
+    ulonglong timer_start;
+    ulonglong timer_end;
+    ulonglong timer_cycles;
+
+    TABLE_SHARE table_share;
+    fake_TABLE_SHARE(& table_share, alive);
+
+    PSI_table_share *that_1;
+    PSI_table_share *that_2;
+
+    timer_start= my_timer_cycles();
+
+    uint i;
+    start_some_work();
+    that_1= PSI_CALL(get_table_share)(false, &table_share);
+    for (i= 0 ; i<count; i++)
+    {
+      that_2= PSI_CALL(get_table_share)(false, &table_share);
+      do_some_work();
+      PSI_CALL(release_table_share)(that_2);
+    }
+    PSI_CALL(drop_table_share)(table_share.db.str, table_share.db.length,
+                               table_share.table_name.str, table_share.table_name.length);
+
+    timer_end= my_timer_cycles();
+    timer_cycles= timer_end-timer_start;
+    // ok(get_work_done() == count, "work done");
+
+    diag("FIND_TABLE_SHARE benchmark: %s, object %s, %d calls, %13llu cycles, %13llu avg",
+         test,
+         (alive ? "alive" : "dead"),
+         count, timer_cycles, timer_cycles/count);
   }
-  PSI_CALL(drop_table_share)("test", 4, "t1", 2);
-
-  timer_end= my_timer_cycles();
-  timer_cycles= timer_end-timer_start;
-  // ok(get_work_done() == count, "work done");
-
-  diag("FIND_TABLE_SHARE benchmark: %s, %d calls, %13llu cycles, %13llu avg",
-       test,
-       count, timer_cycles, timer_cycles/count);
 }
 
 void benchmark_open_table(uint count, const char *test)
 {
-  ulonglong timer_start;
-  ulonglong timer_end;
-  ulonglong timer_cycles;
-
-  TABLE_SHARE table_share;
-  fake_TABLE_SHARE(& table_share);
-
-  PSI_table_share *that_share;
-  that_share= PSI_CALL(get_table_share)(false, &table_share);
-
-  PSI_table *that;
-  timer_start= my_timer_cycles();
-
-  uint i;
-  start_some_work();
-  for (i= 0 ; i<count; i++)
+  int l;
+  for (l=1; l<=2; l++)
   {
-    that= PSI_CALL(open_table)(that_share, NULL);
-    do_some_work();
-    PSI_CALL(close_table)(that);
+    bool alive= (l == 1);
+    ulonglong timer_start;
+    ulonglong timer_end;
+    ulonglong timer_cycles;
+
+    TABLE_SHARE table_share;
+    fake_TABLE_SHARE(& table_share, alive);
+
+    PSI_table_share *that_share;
+    that_share= PSI_CALL(get_table_share)(false, &table_share);
+
+    PSI_table *that;
+    timer_start= my_timer_cycles();
+
+    uint i;
+    start_some_work();
+    for (i= 0 ; i<count; i++)
+    {
+      that= PSI_CALL(open_table)(that_share, NULL);
+      do_some_work();
+      PSI_CALL(close_table)(that);
+    }
+
+    timer_end= my_timer_cycles();
+    timer_cycles= timer_end-timer_start;
+
+    PSI_CALL(drop_table_share)(table_share.db.str, table_share.db.length,
+                               table_share.table_name.str, table_share.table_name.length);
+
+    // ok(get_work_done() == count, "work done");
+
+    diag("OPEN_TABLE benchmark: %s, object %s, %d calls, %13llu cycles, %13llu avg",
+         test,
+         (alive ? "alive" : "dead"),
+         count, timer_cycles, timer_cycles/count);
   }
-
-  timer_end= my_timer_cycles();
-  timer_cycles= timer_end-timer_start;
-
-  PSI_CALL(drop_table_share)("test", 4, "t1", 2);
-
-  // ok(get_work_done() == count, "work done");
-
-  diag("OPEN_TABLE benchmark: %s, %d calls, %13llu cycles, %13llu avg",
-       test,
-       count, timer_cycles, timer_cycles/count);
 }
 
 void benchmark_table_io(uint count, const char *test)
 {
-  ulonglong timer_start;
-  ulonglong timer_end;
-  ulonglong timer_cycles;
+  int l;
+  for (l=1; l<=2; l++)
+  {
+    bool alive= (l == 1);
+    ulonglong timer_start;
+    ulonglong timer_end;
+    ulonglong timer_cycles;
 
-  TABLE_SHARE table_share;
-  fake_TABLE_SHARE(& table_share);
+    TABLE_SHARE table_share;
+    fake_TABLE_SHARE(& table_share, alive);
 
-  PSI_table_share *that_share;
-  that_share= PSI_CALL(get_table_share)(false, &table_share);
+    PSI_table_share *that_share;
+    that_share= PSI_CALL(get_table_share)(false, &table_share);
 
-  PSI_table *that;
-  that= PSI_CALL(open_table)(that_share, NULL);
+    PSI_table *that;
+    that= PSI_CALL(open_table)(that_share, NULL);
 
-  timer_start= my_timer_cycles();
+    timer_start= my_timer_cycles();
 
-  uint i;
-  start_some_work();
-  for (i= 0 ; i<count; i++)
-  {
+    uint i;
+    start_some_work();
+    for (i= 0 ; i<count; i++)
+    {
 #if defined MYSQL_TABLE_IO_WAIT
-    MYSQL_TABLE_IO_WAIT(that, PSI_TABLE_FETCH_ROW, MAX_KEY, 0,
-      { do_some_work(); })
+      MYSQL_TABLE_IO_WAIT(that, PSI_TABLE_FETCH_ROW, MAX_KEY, 0,
+        { do_some_work(); })
 #else
-    MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
-    MYSQL_START_TABLE_IO_WAIT(locker, &state, that,
-                              PSI_TABLE_FETCH_ROW, MAX_KEY, 0);
-    do_some_work();
-    MYSQL_END_TABLE_IO_WAIT(locker);
-#endif
-  }
-
-  timer_end= my_timer_cycles();
-  timer_cycles= timer_end-timer_start;
-  // ok(get_work_done() == count, "work done");
+      MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
+      MYSQL_START_TABLE_IO_WAIT(locker, &state, that,
+                                PSI_TABLE_FETCH_ROW, MAX_KEY, 0);
+      do_some_work();
+      MYSQL_END_TABLE_IO_WAIT(locker);
+#endif
+    }
+
+    timer_end= my_timer_cycles();
+    timer_cycles= timer_end-timer_start;
+    // ok(get_work_done() == count, "work done");
 
-  PSI_CALL(close_table)(that);
-  PSI_CALL(drop_table_share)("test", 4, "t1", 2);
+    PSI_CALL(close_table)(that);
+    PSI_CALL(drop_table_share)(table_share.db.str, table_share.db.length,
+                               table_share.table_name.str, table_share.table_name.length);
 
-  diag("TABLE_IO benchmark: %s, %d calls, %13llu cycles, %13llu avg",
-       test,
-       count, timer_cycles, timer_cycles/count);
+    diag("TABLE_IO benchmark: %s, object %s, %d calls, %13llu cycles, %13llu avg",
+         test,
+         (alive ? "alive" : "dead"),
+         count, timer_cycles, timer_cycles/count);
+  }
 }
 
 void benchmark_table_lock(uint count, const char *test)
 {
-  ulonglong timer_start;
-  ulonglong timer_end;
-  ulonglong timer_cycles;
+  int l;
+  for (l=1; l<=2; l++)
+  {
+    bool alive= (l == 1);
+    ulonglong timer_start;
+    ulonglong timer_end;
+    ulonglong timer_cycles;
 
-  TABLE_SHARE table_share;
-  fake_TABLE_SHARE(& table_share);
+    TABLE_SHARE table_share;
+    fake_TABLE_SHARE(& table_share, alive);
 
-  PSI_table_share *that_share;
-  that_share= PSI_CALL(get_table_share)(false, &table_share);
+    PSI_table_share *that_share;
+    that_share= PSI_CALL(get_table_share)(false, &table_share);
 
-  PSI_table *that;
-  that= PSI_CALL(open_table)(that_share, NULL);
+    PSI_table *that;
+    that= PSI_CALL(open_table)(that_share, NULL);
 
-  timer_start= my_timer_cycles();
+    timer_start= my_timer_cycles();
 
-  uint i;
-  start_some_work();
-  for (i= 0 ; i<count; i++)
-  {
+    uint i;
+    start_some_work();
+    for (i= 0 ; i<count; i++)
+    {
 #if defined MYSQL_TABLE_LOCK_WAIT
-    MYSQL_TABLE_LOCK_WAIT(that, PSI_TABLE_EXTERNAL_LOCK, F_RDLCK,
-      { do_some_work(); })
+      MYSQL_TABLE_LOCK_WAIT(that, PSI_TABLE_EXTERNAL_LOCK, F_RDLCK,
+        { do_some_work(); })
 #else
-    MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
-    MYSQL_START_TABLE_LOCK_WAIT(locker, &state, that,
-                                PSI_TABLE_EXTERNAL_LOCK, F_RDLCK);
-    do_some_work();
-    MYSQL_END_TABLE_LOCK_WAIT(locker);
-#endif
-  }
-
-  timer_end= my_timer_cycles();
-  timer_cycles= timer_end-timer_start;
-  // ok(get_work_done() == count, "work done");
+      MYSQL_TABLE_WAIT_VARIABLES(locker, state) /* no ';' */
+      MYSQL_START_TABLE_LOCK_WAIT(locker, &state, that,
+                                  PSI_TABLE_EXTERNAL_LOCK, F_RDLCK);
+      do_some_work();
+      MYSQL_END_TABLE_LOCK_WAIT(locker);
+#endif
+    }
+
+    timer_end= my_timer_cycles();
+    timer_cycles= timer_end-timer_start;
+    // ok(get_work_done() == count, "work done");
 
-  PSI_CALL(close_table)(that);
-  PSI_CALL(drop_table_share)("test", 4, "t1", 2);
+    PSI_CALL(close_table)(that);
+    PSI_CALL(drop_table_share)(table_share.db.str, table_share.db.length,
+                               table_share.table_name.str, table_share.table_name.length);
 
-  diag("TABLE_LOCK benchmark: %s, %d calls, %13llu cycles, %13llu avg",
-       test,
-       count, timer_cycles, timer_cycles/count);
+    diag("TABLE_LOCK benchmark: %s, object %s, %d calls, %13llu cycles, %13llu avg",
+         test,
+         (alive ? "alive" : "dead"),
+         count, timer_cycles, timer_cycles/count);
+  }
 }
 
 void benchmark_all(bool enabled, bool timed, const char *test)
@@ -646,14 +694,6 @@ void benchmark_all(bool enabled, bool ti
   benchmark_open_table(1000000, msg);
   benchmark_table_io(1000000, msg);
   benchmark_table_lock(1000000, msg);
-
-/*
-  benchmark_mutex(10000000, msg);
-  benchmark_rwlock(10000000, msg);
-  benchmark_cond(10000000, msg);
-  benchmark_table_io(10000000, msg);
-  benchmark_table_lock(10000000, msg);
-*/
 }
 
 void test_all(bool enabled, bool timed)

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