List:Commits« Previous MessageNext Message »
From:Marc Alff Date:November 11 2008 5:09pm
Subject:bzr commit into mysql-6.0-perf branch (marc.alff:2731)
View as plain text  
#At file:///home/malff/BZR-TREE/mysql-6.0-perf/

 2731 Marc Alff	2008-11-11
      Thread instrumentation (in progress)
added:
  mysql-test/suite/perfschema/r/dml_acts_waits_current.result
  mysql-test/suite/perfschema/t/dml_acts_waits_current.test
  storage/perfschema/acts_waits.h
  storage/perfschema/table_acts_waits_current.cc
  storage/perfschema/table_acts_waits_current.h
modified:
  include/my_sys.h
  include/mysql/mysql_mutex.h
  include/mysql/psi.h
  include/mysql/psi_abi_v1.h.pp
  include/mysql/psi_abi_v2.h.pp
  mysql-test/suite/perfschema/r/dml_setup_instruments.result
  mysql-test/suite/perfschema/r/information_schema.result
  mysql-test/suite/perfschema/r/schema.result
  mysys/my_init.c
  sql/mysql_priv.h
  sql/mysqld.cc
  sql/sql_class.cc
  sql/table.cc
  storage/perfschema/Makefile.am
  storage/perfschema/plug.in
  storage/perfschema/psm.cc
  storage/perfschema/psm.h
  storage/perfschema/psm_bootstrap.cc
  storage/perfschema/psm_column_values.cc
  storage/perfschema/psm_column_values.h
  storage/perfschema/psm_global.cc
  storage/perfschema/psm_global.h
  storage/perfschema/psm_server.cc
  storage/perfschema/psm_sync.cc
  storage/perfschema/psm_sync.h
  storage/perfschema/psm_sync_info.cc
  storage/perfschema/psm_sync_info.h
  storage/perfschema/psm_table.cc
  storage/perfschema/table_setup_instruments.cc
  storage/perfschema/table_setup_instruments.h

=== modified file 'include/my_sys.h'
--- a/include/my_sys.h	2008-10-27 18:44:39 +0000
+++ b/include/my_sys.h	2008-11-11 17:09:18 +0000
@@ -701,6 +701,7 @@ extern int my_error_register(const char 
 extern const char **my_error_unregister(int first, int last);
 extern void my_message(uint my_err, const char *str,myf MyFlags);
 extern void my_message_no_curses(uint my_err, const char *str,myf MyFlags);
+extern void my_init_thread(void);
 extern my_bool my_init(void);
 extern void my_end(int infoflag);
 extern int my_redel(const char *from, const char *to, int MyFlags);

=== modified file 'include/mysql/mysql_mutex.h'
--- a/include/mysql/mysql_mutex.h	2008-11-01 01:05:08 +0000
+++ b/include/mysql/mysql_mutex.h	2008-11-11 17:09:18 +0000
@@ -325,8 +325,8 @@ static inline int mysql_mutex_lock(
 #ifdef HAVE_PSI_INTERFACE
   struct PSI_locker *locker= NULL;
   if (PSI_server && that->m_psi)
-    if ((locker= PSI_server->get_thread_locker()))
-      PSI_server->start_wait(locker, that->m_psi, 1);
+    if ((locker= PSI_server->get_thread_mutex_locker(that->m_psi)))
+      PSI_server->start_wait(locker, 1);
 #endif
 #ifdef SAFE_MUTEX
   result= safe_mutex_lock(& that->m_mutex, FALSE, file, line);
@@ -335,7 +335,7 @@ static inline int mysql_mutex_lock(
 #endif
 #ifdef HAVE_PSI_INTERFACE
   if (locker)
-    PSI_server->end_wait(locker, that->m_psi, result);
+    PSI_server->end_wait(locker, result);
 #endif
   return result;
 }
@@ -422,13 +422,13 @@ static inline int mysql_rwlock_rdlock(
 #ifdef HAVE_PSI_INTERFACE
   struct PSI_locker *locker= NULL;
   if (PSI_server && that->m_psi)
-    if ((locker= PSI_server->get_thread_locker()))
-      PSI_server->start_rdwait(locker, that->m_psi, 1);
+    if ((locker= PSI_server->get_thread_rwlock_locker(that->m_psi)))
+      PSI_server->start_rdwait(locker, 1);
 #endif
   result= rw_rdlock(& that->m_rwlock);
 #ifdef HAVE_PSI_INTERFACE
   if (locker)
-    PSI_server->end_rdwait(locker, that->m_psi, result);
+    PSI_server->end_rdwait(locker, result);
 #endif
   return result;
 }
@@ -440,13 +440,13 @@ static inline int mysql_rwlock_wrlock(
 #ifdef HAVE_PSI_INTERFACE
   struct PSI_locker *locker= NULL;
   if (PSI_server && that->m_psi)
-    if ((locker= PSI_server->get_thread_locker()))
-      PSI_server->start_wrwait(locker, that->m_psi, 1);
+    if ((locker= PSI_server->get_thread_rwlock_locker(that->m_psi)))
+      PSI_server->start_wrwait(locker, 1);
 #endif
   result= rw_rdlock(& that->m_rwlock);
 #ifdef HAVE_PSI_INTERFACE
   if (locker)
-    PSI_server->end_wrwait(locker, that->m_psi, result);
+    PSI_server->end_wrwait(locker, result);
 #endif
   return result;
 }
@@ -458,13 +458,13 @@ static inline int mysql_rwlock_tryrdlock
 #ifdef HAVE_PSI_INTERFACE
   struct PSI_locker *locker= NULL;
   if (PSI_server && that->m_psi)
-    if ((locker= PSI_server->get_thread_locker()))
-      PSI_server->start_rdwait(locker, that->m_psi, 0);
+    if ((locker= PSI_server->get_thread_rwlock_locker(that->m_psi)))
+      PSI_server->start_rdwait(locker, 0);
 #endif
   result= rw_rdlock(& that->m_rwlock);
 #ifdef HAVE_PSI_INTERFACE
   if (locker)
-    PSI_server->end_rdwait(locker, that->m_psi, result);
+    PSI_server->end_rdwait(locker, result);
 #endif
   return result;
 }
@@ -476,13 +476,13 @@ static inline int mysql_rwlock_trywrlock
 #ifdef HAVE_PSI_INTERFACE
   struct PSI_locker *locker= NULL;
   if (PSI_server && that->m_psi)
-    if ((locker= PSI_server->get_thread_locker()))
-      PSI_server->start_wrwait(locker, that->m_psi, 0);
+    if ((locker= PSI_server->get_thread_rwlock_locker(that->m_psi)))
+      PSI_server->start_wrwait(locker, 0);
 #endif
   result= rw_rdlock(& that->m_rwlock);
 #ifdef HAVE_PSI_INTERFACE
   if (locker)
-    PSI_server->end_wrwait(locker, that->m_psi, result);
+    PSI_server->end_wrwait(locker, result);
 #endif
   return result;
 }
@@ -559,13 +559,13 @@ static inline int mysql_cond_wait(
 #ifdef HAVE_PSI_INTERFACE
   struct PSI_locker *locker= NULL;
   if (PSI_server && that->m_psi)
-    if ((locker= PSI_server->get_thread_locker()))
-      PSI_server->start_condwait(locker, that->m_psi, 1);
+    if ((locker= PSI_server->get_thread_cond_locker(that->m_psi, mutex->m_psi)))
+      PSI_server->start_condwait(locker, 1);
 #endif
   result= pthread_cond_wait(& that->m_cond, & mutex->m_mutex);
 #ifdef HAVE_PSI_INTERFACE
   if (locker)
-    PSI_server->end_condwait(locker, that->m_psi, result);
+    PSI_server->end_condwait(locker, result);
 #endif
   return result;
 }
@@ -579,13 +579,13 @@ static inline int mysql_cond_timedwait(
 #ifdef HAVE_PSI_INTERFACE
   struct PSI_locker *locker= NULL;
   if (PSI_server && that->m_psi)
-    if ((locker= PSI_server->get_thread_locker()))
-      PSI_server->start_condwait(locker, that->m_psi, 0);
+    if ((locker= PSI_server->get_thread_cond_locker(that->m_psi, mutex->m_psi)))
+      PSI_server->start_condwait(locker, 0);
 #endif
   result= pthread_cond_timedwait(& that->m_cond, & mutex->m_mutex, abstime);
 #ifdef HAVE_PSI_INTERFACE
   if (locker)
-    PSI_server->end_condwait(locker, that->m_psi, result);
+    PSI_server->end_condwait(locker, result);
 #endif
   return result;
 }

=== modified file 'include/mysql/psi.h'
--- a/include/mysql/psi.h	2008-11-01 01:05:08 +0000
+++ b/include/mysql/psi.h	2008-11-11 17:09:18 +0000
@@ -120,6 +120,12 @@ typedef unsigned int PSI_rwlock_key;
 typedef unsigned int PSI_cond_key;
 
 /**
+  Instrumented thread key.
+  This is an opaque key.
+*/
+typedef unsigned int PSI_thread_key;
+
+/**
   \def USE_PSI_1
   Define USE_PSI_1 to use the interface version 1.
 */
@@ -225,6 +231,28 @@ struct PSI_cond_info_v1
 };
 
 /**
+  Thread information.
+  @since PSI_VERSION_1
+  This structure is used to register an instrumented thread.
+*/
+struct PSI_thread_info_v1
+{
+  /**
+    Pointer to the key assigned to the registered cond.
+  */
+  PSI_thread_key *m_key;
+  /**
+    The name of the cond to register.
+  */
+  const char* m_name;
+  /**
+    The flags of the cond to register.
+    @sa PSI_FLAG_GLOBAL
+  */
+  int m_flags;
+};
+
+/**
   Performance Schema Interface, version 1.
   @since PSI_VERSION_1
 */
@@ -261,6 +289,16 @@ struct PSI_v1
                         int count);
 
   /**
+    Thread registration API.
+    @param category a category name (typically a plugin name)
+    @param info an array of thread info to register
+    @param count the size of the info array
+  */
+  void (*register_thread)(const char* category,
+                          struct PSI_thread_info_v1 *info,
+                          int count);
+
+  /**
     Mutex initialisation API.
     @param key the registered mutex key
     @param identity the address of the mutex itself
@@ -307,9 +345,14 @@ struct PSI_v1
 
   /**
     Create an instrumented thread.
+    @param key the registered key
+    @param identity the address of the rwlock itself
     @return an instrumented thread
   */
-  struct PSI_thread* (*new_thread)();
+  struct PSI_thread* (*new_thread)(PSI_thread_key key,
+                                   void *identity);
+
+  void (*set_thread_id)(struct PSI_thread *thread, unsigned long id);
 
   /**
     Get the instrumentation for the running thread.
@@ -338,20 +381,66 @@ struct PSI_v1
   void (*delete_thread)(struct PSI_thread *thread);
 
   /**
-    Get a thread locker.
+    Get a mutex locker.
+    This method is a helper that calls @c get_thread() and
+    then @c get_mutex_locker().
+    Please call @c get_mutex_locker() directy if the
+    current thread instrumentation is already available.
+    @return a thread locker
+  */
+  struct PSI_locker* (*get_thread_mutex_locker)(struct PSI_mutex *mutex);
+
+  /**
+    Get a rwlock locker.
     This method is a helper that calls @c get_thread() and
-    then @c get_locker(). Please call @c get_locker() directy if the
+    then @c get_rwlock_locker().
+    Please call @c get_rwlock_locker() directy if the
     current thread instrumentation is already available.
     @return a thread locker
   */
-  struct PSI_locker* (*get_thread_locker)();
+  struct PSI_locker* (*get_thread_rwlock_locker)(struct PSI_rwlock *rwlock);
 
   /**
-    Get a thread locker.
+    Get a cond locker.
+    This method is a helper that calls @c get_thread() and
+    then @c get_cond_locker().
+    Please call @c get_cond_locker() directy if the
+    current thread instrumentation is already available.
+    @return a thread locker
+  */
+  struct PSI_locker* (*get_thread_cond_locker)(struct PSI_cond *cond,
+                                               struct PSI_mutex *mutex);
+
+
+
+
+
+
+
+  /**
+    Get a mutex locker.
     @param thread the instrumentation for the current thread
     @return a thread locker
   */
-  struct PSI_locker* (*get_locker)(struct PSI_thread *thread);
+  struct PSI_locker* (*get_mutex_locker)(struct PSI_thread *thread,
+                                         struct PSI_mutex *mutex);
+
+  /**
+    Get a rwlock locker.
+    @param thread the instrumentation for the current thread
+    @return a thread locker
+  */
+  struct PSI_locker* (*get_rwlock_locker)(struct PSI_thread *thread,
+                                          struct PSI_rwlock *rwlock);
+
+  /**
+    Get a cond locker.
+    @param thread the instrumentation for the current thread
+    @return a thread locker
+  */
+  struct PSI_locker* (*get_cond_locker)(struct PSI_thread *thread,
+                                        struct PSI_cond *cond,
+                                        struct PSI_mutex *mutex);
 
   /**
     Record a mutex unlock event.
@@ -388,81 +477,65 @@ struct PSI_v1
   /**
     Record a mutex wait start event.
     @param locker a thread locker for the running thread
-    @param mutex the mutex instrumentation
     @param must must block: 1 for lock, 0 for trylock
   */
   void (*start_wait)(struct PSI_locker *locker,
-                     struct PSI_mutex *mutex,
                      int must);
 
   /**
     Record a mutex wait end event.
     @param locker a thread locker for the running thread
-    @param mutex the mutex instrumentation
     @param rc the wait operation return code
   */
   void (*end_wait)(struct PSI_locker *locker,
-                   struct PSI_mutex *mutex,
                    int rc);
 
   /**
     Record a rwlock read wait start event.
     @param locker a thread locker for the running thread
-    @param rwlock the rwlock instrumentation
     @param must must block: 1 for lock, 0 for trylock
   */
   void (*start_rdwait)(struct PSI_locker *locker,
-                       struct PSI_rwlock *rwlock,
                        int must);
 
   /**
     Record a rwlock read wait end event.
     @param locker a thread locker for the running thread
-    @param rwlock the rwlock instrumentation
     @param rc the wait operation return code
   */
   void (*end_rdwait)(struct PSI_locker *locker,
-                     struct PSI_rwlock *rwlock,
                      int rc);
 
   /**
     Record a rwlock write wait start event.
     @param locker a thread locker for the running thread
-    @param rwlock the rwlock instrumentation
     @param must must block: 1 for lock, 0 for trylock
   */
   void (*start_wrwait)(struct PSI_locker *locker,
-                       struct PSI_rwlock *rwlock,
                        int must);
 
   /**
     Record a rwlock write wait end event.
     @param locker a thread locker for the running thread
-    @param rwlock the rwlock instrumentation
     @param rc the wait operation return code
   */
   void (*end_wrwait)(struct PSI_locker *locker,
-                     struct PSI_rwlock *rwlock,
                      int rc);
 
   /**
     Record a condition wait start event.
     @param locker a thread locker for the running thread
-    @param cond the cond instrumentation
     @param must must block: 1 for wait, 0 for timedwait
   */
   void (*start_condwait)(struct PSI_locker *locker,
-                         struct PSI_cond *cond,
                          int must);
 
   /**
     Record a condition wait end event.
     @param locker a thread locker for the running thread
-    @param cond the cond instrumentation
     @param rc the wait operation return code
   */
   void (*end_condwait)(struct PSI_locker *locker,
-                       struct PSI_cond *cond,
                        int rc);
 };
 
@@ -513,6 +586,12 @@ struct PSI_cond_info_v2
   int placeholder;
 };
 
+/** Placeholder */
+struct PSI_thread_info_v2
+{
+  int placeholder;
+};
+
 /**
   @} (end of group Group_PSI_v2)
 */
@@ -546,6 +625,7 @@ typedef struct PSI_v1 PSI;
 typedef struct PSI_mutex_info_v1 PSI_mutex_info;
 typedef struct PSI_rwlock_info_v1 PSI_rwlock_info;
 typedef struct PSI_cond_info_v1 PSI_cond_info;
+typedef struct PSI_thread_info_v1 PSI_thread_info;
 #endif
 
 #ifdef USE_PSI_2
@@ -553,6 +633,7 @@ 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;
 #endif
 
 /**

=== modified file 'include/mysql/psi_abi_v1.h.pp'
--- a/include/mysql/psi_abi_v1.h.pp	2008-11-01 01:05:08 +0000
+++ b/include/mysql/psi_abi_v1.h.pp	2008-11-11 17:09:18 +0000
@@ -11,6 +11,7 @@ struct PSI_locker;
 typedef unsigned int PSI_mutex_key;
 typedef unsigned int PSI_rwlock_key;
 typedef unsigned int PSI_cond_key;
+typedef unsigned int PSI_thread_key;
 struct PSI_mutex_info_v1
 {
   PSI_mutex_key *m_key;
@@ -29,6 +30,12 @@ struct PSI_cond_info_v1
   const char* m_name;
   int m_flags;
 };
+struct PSI_thread_info_v1
+{
+  PSI_thread_key *m_key;
+  const char* m_name;
+  int m_flags;
+};
 struct PSI_v1
 {
   void (*register_mutex)(const char* category,
@@ -40,6 +47,9 @@ struct PSI_v1
   void (*register_cond)(const char* category,
                         struct PSI_cond_info_v1 *info,
                         int count);
+  void (*register_thread)(const char* category,
+                          struct PSI_thread_info_v1 *info,
+                          int count);
   struct PSI_mutex* (*init_mutex)(PSI_mutex_key key,
                                   void *identity);
   void (*destroy_mutex)(struct PSI_mutex *mutex);
@@ -49,12 +59,23 @@ struct PSI_v1
   struct PSI_cond* (*init_cond)(PSI_cond_key key,
                                 void *identity);
   void (*destroy_cond)(struct PSI_cond *cond);
-  struct PSI_thread* (*new_thread)();
+  struct PSI_thread* (*new_thread)(PSI_thread_key key,
+                                   void *identity);
+  void (*set_thread_id)(struct PSI_thread *thread, unsigned long id);
   struct PSI_thread* (*get_thread)();
   void (*set_thread)(struct PSI_thread *thread);
   void (*delete_thread)(struct PSI_thread *thread);
-  struct PSI_locker* (*get_thread_locker)();
-  struct PSI_locker* (*get_locker)(struct PSI_thread *thread);
+  struct PSI_locker* (*get_thread_mutex_locker)(struct PSI_mutex *mutex);
+  struct PSI_locker* (*get_thread_rwlock_locker)(struct PSI_rwlock *rwlock);
+  struct PSI_locker* (*get_thread_cond_locker)(struct PSI_cond *cond,
+                                               struct PSI_mutex *mutex);
+  struct PSI_locker* (*get_mutex_locker)(struct PSI_thread *thread,
+                                         struct PSI_mutex *mutex);
+  struct PSI_locker* (*get_rwlock_locker)(struct PSI_thread *thread,
+                                          struct PSI_rwlock *rwlock);
+  struct PSI_locker* (*get_cond_locker)(struct PSI_thread *thread,
+                                        struct PSI_cond *cond,
+                                        struct PSI_mutex *mutex);
   void (*unlock_mutex)(struct PSI_thread *thread,
                        struct PSI_mutex *mutex);
   void (*unlock_rwlock)(struct PSI_thread *thread,
@@ -64,31 +85,24 @@ struct PSI_v1
   void (*broadcast_cond)(struct PSI_thread *thread,
                          struct PSI_cond *cond);
   void (*start_wait)(struct PSI_locker *locker,
-                     struct PSI_mutex *mutex,
                      int must);
   void (*end_wait)(struct PSI_locker *locker,
-                   struct PSI_mutex *mutex,
                    int rc);
   void (*start_rdwait)(struct PSI_locker *locker,
-                       struct PSI_rwlock *rwlock,
                        int must);
   void (*end_rdwait)(struct PSI_locker *locker,
-                     struct PSI_rwlock *rwlock,
                      int rc);
   void (*start_wrwait)(struct PSI_locker *locker,
-                       struct PSI_rwlock *rwlock,
                        int must);
   void (*end_wrwait)(struct PSI_locker *locker,
-                     struct PSI_rwlock *rwlock,
                      int rc);
   void (*start_condwait)(struct PSI_locker *locker,
-                         struct PSI_cond *cond,
                          int must);
   void (*end_condwait)(struct PSI_locker *locker,
-                       struct PSI_cond *cond,
                        int rc);
 };
 typedef struct PSI_v1 PSI;
 typedef struct PSI_mutex_info_v1 PSI_mutex_info;
 typedef struct PSI_rwlock_info_v1 PSI_rwlock_info;
 typedef struct PSI_cond_info_v1 PSI_cond_info;
+typedef struct PSI_thread_info_v1 PSI_thread_info;

=== modified file 'include/mysql/psi_abi_v2.h.pp'
--- a/include/mysql/psi_abi_v2.h.pp	2008-10-23 18:22:09 +0000
+++ b/include/mysql/psi_abi_v2.h.pp	2008-11-11 17:09:18 +0000
@@ -11,6 +11,7 @@ struct PSI_locker;
 typedef unsigned int PSI_mutex_key;
 typedef unsigned int PSI_rwlock_key;
 typedef unsigned int PSI_cond_key;
+typedef unsigned int PSI_thread_key;
 struct PSI_v2
 {
   int placeholder;
@@ -27,7 +28,12 @@ struct PSI_cond_info_v2
 {
   int placeholder;
 };
+struct PSI_thread_info_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;

=== added file 'mysql-test/suite/perfschema/r/dml_acts_waits_current.result'
--- a/mysql-test/suite/perfschema/r/dml_acts_waits_current.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/dml_acts_waits_current.result	2008-11-11 17:09:18 +0000
@@ -0,0 +1,9 @@
+select * from performance_schema.acts_waits_current;
+THREAD_ID	ACT_ID	ACT_NAME	TIMER_START	TIMER_END	TIMER_WAIT	SPINS	OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	OBJECT_INSTANCE_BEGIN
+select * from performance_schema.acts_waits_current
+where act_name='FOO';
+THREAD_ID	ACT_ID	ACT_NAME	TIMER_START	TIMER_END	TIMER_WAIT	SPINS	OBJECT_TYPE	OBJECT_SCHEMA	OBJECT_NAME	OBJECT_INSTANCE_BEGIN
+insert into performance_schema.acts_waits_current
+set thread_id='1', act_id=1,
+act_name='FOO', timer_start=1, timer_end=2, timer_wait=3;
+ERROR HY000: Table storage engine for 'acts_waits_current' doesn't have this option

=== modified file 'mysql-test/suite/perfschema/r/dml_setup_instruments.result'
--- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result	2008-11-06 17:25:15 +0000
+++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result	2008-11-11 17:09:18 +0000
@@ -1,5 +1,108 @@
 select * from performance_schema.setup_instruments;
 NAME	ENABLED	TIMED
+Wait/Synch/Mutex/Sql/LOCK_des_key_file	YES	YES
+Wait/Synch/Mutex/Sql/PAGE::lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_sync	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_active	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_pool	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_mysql_create_db	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_open	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_lock_db	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_thread_count	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_mapped_file	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_status	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_error_log	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delayed_insert	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_uuid_short	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delayed_status	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delayed_create	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_crypt	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_timezone	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_slave_list	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_active_mi	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_manager	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_global_read_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_global_system_variables	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_user_conn	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_prepared_stmt_count	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_connection_count	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_server_started	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_rpl_status	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delete	YES	YES
+Wait/Synch/Mutex/Sql/hash_filo::lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_ha_data	YES	YES
+Wait/Synch/Mutex/Sql/LOG::LOCK_log	YES	YES
+Wait/Synch/Mutex/Sql/BINLOG::LOCK_index	YES	YES
+Wait/Synch/Mutex/Sql/BINLOG::LOCK_prep_xids	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_logger	YES	YES
+Wait/Synch/Mutex/Sql/LOG_INFO_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_backupid	YES	YES
+Wait/Synch/Mutex/Sql/structure_guard_mutex	YES	YES
+Wait/Synch/Mutex/Sql/RLI_run_lock	YES	YES
+Wait/Synch/Mutex/Sql/RLI_data_lock	YES	YES
+Wait/Synch/Mutex/Sql/RLI_log_space_lock	YES	YES
+Wait/Synch/Mutex/Sql/MI_run_lock	YES	YES
+Wait/Synch/Mutex/Sql/MI_data_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_scheduler_state	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_event_metadata	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_event_queue	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_DDL_blocker	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_DDL_is_blocked	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_DDL_blocker_blocked	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_thread	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_caller	YES	YES
+Wait/Synch/Mutex/Sql/BRC_run_lock	YES	YES
+Wait/Synch/Mutex/Sql/DEBUG_SYNC::mutex	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_user_locks	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_mdl	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_thd_add	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_event_loop	YES	YES
+Wait/Synch/Mutex/Sql/Cversion_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_audit_mask	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_xid_cache	YES	YES
+Wait/Synch/Mutex/Sql/Delayed_insert_mutex	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_plugin	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_gdl	YES	YES
+Wait/Synch/Mutex/Sql/tz_LOCK	YES	YES
+Wait/Synch/Rwlock/Sql/LOCK_grant	YES	YES
+Wait/Synch/Rwlock/Sql/LOCK_sys_init_connect	YES	YES
+Wait/Synch/Rwlock/Sql/LOCK_sys_init_slave	YES	YES
+Wait/Synch/Rwlock/Sql/LOCK_system_variables_hash	YES	YES
+Wait/Synch/Rwlock/Sql/Query_cache_query::lock	YES	YES
+Wait/Synch/Cond/Sql/PAGE::cond	YES	YES
+Wait/Synch/Cond/Sql/COND_active	YES	YES
+Wait/Synch/Cond/Sql/COND_pool	YES	YES
+Wait/Synch/Cond/Sql/COND_server_started	YES	YES
+Wait/Synch/Cond/Sql/COND_refresh	YES	YES
+Wait/Synch/Cond/Sql/COND_thread_count	YES	YES
+Wait/Synch/Cond/Sql/COND_manager	YES	YES
+Wait/Synch/Cond/Sql/COND_global_read_lock	YES	YES
+Wait/Synch/Cond/Sql/COND_thread_cache	YES	YES
+Wait/Synch/Cond/Sql/COND_flush_thread_cache	YES	YES
+Wait/Synch/Cond/Sql/COND_rpl_status	YES	YES
+Wait/Synch/Cond/Sql/BINLOG::COND_prep_xids	YES	YES
+Wait/Synch/Cond/Sql/BINLOG::update_cond	YES	YES
+Wait/Synch/Cond/Sql/COND_cache_status_changed	YES	YES
+Wait/Synch/Cond/Sql/RLI_data_cond	YES	YES
+Wait/Synch/Cond/Sql/RLI_start_cond	YES	YES
+Wait/Synch/Cond/Sql/RLI_stop_cond	YES	YES
+Wait/Synch/Cond/Sql/RLI_log_space_cond	YES	YES
+Wait/Synch/Cond/Sql/MI_data_cond	YES	YES
+Wait/Synch/Cond/Sql/MI_start_cond	YES	YES
+Wait/Synch/Cond/Sql/MI_stop_cond	YES	YES
+Wait/Synch/Cond/Sql/Event_scheduler::COND_state	YES	YES
+Wait/Synch/Cond/Sql/COND_queue_state	YES	YES
+Wait/Synch/Cond/Sql/COND_DDL_blocker	YES	YES
+Wait/Synch/Cond/Sql/COND_process_blocked	YES	YES
+Wait/Synch/Cond/Sql/COND_DDL_blocker_blocked	YES	YES
+Wait/Synch/Cond/Sql/COND_thread_wait	YES	YES
+Wait/Synch/Cond/Sql/COND_caller_wait	YES	YES
+Wait/Synch/Cond/Sql/DEBUG_SYNC::cond	YES	YES
+Wait/Synch/Cond/Sql/ULL_cond	YES	YES
+Wait/Synch/Cond/Sql/Item_func_sleep::cond	YES	YES
+Wait/Synch/Cond/Sql/COND_mdl	YES	YES
+Wait/Synch/Cond/Sql/Delayed_insert_cond	YES	YES
+Wait/Synch/Cond/Sql/Delayed_insert_cond_client	YES	YES
 Wait/Synch/Mutex/mysys/KEY_CACHE::cache_lock	YES	YES
 Wait/Synch/Mutex/mysys/IO_CACHE::append_buffer_lock	YES	YES
 Wait/Synch/Mutex/mysys/IO_CACHE::SHARE_mutex	YES	YES
@@ -16,6 +119,7 @@ Wait/Synch/Mutex/mysys/THR_LOCK_isam	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_net	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_charset	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_time	YES	YES
+Wait/Synch/Mutex/mysys/THR_LOCK_isam	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_myisam	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_myisam_log	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_heap	YES	YES
@@ -29,109 +133,6 @@ Wait/Synch/Cond/mysys/IO_CACHE_SHARE::co
 Wait/Synch/Cond/mysys/COND_alarm	YES	YES
 Wait/Synch/Cond/mysys/THR_COND_threads	YES	YES
 Wait/Synch/Cond/mysys/my_thread_var::suspend	YES	YES
-Wait/Synch/Mutex/Core/LOCK_des_key_file	YES	YES
-Wait/Synch/Mutex/Core/PAGE::lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_sync	YES	YES
-Wait/Synch/Mutex/Core/LOCK_active	YES	YES
-Wait/Synch/Mutex/Core/LOCK_pool	YES	YES
-Wait/Synch/Mutex/Core/LOCK_mysql_create_db	YES	YES
-Wait/Synch/Mutex/Core/LOCK_open	YES	YES
-Wait/Synch/Mutex/Core/LOCK_lock_db	YES	YES
-Wait/Synch/Mutex/Core/LOCK_thread_count	YES	YES
-Wait/Synch/Mutex/Core/LOCK_mapped_file	YES	YES
-Wait/Synch/Mutex/Core/LOCK_status	YES	YES
-Wait/Synch/Mutex/Core/LOCK_error_log	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delayed_insert	YES	YES
-Wait/Synch/Mutex/Core/LOCK_uuid_short	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delayed_status	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delayed_create	YES	YES
-Wait/Synch/Mutex/Core/LOCK_crypt	YES	YES
-Wait/Synch/Mutex/Core/LOCK_timezone	YES	YES
-Wait/Synch/Mutex/Core/LOCK_slave_list	YES	YES
-Wait/Synch/Mutex/Core/LOCK_active_mi	YES	YES
-Wait/Synch/Mutex/Core/LOCK_manager	YES	YES
-Wait/Synch/Mutex/Core/LOCK_global_read_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_global_system_variables	YES	YES
-Wait/Synch/Mutex/Core/LOCK_user_conn	YES	YES
-Wait/Synch/Mutex/Core/LOCK_prepared_stmt_count	YES	YES
-Wait/Synch/Mutex/Core/LOCK_connection_count	YES	YES
-Wait/Synch/Mutex/Core/LOCK_server_started	YES	YES
-Wait/Synch/Mutex/Core/LOCK_rpl_status	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delete	YES	YES
-Wait/Synch/Mutex/Core/hash_filo::lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_ha_data	YES	YES
-Wait/Synch/Mutex/Core/LOG::LOCK_log	YES	YES
-Wait/Synch/Mutex/Core/BINLOG::LOCK_index	YES	YES
-Wait/Synch/Mutex/Core/BINLOG::LOCK_prep_xids	YES	YES
-Wait/Synch/Mutex/Core/LOCK_logger	YES	YES
-Wait/Synch/Mutex/Core/LOG_INFO_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_backupid	YES	YES
-Wait/Synch/Mutex/Core/structure_guard_mutex	YES	YES
-Wait/Synch/Mutex/Core/RLI_run_lock	YES	YES
-Wait/Synch/Mutex/Core/RLI_data_lock	YES	YES
-Wait/Synch/Mutex/Core/RLI_log_space_lock	YES	YES
-Wait/Synch/Mutex/Core/MI_run_lock	YES	YES
-Wait/Synch/Mutex/Core/MI_data_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_scheduler_state	YES	YES
-Wait/Synch/Mutex/Core/LOCK_event_metadata	YES	YES
-Wait/Synch/Mutex/Core/LOCK_event_queue	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_DDL_blocker	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_DDL_is_blocked	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_DDL_blocker_blocked	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_thread	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_caller	YES	YES
-Wait/Synch/Mutex/Core/BRC_run_lock	YES	YES
-Wait/Synch/Mutex/Core/DEBUG_SYNC::mutex	YES	YES
-Wait/Synch/Mutex/Core/LOCK_user_locks	YES	YES
-Wait/Synch/Mutex/Core/LOCK_mdl	YES	YES
-Wait/Synch/Mutex/Core/LOCK_thd_add	YES	YES
-Wait/Synch/Mutex/Core/LOCK_event_loop	YES	YES
-Wait/Synch/Mutex/Core/Cversion_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_audit_mask	YES	YES
-Wait/Synch/Mutex/Core/LOCK_xid_cache	YES	YES
-Wait/Synch/Mutex/Core/Delayed_insert_mutex	YES	YES
-Wait/Synch/Mutex/Core/LOCK_plugin	YES	YES
-Wait/Synch/Mutex/Core/LOCK_gdl	YES	YES
-Wait/Synch/Mutex/Core/tz_LOCK	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_grant	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_sys_init_connect	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_sys_init_slave	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_system_variables_hash	YES	YES
-Wait/Synch/Rwlock/Core/Query_cache_query::lock	YES	YES
-Wait/Synch/Cond/Core/PAGE::cond	YES	YES
-Wait/Synch/Cond/Core/COND_active	YES	YES
-Wait/Synch/Cond/Core/COND_pool	YES	YES
-Wait/Synch/Cond/Core/COND_server_started	YES	YES
-Wait/Synch/Cond/Core/COND_refresh	YES	YES
-Wait/Synch/Cond/Core/COND_thread_count	YES	YES
-Wait/Synch/Cond/Core/COND_manager	YES	YES
-Wait/Synch/Cond/Core/COND_global_read_lock	YES	YES
-Wait/Synch/Cond/Core/COND_thread_cache	YES	YES
-Wait/Synch/Cond/Core/COND_flush_thread_cache	YES	YES
-Wait/Synch/Cond/Core/COND_rpl_status	YES	YES
-Wait/Synch/Cond/Core/BINLOG::COND_prep_xids	YES	YES
-Wait/Synch/Cond/Core/BINLOG::update_cond	YES	YES
-Wait/Synch/Cond/Core/COND_cache_status_changed	YES	YES
-Wait/Synch/Cond/Core/RLI_data_cond	YES	YES
-Wait/Synch/Cond/Core/RLI_start_cond	YES	YES
-Wait/Synch/Cond/Core/RLI_stop_cond	YES	YES
-Wait/Synch/Cond/Core/RLI_log_space_cond	YES	YES
-Wait/Synch/Cond/Core/MI_data_cond	YES	YES
-Wait/Synch/Cond/Core/MI_start_cond	YES	YES
-Wait/Synch/Cond/Core/MI_stop_cond	YES	YES
-Wait/Synch/Cond/Core/Event_scheduler::COND_state	YES	YES
-Wait/Synch/Cond/Core/COND_queue_state	YES	YES
-Wait/Synch/Cond/Core/COND_DDL_blocker	YES	YES
-Wait/Synch/Cond/Core/COND_process_blocked	YES	YES
-Wait/Synch/Cond/Core/COND_DDL_blocker_blocked	YES	YES
-Wait/Synch/Cond/Core/COND_thread_wait	YES	YES
-Wait/Synch/Cond/Core/COND_caller_wait	YES	YES
-Wait/Synch/Cond/Core/DEBUG_SYNC::cond	YES	YES
-Wait/Synch/Cond/Core/ULL_cond	YES	YES
-Wait/Synch/Cond/Core/Item_func_sleep::cond	YES	YES
-Wait/Synch/Cond/Core/COND_mdl	YES	YES
-Wait/Synch/Cond/Core/Delayed_insert_cond	YES	YES
-Wait/Synch/Cond/Core/Delayed_insert_cond_client	YES	YES
 Wait/Synch/Mutex/myisam/MI_SORT_INFO::mutex	YES	YES
 Wait/Synch/Mutex/myisam/MYISAM_SHARE::intern_lock	YES	YES
 Wait/Synch/Rwlock/myisam/MYISAM_SHARE::key_root_lock	YES	YES
@@ -177,6 +178,70 @@ Wait/Synch/Mutex/myisammrg/MYRG_INFO::mu
 select * from performance_schema.setup_instruments
 where name like 'Wait/Synch/Mutex/%';
 NAME	ENABLED	TIMED
+Wait/Synch/Mutex/Sql/LOCK_des_key_file	YES	YES
+Wait/Synch/Mutex/Sql/PAGE::lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_sync	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_active	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_pool	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_mysql_create_db	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_open	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_lock_db	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_thread_count	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_mapped_file	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_status	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_error_log	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delayed_insert	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_uuid_short	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delayed_status	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delayed_create	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_crypt	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_timezone	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_slave_list	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_active_mi	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_manager	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_global_read_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_global_system_variables	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_user_conn	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_prepared_stmt_count	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_connection_count	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_server_started	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_rpl_status	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delete	YES	YES
+Wait/Synch/Mutex/Sql/hash_filo::lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_ha_data	YES	YES
+Wait/Synch/Mutex/Sql/LOG::LOCK_log	YES	YES
+Wait/Synch/Mutex/Sql/BINLOG::LOCK_index	YES	YES
+Wait/Synch/Mutex/Sql/BINLOG::LOCK_prep_xids	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_logger	YES	YES
+Wait/Synch/Mutex/Sql/LOG_INFO_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_backupid	YES	YES
+Wait/Synch/Mutex/Sql/structure_guard_mutex	YES	YES
+Wait/Synch/Mutex/Sql/RLI_run_lock	YES	YES
+Wait/Synch/Mutex/Sql/RLI_data_lock	YES	YES
+Wait/Synch/Mutex/Sql/RLI_log_space_lock	YES	YES
+Wait/Synch/Mutex/Sql/MI_run_lock	YES	YES
+Wait/Synch/Mutex/Sql/MI_data_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_scheduler_state	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_event_metadata	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_event_queue	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_DDL_blocker	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_DDL_is_blocked	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_DDL_blocker_blocked	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_thread	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_caller	YES	YES
+Wait/Synch/Mutex/Sql/BRC_run_lock	YES	YES
+Wait/Synch/Mutex/Sql/DEBUG_SYNC::mutex	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_user_locks	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_mdl	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_thd_add	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_event_loop	YES	YES
+Wait/Synch/Mutex/Sql/Cversion_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_audit_mask	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_xid_cache	YES	YES
+Wait/Synch/Mutex/Sql/Delayed_insert_mutex	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_plugin	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_gdl	YES	YES
+Wait/Synch/Mutex/Sql/tz_LOCK	YES	YES
 Wait/Synch/Mutex/mysys/KEY_CACHE::cache_lock	YES	YES
 Wait/Synch/Mutex/mysys/IO_CACHE::append_buffer_lock	YES	YES
 Wait/Synch/Mutex/mysys/IO_CACHE::SHARE_mutex	YES	YES
@@ -193,75 +258,12 @@ Wait/Synch/Mutex/mysys/THR_LOCK_isam	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_net	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_charset	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_time	YES	YES
+Wait/Synch/Mutex/mysys/THR_LOCK_isam	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_myisam	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_myisam_log	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_heap	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_threads	YES	YES
 Wait/Synch/Mutex/mysys/my_thread_var::mutex	YES	YES
-Wait/Synch/Mutex/Core/LOCK_des_key_file	YES	YES
-Wait/Synch/Mutex/Core/PAGE::lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_sync	YES	YES
-Wait/Synch/Mutex/Core/LOCK_active	YES	YES
-Wait/Synch/Mutex/Core/LOCK_pool	YES	YES
-Wait/Synch/Mutex/Core/LOCK_mysql_create_db	YES	YES
-Wait/Synch/Mutex/Core/LOCK_open	YES	YES
-Wait/Synch/Mutex/Core/LOCK_lock_db	YES	YES
-Wait/Synch/Mutex/Core/LOCK_thread_count	YES	YES
-Wait/Synch/Mutex/Core/LOCK_mapped_file	YES	YES
-Wait/Synch/Mutex/Core/LOCK_status	YES	YES
-Wait/Synch/Mutex/Core/LOCK_error_log	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delayed_insert	YES	YES
-Wait/Synch/Mutex/Core/LOCK_uuid_short	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delayed_status	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delayed_create	YES	YES
-Wait/Synch/Mutex/Core/LOCK_crypt	YES	YES
-Wait/Synch/Mutex/Core/LOCK_timezone	YES	YES
-Wait/Synch/Mutex/Core/LOCK_slave_list	YES	YES
-Wait/Synch/Mutex/Core/LOCK_active_mi	YES	YES
-Wait/Synch/Mutex/Core/LOCK_manager	YES	YES
-Wait/Synch/Mutex/Core/LOCK_global_read_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_global_system_variables	YES	YES
-Wait/Synch/Mutex/Core/LOCK_user_conn	YES	YES
-Wait/Synch/Mutex/Core/LOCK_prepared_stmt_count	YES	YES
-Wait/Synch/Mutex/Core/LOCK_connection_count	YES	YES
-Wait/Synch/Mutex/Core/LOCK_server_started	YES	YES
-Wait/Synch/Mutex/Core/LOCK_rpl_status	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delete	YES	YES
-Wait/Synch/Mutex/Core/hash_filo::lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_ha_data	YES	YES
-Wait/Synch/Mutex/Core/LOG::LOCK_log	YES	YES
-Wait/Synch/Mutex/Core/BINLOG::LOCK_index	YES	YES
-Wait/Synch/Mutex/Core/BINLOG::LOCK_prep_xids	YES	YES
-Wait/Synch/Mutex/Core/LOCK_logger	YES	YES
-Wait/Synch/Mutex/Core/LOG_INFO_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_backupid	YES	YES
-Wait/Synch/Mutex/Core/structure_guard_mutex	YES	YES
-Wait/Synch/Mutex/Core/RLI_run_lock	YES	YES
-Wait/Synch/Mutex/Core/RLI_data_lock	YES	YES
-Wait/Synch/Mutex/Core/RLI_log_space_lock	YES	YES
-Wait/Synch/Mutex/Core/MI_run_lock	YES	YES
-Wait/Synch/Mutex/Core/MI_data_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_scheduler_state	YES	YES
-Wait/Synch/Mutex/Core/LOCK_event_metadata	YES	YES
-Wait/Synch/Mutex/Core/LOCK_event_queue	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_DDL_blocker	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_DDL_is_blocked	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_DDL_blocker_blocked	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_thread	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_caller	YES	YES
-Wait/Synch/Mutex/Core/BRC_run_lock	YES	YES
-Wait/Synch/Mutex/Core/DEBUG_SYNC::mutex	YES	YES
-Wait/Synch/Mutex/Core/LOCK_user_locks	YES	YES
-Wait/Synch/Mutex/Core/LOCK_mdl	YES	YES
-Wait/Synch/Mutex/Core/LOCK_thd_add	YES	YES
-Wait/Synch/Mutex/Core/LOCK_event_loop	YES	YES
-Wait/Synch/Mutex/Core/Cversion_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_audit_mask	YES	YES
-Wait/Synch/Mutex/Core/LOCK_xid_cache	YES	YES
-Wait/Synch/Mutex/Core/Delayed_insert_mutex	YES	YES
-Wait/Synch/Mutex/Core/LOCK_plugin	YES	YES
-Wait/Synch/Mutex/Core/LOCK_gdl	YES	YES
-Wait/Synch/Mutex/Core/tz_LOCK	YES	YES
 Wait/Synch/Mutex/myisam/MI_SORT_INFO::mutex	YES	YES
 Wait/Synch/Mutex/myisam/MYISAM_SHARE::intern_lock	YES	YES
 Wait/Synch/Mutex/tina/tina_mutex	YES	YES
@@ -293,13 +295,13 @@ Wait/Synch/Mutex/myisammrg/MYRG_INFO::mu
 select * from performance_schema.setup_instruments
 where name like 'Wait/Synch/Rwlock/%';
 NAME	ENABLED	TIMED
+Wait/Synch/Rwlock/Sql/LOCK_grant	YES	YES
+Wait/Synch/Rwlock/Sql/LOCK_sys_init_connect	YES	YES
+Wait/Synch/Rwlock/Sql/LOCK_sys_init_slave	YES	YES
+Wait/Synch/Rwlock/Sql/LOCK_system_variables_hash	YES	YES
+Wait/Synch/Rwlock/Sql/Query_cache_query::lock	YES	YES
 Wait/Synch/Rwlock/mysys/WT_RESOURCE::lock	YES	YES
 Wait/Synch/Rwlock/mysys/SAFE_HASH_mutex	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_grant	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_sys_init_connect	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_sys_init_slave	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_system_variables_hash	YES	YES
-Wait/Synch/Rwlock/Core/Query_cache_query::lock	YES	YES
 Wait/Synch/Rwlock/myisam/MYISAM_SHARE::key_root_lock	YES	YES
 Wait/Synch/Rwlock/myisam/MYISAM_SHARE::mmap_lock	YES	YES
 Wait/Synch/Rwlock/Maria/MARIA_KEYDEF::root_lock	YES	YES
@@ -309,46 +311,46 @@ Wait/Synch/Rwlock/Maria/translog_d::open
 select * from performance_schema.setup_instruments
 where name like 'Wait/Synch/Cond/%';
 NAME	ENABLED	TIMED
+Wait/Synch/Cond/Sql/PAGE::cond	YES	YES
+Wait/Synch/Cond/Sql/COND_active	YES	YES
+Wait/Synch/Cond/Sql/COND_pool	YES	YES
+Wait/Synch/Cond/Sql/COND_server_started	YES	YES
+Wait/Synch/Cond/Sql/COND_refresh	YES	YES
+Wait/Synch/Cond/Sql/COND_thread_count	YES	YES
+Wait/Synch/Cond/Sql/COND_manager	YES	YES
+Wait/Synch/Cond/Sql/COND_global_read_lock	YES	YES
+Wait/Synch/Cond/Sql/COND_thread_cache	YES	YES
+Wait/Synch/Cond/Sql/COND_flush_thread_cache	YES	YES
+Wait/Synch/Cond/Sql/COND_rpl_status	YES	YES
+Wait/Synch/Cond/Sql/BINLOG::COND_prep_xids	YES	YES
+Wait/Synch/Cond/Sql/BINLOG::update_cond	YES	YES
+Wait/Synch/Cond/Sql/COND_cache_status_changed	YES	YES
+Wait/Synch/Cond/Sql/RLI_data_cond	YES	YES
+Wait/Synch/Cond/Sql/RLI_start_cond	YES	YES
+Wait/Synch/Cond/Sql/RLI_stop_cond	YES	YES
+Wait/Synch/Cond/Sql/RLI_log_space_cond	YES	YES
+Wait/Synch/Cond/Sql/MI_data_cond	YES	YES
+Wait/Synch/Cond/Sql/MI_start_cond	YES	YES
+Wait/Synch/Cond/Sql/MI_stop_cond	YES	YES
+Wait/Synch/Cond/Sql/Event_scheduler::COND_state	YES	YES
+Wait/Synch/Cond/Sql/COND_queue_state	YES	YES
+Wait/Synch/Cond/Sql/COND_DDL_blocker	YES	YES
+Wait/Synch/Cond/Sql/COND_process_blocked	YES	YES
+Wait/Synch/Cond/Sql/COND_DDL_blocker_blocked	YES	YES
+Wait/Synch/Cond/Sql/COND_thread_wait	YES	YES
+Wait/Synch/Cond/Sql/COND_caller_wait	YES	YES
+Wait/Synch/Cond/Sql/DEBUG_SYNC::cond	YES	YES
+Wait/Synch/Cond/Sql/ULL_cond	YES	YES
+Wait/Synch/Cond/Sql/Item_func_sleep::cond	YES	YES
+Wait/Synch/Cond/Sql/COND_mdl	YES	YES
+Wait/Synch/Cond/Sql/Delayed_insert_cond	YES	YES
+Wait/Synch/Cond/Sql/Delayed_insert_cond_client	YES	YES
 Wait/Synch/Cond/mysys/WT_RESOURCE::cond	YES	YES
 Wait/Synch/Cond/mysys/IO_CACHE_SHARE::cond	YES	YES
 Wait/Synch/Cond/mysys/IO_CACHE_SHARE::cond_writer	YES	YES
 Wait/Synch/Cond/mysys/COND_alarm	YES	YES
 Wait/Synch/Cond/mysys/THR_COND_threads	YES	YES
 Wait/Synch/Cond/mysys/my_thread_var::suspend	YES	YES
-Wait/Synch/Cond/Core/PAGE::cond	YES	YES
-Wait/Synch/Cond/Core/COND_active	YES	YES
-Wait/Synch/Cond/Core/COND_pool	YES	YES
-Wait/Synch/Cond/Core/COND_server_started	YES	YES
-Wait/Synch/Cond/Core/COND_refresh	YES	YES
-Wait/Synch/Cond/Core/COND_thread_count	YES	YES
-Wait/Synch/Cond/Core/COND_manager	YES	YES
-Wait/Synch/Cond/Core/COND_global_read_lock	YES	YES
-Wait/Synch/Cond/Core/COND_thread_cache	YES	YES
-Wait/Synch/Cond/Core/COND_flush_thread_cache	YES	YES
-Wait/Synch/Cond/Core/COND_rpl_status	YES	YES
-Wait/Synch/Cond/Core/BINLOG::COND_prep_xids	YES	YES
-Wait/Synch/Cond/Core/BINLOG::update_cond	YES	YES
-Wait/Synch/Cond/Core/COND_cache_status_changed	YES	YES
-Wait/Synch/Cond/Core/RLI_data_cond	YES	YES
-Wait/Synch/Cond/Core/RLI_start_cond	YES	YES
-Wait/Synch/Cond/Core/RLI_stop_cond	YES	YES
-Wait/Synch/Cond/Core/RLI_log_space_cond	YES	YES
-Wait/Synch/Cond/Core/MI_data_cond	YES	YES
-Wait/Synch/Cond/Core/MI_start_cond	YES	YES
-Wait/Synch/Cond/Core/MI_stop_cond	YES	YES
-Wait/Synch/Cond/Core/Event_scheduler::COND_state	YES	YES
-Wait/Synch/Cond/Core/COND_queue_state	YES	YES
-Wait/Synch/Cond/Core/COND_DDL_blocker	YES	YES
-Wait/Synch/Cond/Core/COND_process_blocked	YES	YES
-Wait/Synch/Cond/Core/COND_DDL_blocker_blocked	YES	YES
-Wait/Synch/Cond/Core/COND_thread_wait	YES	YES
-Wait/Synch/Cond/Core/COND_caller_wait	YES	YES
-Wait/Synch/Cond/Core/DEBUG_SYNC::cond	YES	YES
-Wait/Synch/Cond/Core/ULL_cond	YES	YES
-Wait/Synch/Cond/Core/Item_func_sleep::cond	YES	YES
-Wait/Synch/Cond/Core/COND_mdl	YES	YES
-Wait/Synch/Cond/Core/Delayed_insert_cond	YES	YES
-Wait/Synch/Cond/Core/Delayed_insert_cond_client	YES	YES
 Wait/Synch/Cond/myisam/MI_SORT_INFO::cond	YES	YES
 Wait/Synch/Cond/archive/azio_container::threshhold	YES	YES
 Wait/Synch/Cond/Maria/MARIA_SHARE::intern_cond	YES	YES
@@ -363,6 +365,109 @@ NAME	ENABLED	TIMED
 select * from performance_schema.setup_instruments
 where enabled='YES';
 NAME	ENABLED	TIMED
+Wait/Synch/Mutex/Sql/LOCK_des_key_file	YES	YES
+Wait/Synch/Mutex/Sql/PAGE::lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_sync	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_active	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_pool	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_mysql_create_db	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_open	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_lock_db	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_thread_count	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_mapped_file	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_status	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_error_log	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delayed_insert	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_uuid_short	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delayed_status	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delayed_create	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_crypt	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_timezone	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_slave_list	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_active_mi	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_manager	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_global_read_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_global_system_variables	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_user_conn	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_prepared_stmt_count	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_connection_count	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_server_started	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_rpl_status	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delete	YES	YES
+Wait/Synch/Mutex/Sql/hash_filo::lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_ha_data	YES	YES
+Wait/Synch/Mutex/Sql/LOG::LOCK_log	YES	YES
+Wait/Synch/Mutex/Sql/BINLOG::LOCK_index	YES	YES
+Wait/Synch/Mutex/Sql/BINLOG::LOCK_prep_xids	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_logger	YES	YES
+Wait/Synch/Mutex/Sql/LOG_INFO_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_backupid	YES	YES
+Wait/Synch/Mutex/Sql/structure_guard_mutex	YES	YES
+Wait/Synch/Mutex/Sql/RLI_run_lock	YES	YES
+Wait/Synch/Mutex/Sql/RLI_data_lock	YES	YES
+Wait/Synch/Mutex/Sql/RLI_log_space_lock	YES	YES
+Wait/Synch/Mutex/Sql/MI_run_lock	YES	YES
+Wait/Synch/Mutex/Sql/MI_data_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_scheduler_state	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_event_metadata	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_event_queue	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_DDL_blocker	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_DDL_is_blocked	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_DDL_blocker_blocked	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_thread	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_caller	YES	YES
+Wait/Synch/Mutex/Sql/BRC_run_lock	YES	YES
+Wait/Synch/Mutex/Sql/DEBUG_SYNC::mutex	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_user_locks	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_mdl	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_thd_add	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_event_loop	YES	YES
+Wait/Synch/Mutex/Sql/Cversion_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_audit_mask	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_xid_cache	YES	YES
+Wait/Synch/Mutex/Sql/Delayed_insert_mutex	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_plugin	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_gdl	YES	YES
+Wait/Synch/Mutex/Sql/tz_LOCK	YES	YES
+Wait/Synch/Rwlock/Sql/LOCK_grant	YES	YES
+Wait/Synch/Rwlock/Sql/LOCK_sys_init_connect	YES	YES
+Wait/Synch/Rwlock/Sql/LOCK_sys_init_slave	YES	YES
+Wait/Synch/Rwlock/Sql/LOCK_system_variables_hash	YES	YES
+Wait/Synch/Rwlock/Sql/Query_cache_query::lock	YES	YES
+Wait/Synch/Cond/Sql/PAGE::cond	YES	YES
+Wait/Synch/Cond/Sql/COND_active	YES	YES
+Wait/Synch/Cond/Sql/COND_pool	YES	YES
+Wait/Synch/Cond/Sql/COND_server_started	YES	YES
+Wait/Synch/Cond/Sql/COND_refresh	YES	YES
+Wait/Synch/Cond/Sql/COND_thread_count	YES	YES
+Wait/Synch/Cond/Sql/COND_manager	YES	YES
+Wait/Synch/Cond/Sql/COND_global_read_lock	YES	YES
+Wait/Synch/Cond/Sql/COND_thread_cache	YES	YES
+Wait/Synch/Cond/Sql/COND_flush_thread_cache	YES	YES
+Wait/Synch/Cond/Sql/COND_rpl_status	YES	YES
+Wait/Synch/Cond/Sql/BINLOG::COND_prep_xids	YES	YES
+Wait/Synch/Cond/Sql/BINLOG::update_cond	YES	YES
+Wait/Synch/Cond/Sql/COND_cache_status_changed	YES	YES
+Wait/Synch/Cond/Sql/RLI_data_cond	YES	YES
+Wait/Synch/Cond/Sql/RLI_start_cond	YES	YES
+Wait/Synch/Cond/Sql/RLI_stop_cond	YES	YES
+Wait/Synch/Cond/Sql/RLI_log_space_cond	YES	YES
+Wait/Synch/Cond/Sql/MI_data_cond	YES	YES
+Wait/Synch/Cond/Sql/MI_start_cond	YES	YES
+Wait/Synch/Cond/Sql/MI_stop_cond	YES	YES
+Wait/Synch/Cond/Sql/Event_scheduler::COND_state	YES	YES
+Wait/Synch/Cond/Sql/COND_queue_state	YES	YES
+Wait/Synch/Cond/Sql/COND_DDL_blocker	YES	YES
+Wait/Synch/Cond/Sql/COND_process_blocked	YES	YES
+Wait/Synch/Cond/Sql/COND_DDL_blocker_blocked	YES	YES
+Wait/Synch/Cond/Sql/COND_thread_wait	YES	YES
+Wait/Synch/Cond/Sql/COND_caller_wait	YES	YES
+Wait/Synch/Cond/Sql/DEBUG_SYNC::cond	YES	YES
+Wait/Synch/Cond/Sql/ULL_cond	YES	YES
+Wait/Synch/Cond/Sql/Item_func_sleep::cond	YES	YES
+Wait/Synch/Cond/Sql/COND_mdl	YES	YES
+Wait/Synch/Cond/Sql/Delayed_insert_cond	YES	YES
+Wait/Synch/Cond/Sql/Delayed_insert_cond_client	YES	YES
 Wait/Synch/Mutex/mysys/KEY_CACHE::cache_lock	YES	YES
 Wait/Synch/Mutex/mysys/IO_CACHE::append_buffer_lock	YES	YES
 Wait/Synch/Mutex/mysys/IO_CACHE::SHARE_mutex	YES	YES
@@ -379,6 +484,7 @@ Wait/Synch/Mutex/mysys/THR_LOCK_isam	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_net	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_charset	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_time	YES	YES
+Wait/Synch/Mutex/mysys/THR_LOCK_isam	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_myisam	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_myisam_log	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_heap	YES	YES
@@ -392,109 +498,6 @@ Wait/Synch/Cond/mysys/IO_CACHE_SHARE::co
 Wait/Synch/Cond/mysys/COND_alarm	YES	YES
 Wait/Synch/Cond/mysys/THR_COND_threads	YES	YES
 Wait/Synch/Cond/mysys/my_thread_var::suspend	YES	YES
-Wait/Synch/Mutex/Core/LOCK_des_key_file	YES	YES
-Wait/Synch/Mutex/Core/PAGE::lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_sync	YES	YES
-Wait/Synch/Mutex/Core/LOCK_active	YES	YES
-Wait/Synch/Mutex/Core/LOCK_pool	YES	YES
-Wait/Synch/Mutex/Core/LOCK_mysql_create_db	YES	YES
-Wait/Synch/Mutex/Core/LOCK_open	YES	YES
-Wait/Synch/Mutex/Core/LOCK_lock_db	YES	YES
-Wait/Synch/Mutex/Core/LOCK_thread_count	YES	YES
-Wait/Synch/Mutex/Core/LOCK_mapped_file	YES	YES
-Wait/Synch/Mutex/Core/LOCK_status	YES	YES
-Wait/Synch/Mutex/Core/LOCK_error_log	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delayed_insert	YES	YES
-Wait/Synch/Mutex/Core/LOCK_uuid_short	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delayed_status	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delayed_create	YES	YES
-Wait/Synch/Mutex/Core/LOCK_crypt	YES	YES
-Wait/Synch/Mutex/Core/LOCK_timezone	YES	YES
-Wait/Synch/Mutex/Core/LOCK_slave_list	YES	YES
-Wait/Synch/Mutex/Core/LOCK_active_mi	YES	YES
-Wait/Synch/Mutex/Core/LOCK_manager	YES	YES
-Wait/Synch/Mutex/Core/LOCK_global_read_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_global_system_variables	YES	YES
-Wait/Synch/Mutex/Core/LOCK_user_conn	YES	YES
-Wait/Synch/Mutex/Core/LOCK_prepared_stmt_count	YES	YES
-Wait/Synch/Mutex/Core/LOCK_connection_count	YES	YES
-Wait/Synch/Mutex/Core/LOCK_server_started	YES	YES
-Wait/Synch/Mutex/Core/LOCK_rpl_status	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delete	YES	YES
-Wait/Synch/Mutex/Core/hash_filo::lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_ha_data	YES	YES
-Wait/Synch/Mutex/Core/LOG::LOCK_log	YES	YES
-Wait/Synch/Mutex/Core/BINLOG::LOCK_index	YES	YES
-Wait/Synch/Mutex/Core/BINLOG::LOCK_prep_xids	YES	YES
-Wait/Synch/Mutex/Core/LOCK_logger	YES	YES
-Wait/Synch/Mutex/Core/LOG_INFO_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_backupid	YES	YES
-Wait/Synch/Mutex/Core/structure_guard_mutex	YES	YES
-Wait/Synch/Mutex/Core/RLI_run_lock	YES	YES
-Wait/Synch/Mutex/Core/RLI_data_lock	YES	YES
-Wait/Synch/Mutex/Core/RLI_log_space_lock	YES	YES
-Wait/Synch/Mutex/Core/MI_run_lock	YES	YES
-Wait/Synch/Mutex/Core/MI_data_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_scheduler_state	YES	YES
-Wait/Synch/Mutex/Core/LOCK_event_metadata	YES	YES
-Wait/Synch/Mutex/Core/LOCK_event_queue	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_DDL_blocker	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_DDL_is_blocked	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_DDL_blocker_blocked	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_thread	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_caller	YES	YES
-Wait/Synch/Mutex/Core/BRC_run_lock	YES	YES
-Wait/Synch/Mutex/Core/DEBUG_SYNC::mutex	YES	YES
-Wait/Synch/Mutex/Core/LOCK_user_locks	YES	YES
-Wait/Synch/Mutex/Core/LOCK_mdl	YES	YES
-Wait/Synch/Mutex/Core/LOCK_thd_add	YES	YES
-Wait/Synch/Mutex/Core/LOCK_event_loop	YES	YES
-Wait/Synch/Mutex/Core/Cversion_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_audit_mask	YES	YES
-Wait/Synch/Mutex/Core/LOCK_xid_cache	YES	YES
-Wait/Synch/Mutex/Core/Delayed_insert_mutex	YES	YES
-Wait/Synch/Mutex/Core/LOCK_plugin	YES	YES
-Wait/Synch/Mutex/Core/LOCK_gdl	YES	YES
-Wait/Synch/Mutex/Core/tz_LOCK	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_grant	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_sys_init_connect	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_sys_init_slave	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_system_variables_hash	YES	YES
-Wait/Synch/Rwlock/Core/Query_cache_query::lock	YES	YES
-Wait/Synch/Cond/Core/PAGE::cond	YES	YES
-Wait/Synch/Cond/Core/COND_active	YES	YES
-Wait/Synch/Cond/Core/COND_pool	YES	YES
-Wait/Synch/Cond/Core/COND_server_started	YES	YES
-Wait/Synch/Cond/Core/COND_refresh	YES	YES
-Wait/Synch/Cond/Core/COND_thread_count	YES	YES
-Wait/Synch/Cond/Core/COND_manager	YES	YES
-Wait/Synch/Cond/Core/COND_global_read_lock	YES	YES
-Wait/Synch/Cond/Core/COND_thread_cache	YES	YES
-Wait/Synch/Cond/Core/COND_flush_thread_cache	YES	YES
-Wait/Synch/Cond/Core/COND_rpl_status	YES	YES
-Wait/Synch/Cond/Core/BINLOG::COND_prep_xids	YES	YES
-Wait/Synch/Cond/Core/BINLOG::update_cond	YES	YES
-Wait/Synch/Cond/Core/COND_cache_status_changed	YES	YES
-Wait/Synch/Cond/Core/RLI_data_cond	YES	YES
-Wait/Synch/Cond/Core/RLI_start_cond	YES	YES
-Wait/Synch/Cond/Core/RLI_stop_cond	YES	YES
-Wait/Synch/Cond/Core/RLI_log_space_cond	YES	YES
-Wait/Synch/Cond/Core/MI_data_cond	YES	YES
-Wait/Synch/Cond/Core/MI_start_cond	YES	YES
-Wait/Synch/Cond/Core/MI_stop_cond	YES	YES
-Wait/Synch/Cond/Core/Event_scheduler::COND_state	YES	YES
-Wait/Synch/Cond/Core/COND_queue_state	YES	YES
-Wait/Synch/Cond/Core/COND_DDL_blocker	YES	YES
-Wait/Synch/Cond/Core/COND_process_blocked	YES	YES
-Wait/Synch/Cond/Core/COND_DDL_blocker_blocked	YES	YES
-Wait/Synch/Cond/Core/COND_thread_wait	YES	YES
-Wait/Synch/Cond/Core/COND_caller_wait	YES	YES
-Wait/Synch/Cond/Core/DEBUG_SYNC::cond	YES	YES
-Wait/Synch/Cond/Core/ULL_cond	YES	YES
-Wait/Synch/Cond/Core/Item_func_sleep::cond	YES	YES
-Wait/Synch/Cond/Core/COND_mdl	YES	YES
-Wait/Synch/Cond/Core/Delayed_insert_cond	YES	YES
-Wait/Synch/Cond/Core/Delayed_insert_cond_client	YES	YES
 Wait/Synch/Mutex/myisam/MI_SORT_INFO::mutex	YES	YES
 Wait/Synch/Mutex/myisam/MYISAM_SHARE::intern_lock	YES	YES
 Wait/Synch/Rwlock/myisam/MYISAM_SHARE::key_root_lock	YES	YES
@@ -549,7 +552,110 @@ update performance_schema.setup_instrume
 set timed='NO';
 select * from performance_schema.setup_instruments;
 NAME	ENABLED	TIMED
-Wait/Synch/Mutex/mysys/KEY_CACHE::cache_lock	NO	NO
+Wait/Synch/Mutex/Sql/LOCK_des_key_file	NO	NO
+Wait/Synch/Mutex/Sql/PAGE::lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_sync	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_active	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_pool	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_mysql_create_db	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_open	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_lock_db	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_thread_count	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_mapped_file	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_status	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_error_log	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delayed_insert	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_uuid_short	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delayed_status	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delayed_create	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_crypt	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_timezone	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_slave_list	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_active_mi	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_manager	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_global_read_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_global_system_variables	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_user_conn	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_prepared_stmt_count	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_connection_count	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_server_started	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_rpl_status	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_delete	YES	YES
+Wait/Synch/Mutex/Sql/hash_filo::lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_ha_data	YES	YES
+Wait/Synch/Mutex/Sql/LOG::LOCK_log	YES	YES
+Wait/Synch/Mutex/Sql/BINLOG::LOCK_index	YES	YES
+Wait/Synch/Mutex/Sql/BINLOG::LOCK_prep_xids	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_logger	YES	YES
+Wait/Synch/Mutex/Sql/LOG_INFO_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_backupid	YES	YES
+Wait/Synch/Mutex/Sql/structure_guard_mutex	YES	YES
+Wait/Synch/Mutex/Sql/RLI_run_lock	YES	YES
+Wait/Synch/Mutex/Sql/RLI_data_lock	YES	YES
+Wait/Synch/Mutex/Sql/RLI_log_space_lock	YES	YES
+Wait/Synch/Mutex/Sql/MI_run_lock	YES	YES
+Wait/Synch/Mutex/Sql/MI_data_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_scheduler_state	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_event_metadata	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_event_queue	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_DDL_blocker	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_DDL_is_blocked	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_DDL_blocker_blocked	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_thread	YES	YES
+Wait/Synch/Mutex/Sql/THR_LOCK_caller	YES	YES
+Wait/Synch/Mutex/Sql/BRC_run_lock	YES	YES
+Wait/Synch/Mutex/Sql/DEBUG_SYNC::mutex	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_user_locks	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_mdl	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_thd_add	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_event_loop	YES	YES
+Wait/Synch/Mutex/Sql/Cversion_lock	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_audit_mask	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_xid_cache	YES	YES
+Wait/Synch/Mutex/Sql/Delayed_insert_mutex	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_plugin	YES	YES
+Wait/Synch/Mutex/Sql/LOCK_gdl	YES	YES
+Wait/Synch/Mutex/Sql/tz_LOCK	YES	YES
+Wait/Synch/Rwlock/Sql/LOCK_grant	YES	YES
+Wait/Synch/Rwlock/Sql/LOCK_sys_init_connect	YES	YES
+Wait/Synch/Rwlock/Sql/LOCK_sys_init_slave	YES	YES
+Wait/Synch/Rwlock/Sql/LOCK_system_variables_hash	YES	YES
+Wait/Synch/Rwlock/Sql/Query_cache_query::lock	YES	YES
+Wait/Synch/Cond/Sql/PAGE::cond	YES	YES
+Wait/Synch/Cond/Sql/COND_active	YES	YES
+Wait/Synch/Cond/Sql/COND_pool	YES	YES
+Wait/Synch/Cond/Sql/COND_server_started	YES	YES
+Wait/Synch/Cond/Sql/COND_refresh	YES	YES
+Wait/Synch/Cond/Sql/COND_thread_count	YES	YES
+Wait/Synch/Cond/Sql/COND_manager	YES	YES
+Wait/Synch/Cond/Sql/COND_global_read_lock	YES	YES
+Wait/Synch/Cond/Sql/COND_thread_cache	YES	YES
+Wait/Synch/Cond/Sql/COND_flush_thread_cache	YES	YES
+Wait/Synch/Cond/Sql/COND_rpl_status	YES	YES
+Wait/Synch/Cond/Sql/BINLOG::COND_prep_xids	YES	YES
+Wait/Synch/Cond/Sql/BINLOG::update_cond	YES	YES
+Wait/Synch/Cond/Sql/COND_cache_status_changed	YES	YES
+Wait/Synch/Cond/Sql/RLI_data_cond	YES	YES
+Wait/Synch/Cond/Sql/RLI_start_cond	YES	YES
+Wait/Synch/Cond/Sql/RLI_stop_cond	YES	YES
+Wait/Synch/Cond/Sql/RLI_log_space_cond	YES	YES
+Wait/Synch/Cond/Sql/MI_data_cond	YES	YES
+Wait/Synch/Cond/Sql/MI_start_cond	YES	YES
+Wait/Synch/Cond/Sql/MI_stop_cond	YES	YES
+Wait/Synch/Cond/Sql/Event_scheduler::COND_state	YES	YES
+Wait/Synch/Cond/Sql/COND_queue_state	YES	YES
+Wait/Synch/Cond/Sql/COND_DDL_blocker	YES	YES
+Wait/Synch/Cond/Sql/COND_process_blocked	YES	YES
+Wait/Synch/Cond/Sql/COND_DDL_blocker_blocked	YES	YES
+Wait/Synch/Cond/Sql/COND_thread_wait	YES	YES
+Wait/Synch/Cond/Sql/COND_caller_wait	YES	YES
+Wait/Synch/Cond/Sql/DEBUG_SYNC::cond	YES	YES
+Wait/Synch/Cond/Sql/ULL_cond	YES	YES
+Wait/Synch/Cond/Sql/Item_func_sleep::cond	YES	YES
+Wait/Synch/Cond/Sql/COND_mdl	YES	YES
+Wait/Synch/Cond/Sql/Delayed_insert_cond	YES	YES
+Wait/Synch/Cond/Sql/Delayed_insert_cond_client	YES	YES
+Wait/Synch/Mutex/mysys/KEY_CACHE::cache_lock	YES	YES
 Wait/Synch/Mutex/mysys/IO_CACHE::append_buffer_lock	YES	YES
 Wait/Synch/Mutex/mysys/IO_CACHE::SHARE_mutex	YES	YES
 Wait/Synch/Mutex/mysys/TMPDIR_mutex	YES	YES
@@ -565,6 +671,7 @@ Wait/Synch/Mutex/mysys/THR_LOCK_isam	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_net	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_charset	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_time	YES	YES
+Wait/Synch/Mutex/mysys/THR_LOCK_isam	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_myisam	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_myisam_log	YES	YES
 Wait/Synch/Mutex/mysys/THR_LOCK_heap	YES	YES
@@ -578,109 +685,6 @@ Wait/Synch/Cond/mysys/IO_CACHE_SHARE::co
 Wait/Synch/Cond/mysys/COND_alarm	YES	YES
 Wait/Synch/Cond/mysys/THR_COND_threads	YES	YES
 Wait/Synch/Cond/mysys/my_thread_var::suspend	YES	YES
-Wait/Synch/Mutex/Core/LOCK_des_key_file	YES	YES
-Wait/Synch/Mutex/Core/PAGE::lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_sync	YES	YES
-Wait/Synch/Mutex/Core/LOCK_active	YES	YES
-Wait/Synch/Mutex/Core/LOCK_pool	YES	YES
-Wait/Synch/Mutex/Core/LOCK_mysql_create_db	YES	YES
-Wait/Synch/Mutex/Core/LOCK_open	YES	YES
-Wait/Synch/Mutex/Core/LOCK_lock_db	YES	YES
-Wait/Synch/Mutex/Core/LOCK_thread_count	YES	YES
-Wait/Synch/Mutex/Core/LOCK_mapped_file	YES	YES
-Wait/Synch/Mutex/Core/LOCK_status	YES	YES
-Wait/Synch/Mutex/Core/LOCK_error_log	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delayed_insert	YES	YES
-Wait/Synch/Mutex/Core/LOCK_uuid_short	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delayed_status	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delayed_create	YES	YES
-Wait/Synch/Mutex/Core/LOCK_crypt	YES	YES
-Wait/Synch/Mutex/Core/LOCK_timezone	YES	YES
-Wait/Synch/Mutex/Core/LOCK_slave_list	YES	YES
-Wait/Synch/Mutex/Core/LOCK_active_mi	YES	YES
-Wait/Synch/Mutex/Core/LOCK_manager	YES	YES
-Wait/Synch/Mutex/Core/LOCK_global_read_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_global_system_variables	YES	YES
-Wait/Synch/Mutex/Core/LOCK_user_conn	YES	YES
-Wait/Synch/Mutex/Core/LOCK_prepared_stmt_count	YES	YES
-Wait/Synch/Mutex/Core/LOCK_connection_count	YES	YES
-Wait/Synch/Mutex/Core/LOCK_server_started	YES	YES
-Wait/Synch/Mutex/Core/LOCK_rpl_status	YES	YES
-Wait/Synch/Mutex/Core/LOCK_delete	YES	YES
-Wait/Synch/Mutex/Core/hash_filo::lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_ha_data	YES	YES
-Wait/Synch/Mutex/Core/LOG::LOCK_log	YES	YES
-Wait/Synch/Mutex/Core/BINLOG::LOCK_index	YES	YES
-Wait/Synch/Mutex/Core/BINLOG::LOCK_prep_xids	YES	YES
-Wait/Synch/Mutex/Core/LOCK_logger	YES	YES
-Wait/Synch/Mutex/Core/LOG_INFO_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_backupid	YES	YES
-Wait/Synch/Mutex/Core/structure_guard_mutex	YES	YES
-Wait/Synch/Mutex/Core/RLI_run_lock	YES	YES
-Wait/Synch/Mutex/Core/RLI_data_lock	YES	YES
-Wait/Synch/Mutex/Core/RLI_log_space_lock	YES	YES
-Wait/Synch/Mutex/Core/MI_run_lock	YES	YES
-Wait/Synch/Mutex/Core/MI_data_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_scheduler_state	YES	YES
-Wait/Synch/Mutex/Core/LOCK_event_metadata	YES	YES
-Wait/Synch/Mutex/Core/LOCK_event_queue	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_DDL_blocker	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_DDL_is_blocked	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_DDL_blocker_blocked	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_thread	YES	YES
-Wait/Synch/Mutex/Core/THR_LOCK_caller	YES	YES
-Wait/Synch/Mutex/Core/BRC_run_lock	YES	YES
-Wait/Synch/Mutex/Core/DEBUG_SYNC::mutex	YES	YES
-Wait/Synch/Mutex/Core/LOCK_user_locks	YES	YES
-Wait/Synch/Mutex/Core/LOCK_mdl	YES	YES
-Wait/Synch/Mutex/Core/LOCK_thd_add	YES	YES
-Wait/Synch/Mutex/Core/LOCK_event_loop	YES	YES
-Wait/Synch/Mutex/Core/Cversion_lock	YES	YES
-Wait/Synch/Mutex/Core/LOCK_audit_mask	YES	YES
-Wait/Synch/Mutex/Core/LOCK_xid_cache	YES	YES
-Wait/Synch/Mutex/Core/Delayed_insert_mutex	YES	YES
-Wait/Synch/Mutex/Core/LOCK_plugin	YES	YES
-Wait/Synch/Mutex/Core/LOCK_gdl	YES	YES
-Wait/Synch/Mutex/Core/tz_LOCK	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_grant	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_sys_init_connect	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_sys_init_slave	YES	YES
-Wait/Synch/Rwlock/Core/LOCK_system_variables_hash	YES	YES
-Wait/Synch/Rwlock/Core/Query_cache_query::lock	YES	YES
-Wait/Synch/Cond/Core/PAGE::cond	YES	YES
-Wait/Synch/Cond/Core/COND_active	YES	YES
-Wait/Synch/Cond/Core/COND_pool	YES	YES
-Wait/Synch/Cond/Core/COND_server_started	YES	YES
-Wait/Synch/Cond/Core/COND_refresh	YES	YES
-Wait/Synch/Cond/Core/COND_thread_count	YES	YES
-Wait/Synch/Cond/Core/COND_manager	YES	YES
-Wait/Synch/Cond/Core/COND_global_read_lock	YES	YES
-Wait/Synch/Cond/Core/COND_thread_cache	YES	YES
-Wait/Synch/Cond/Core/COND_flush_thread_cache	YES	YES
-Wait/Synch/Cond/Core/COND_rpl_status	YES	YES
-Wait/Synch/Cond/Core/BINLOG::COND_prep_xids	YES	YES
-Wait/Synch/Cond/Core/BINLOG::update_cond	YES	YES
-Wait/Synch/Cond/Core/COND_cache_status_changed	YES	YES
-Wait/Synch/Cond/Core/RLI_data_cond	YES	YES
-Wait/Synch/Cond/Core/RLI_start_cond	YES	YES
-Wait/Synch/Cond/Core/RLI_stop_cond	YES	YES
-Wait/Synch/Cond/Core/RLI_log_space_cond	YES	YES
-Wait/Synch/Cond/Core/MI_data_cond	YES	YES
-Wait/Synch/Cond/Core/MI_start_cond	YES	YES
-Wait/Synch/Cond/Core/MI_stop_cond	YES	YES
-Wait/Synch/Cond/Core/Event_scheduler::COND_state	YES	YES
-Wait/Synch/Cond/Core/COND_queue_state	YES	YES
-Wait/Synch/Cond/Core/COND_DDL_blocker	YES	YES
-Wait/Synch/Cond/Core/COND_process_blocked	YES	YES
-Wait/Synch/Cond/Core/COND_DDL_blocker_blocked	YES	YES
-Wait/Synch/Cond/Core/COND_thread_wait	YES	YES
-Wait/Synch/Cond/Core/COND_caller_wait	YES	YES
-Wait/Synch/Cond/Core/DEBUG_SYNC::cond	YES	YES
-Wait/Synch/Cond/Core/ULL_cond	YES	YES
-Wait/Synch/Cond/Core/Item_func_sleep::cond	YES	YES
-Wait/Synch/Cond/Core/COND_mdl	YES	YES
-Wait/Synch/Cond/Core/Delayed_insert_cond	YES	YES
-Wait/Synch/Cond/Core/Delayed_insert_cond_client	YES	YES
 Wait/Synch/Mutex/myisam/MI_SORT_INFO::mutex	YES	YES
 Wait/Synch/Mutex/myisam/MYISAM_SHARE::intern_lock	YES	YES
 Wait/Synch/Rwlock/myisam/MYISAM_SHARE::key_root_lock	YES	YES

=== modified file 'mysql-test/suite/perfschema/r/information_schema.result'
--- a/mysql-test/suite/perfschema/r/information_schema.result	2008-11-06 17:25:15 +0000
+++ b/mysql-test/suite/perfschema/r/information_schema.result	2008-11-11 17:09:18 +0000
@@ -2,6 +2,7 @@ select TABLE_SCHEMA, TABLE_NAME, TABLE_C
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
 TABLE_SCHEMA	TABLE_NAME	TABLE_CATALOG
+performance_schema	acts_waits_current	NULL
 performance_schema	performance_timers	NULL
 performance_schema	setup_actors	NULL
 performance_schema	setup_consumers	NULL
@@ -11,6 +12,7 @@ select TABLE_NAME, TABLE_TYPE, ENGINE
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
 TABLE_NAME	TABLE_TYPE	ENGINE
+acts_waits_current	BASE TABLE	PERFORMANCE_SCHEMA
 performance_timers	BASE TABLE	PERFORMANCE_SCHEMA
 setup_actors	BASE TABLE	PERFORMANCE_SCHEMA
 setup_consumers	BASE TABLE	PERFORMANCE_SCHEMA
@@ -20,6 +22,7 @@ select TABLE_NAME, VERSION, ROW_FORMAT
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
 TABLE_NAME	VERSION	ROW_FORMAT
+acts_waits_current	10	Dynamic
 performance_timers	10	Fixed
 setup_actors	10	Dynamic
 setup_consumers	10	Dynamic
@@ -29,6 +32,7 @@ select TABLE_NAME, TABLE_ROWS, AVG_ROW_L
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
 TABLE_NAME	TABLE_ROWS	AVG_ROW_LENGTH
+acts_waits_current	1000	0
 performance_timers	5	0
 setup_actors	99	0
 setup_consumers	3	0
@@ -38,6 +42,7 @@ select TABLE_NAME, DATA_LENGTH, MAX_DATA
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
 TABLE_NAME	DATA_LENGTH	MAX_DATA_LENGTH
+acts_waits_current	0	0
 performance_timers	0	0
 setup_actors	0	0
 setup_consumers	0	0
@@ -47,6 +52,7 @@ select TABLE_NAME, INDEX_LENGTH, DATA_FR
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
 TABLE_NAME	INDEX_LENGTH	DATA_FREE	AUTO_INCREMENT
+acts_waits_current	0	0	NULL
 performance_timers	0	0	NULL
 setup_actors	0	0	NULL
 setup_consumers	0	0	NULL
@@ -56,6 +62,7 @@ select TABLE_NAME, CREATE_TIME, UPDATE_T
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
 TABLE_NAME	CREATE_TIME	UPDATE_TIME	CHECK_TIME
+acts_waits_current	NULL	NULL	NULL
 performance_timers	NULL	NULL	NULL
 setup_actors	NULL	NULL	NULL
 setup_consumers	NULL	NULL	NULL
@@ -65,6 +72,7 @@ select TABLE_NAME, TABLE_COLLATION, CHEC
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
 TABLE_NAME	TABLE_COLLATION	CHECKSUM
+acts_waits_current	utf8_general_ci	NULL
 performance_timers	utf8_general_ci	NULL
 setup_actors	utf8_general_ci	NULL
 setup_consumers	utf8_general_ci	NULL
@@ -74,6 +82,7 @@ select TABLE_NAME, CREATE_OPTIONS, TABLE
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
 TABLE_NAME	CREATE_OPTIONS	TABLESPACE_NAME
+acts_waits_current		NULL
 performance_timers		NULL
 setup_actors		NULL
 setup_consumers		NULL
@@ -83,6 +92,7 @@ select TABLE_NAME, TABLE_COMMENT
 from information_schema.tables
 where TABLE_SCHEMA='performance_schema';
 TABLE_NAME	TABLE_COMMENT
+acts_waits_current	
 performance_timers	
 setup_actors	
 setup_consumers	

=== modified file 'mysql-test/suite/perfschema/r/schema.result'
--- a/mysql-test/suite/perfschema/r/schema.result	2008-11-06 17:25:15 +0000
+++ b/mysql-test/suite/perfschema/r/schema.result	2008-11-11 17:09:18 +0000
@@ -7,6 +7,7 @@ test
 use performance_schema;
 show tables;
 Tables_in_performance_schema
+acts_waits_current
 performance_timers
 setup_actors
 setup_consumers

=== added file 'mysql-test/suite/perfschema/t/dml_acts_waits_current.test'
--- a/mysql-test/suite/perfschema/t/dml_acts_waits_current.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/dml_acts_waits_current.test	2008-11-11 17:09:18 +0000
@@ -0,0 +1,27 @@
+
+select * from performance_schema.acts_waits_current;
+
+select * from performance_schema.acts_waits_current
+  where act_name='FOO';
+
+--error ER_ILLEGAL_HA
+insert into performance_schema.acts_waits_current
+  set thread_id='1', act_id=1,
+  act_name='FOO', timer_start=1, timer_end=2, timer_wait=3;
+
+## --error ER_ILLEGAL_HA
+## update performance_schema.acts_waits_current
+##   set timer_start=12;
+
+## --error ER_ILLEGAL_HA
+## update performance_schema.acts_waits_current
+##   set timer_start=12 where thread_id=0;
+
+## --error ER_ILLEGAL_HA
+## delete from performance_schema.acts_waits_current;
+
+## --error ER_ILLEGAL_HA
+## delete from performance_schema.acts_waits_current
+##   where thread_id=1;
+
+

=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c	2008-10-27 18:44:39 +0000
+++ b/mysys/my_init.c	2008-11-11 17:09:18 +0000
@@ -42,6 +42,7 @@ static void netware_init();
 #endif
 
 my_bool my_init_done= 0;
+my_bool my_init_thread_done= 0;
 uint	mysys_usage_id= 0;              /* Incremented for each my_init() */
 ulong   my_thread_stack_size= 65536;
 
@@ -60,6 +61,26 @@ static ulong atoi_octal(const char *str)
 static void my_init_mysys_psi_keys();
 #endif
 
+void my_init_thread(void)
+{
+  if (my_init_thread_done)
+    return;
+  my_init_thread_done=1;
+
+#if defined(THREAD) && defined(SAFE_MUTEX)
+  safe_mutex_global_init();		/* Must be called early */
+#endif
+#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
+  fastmutex_global_init();              /* Must be called early */
+#endif
+  netware_init();
+#ifdef THREAD
+#if defined(HAVE_PTHREAD_INIT)
+  pthread_init();			/* Must be called before DBUG_ENTER */
+#endif
+#endif
+}
+
 /*
   Init my_sys functions and my_sys variabels
 
@@ -91,17 +112,9 @@ my_bool my_init(void)
   if (my_progname)
     my_progname_short= my_progname + dirname_length(my_progname);
 
-#if defined(THREAD) && defined(SAFE_MUTEX)
-  safe_mutex_global_init();		/* Must be called early */
-#endif
-#if defined(THREAD) && defined(MY_PTHREAD_FASTMUTEX) && !defined(SAFE_MUTEX)
-  fastmutex_global_init();              /* Must be called early */
-#endif
-  netware_init();
+  my_init_thread();
+
 #ifdef THREAD
-#if defined(HAVE_PTHREAD_INIT)
-  pthread_init();			/* Must be called before DBUG_ENTER */
-#endif
   if (my_thread_global_init())
     return 1;
 #if !defined( __WIN__) && !defined(__NETWARE__)

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2008-11-03 17:18:35 +0000
+++ b/sql/mysql_priv.h	2008-11-11 17:09:18 +0000
@@ -2187,6 +2187,10 @@ extern PSI_mutex_key key_LOCK_pool;
 extern PSI_cond_key key_COND_active;
 extern PSI_cond_key key_COND_pool;
 #endif
+
+extern PSI_thread_key key_thread_main;
+extern PSI_thread_key key_thread_bootstrap;
+
 void init_server_psi_keys();
 #endif
 

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2008-11-03 17:18:35 +0000
+++ b/sql/mysqld.cc	2008-11-11 17:09:18 +0000
@@ -4467,25 +4467,42 @@ int main(int argc, char **argv)
   }
 #endif
 
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_hook)
-    PSI_server= (PSI*) PSI_hook->get_PSI(PSI_CURRENT_VERSION);
-  else
-    PSI_server= NULL;
-#endif
-
-  MY_INIT(argv[0]);		// init my_sys library & pthreads
-  /* nothing should come before this line ^^^ */
+  my_init_thread();
 
 #ifdef HAVE_PERFORMANCE_SCHEMA
   if (initialize_performance_schema_pthread())
-    PSI_server= NULL;
+    PSI_hook= NULL;
 #endif
 
 #ifdef HAVE_PSI_INTERFACE
+  /*
+    Obtain the current performance schema instrumentation interface,
+    if available.
+  */
+  if (PSI_hook)
+    PSI_server= (PSI*) PSI_hook->get_PSI(PSI_CURRENT_VERSION);
+  else
+    PSI_server= NULL;
+
   init_server_psi_keys();
+  if (PSI_server)
+  {
+    /*
+      Create a "main" thread, with THREAD_ID=0,
+      and bind it in Thread Local Storage.
+    */
+    PSI_thread *psi= PSI_server->new_thread(key_thread_main, NULL);
+    if (psi)
+    {
+      PSI_server->set_thread_id(psi, 0);
+      PSI_server->set_thread(psi);
+    }
+  }
 #endif
 
+  MY_INIT(argv[0]);		// init my_sys library
+  /* nothing should come before this line ^^^ */
+
   /* Set signal used to kill MySQL */
 #if defined(SIGUSR2)
   thr_kill_signal= thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2;
@@ -4974,6 +4991,15 @@ static void bootstrap(FILE *file)
   thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
   thread_count++;
 
+#ifdef HAVE_PSI_INTERFACE
+  if (PSI_server)
+  {
+    thd->m_psi= PSI_server->new_thread(key_thread_bootstrap, thd);
+    if (thd->m_psi)
+      PSI_server->set_thread_id(thd->m_psi, thd->thread_id);
+  }
+#endif
+
   bootstrap_file=file;
 #ifndef EMBEDDED_LIBRARY			// TODO:  Enable this
   if (pthread_create(&thd->real_id,&connection_attrib,handle_bootstrap,
@@ -9471,9 +9497,20 @@ static PSI_cond_info all_server_conds[]=
    "Delayed_insert_cond_client", PSI_FLAG_GLOBAL}
 };
 
+PSI_thread_key key_thread_main;
+PSI_thread_key key_thread_bootstrap;
+
+static PSI_thread_info all_server_threads[]=
+{
+  { & key_thread_main,
+   "Main", PSI_FLAG_GLOBAL},
+  { & key_thread_bootstrap,
+   "Bootstrap", PSI_FLAG_GLOBAL}
+};
+
 void init_server_psi_keys()
 {
-  const char* category= "Core";
+  const char* category= "Sql";
   int count;
 
   if (PSI_server == NULL)
@@ -9487,6 +9524,9 @@ void init_server_psi_keys()
 
   count= sizeof(all_server_conds)/sizeof(all_server_conds[0]);
   PSI_server->register_cond(category, all_server_conds, count);
+
+  count= sizeof(all_server_threads)/sizeof(all_server_threads[0]);
+  PSI_server->register_thread(category, all_server_threads, count);
 }
 #endif
 

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2008-11-03 17:18:35 +0000
+++ b/sql/sql_class.cc	2008-11-11 17:09:18 +0000
@@ -550,7 +550,7 @@ THD::THD()
   ulong tmp;
 
 #ifdef HAVE_PSI_INTERFACE
-  m_psi= (PSI_server ? PSI_server->new_thread() : NULL);
+  m_psi= NULL;
 #endif
 
   /*

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2008-10-27 18:44:39 +0000
+++ b/sql/table.cc	2008-11-11 17:09:18 +0000
@@ -24,6 +24,12 @@
 /* INFORMATION_SCHEMA name */
 LEX_STRING INFORMATION_SCHEMA_NAME= {C_STRING_WITH_LEN("information_schema")};
 
+/* PERFORMANCE_SCHEMA name */
+LEX_STRING PERFORMANCE_SCHEMA_NAME= {C_STRING_WITH_LEN("performance_schema")};
+
+/* SETUP_ name prefix */
+LEX_STRING SETUP_NAME_PREFIX= {C_STRING_WITH_LEN("setup_")};
+
 /* MYSQL_SCHEMA name */
 LEX_STRING MYSQL_SCHEMA_NAME= {C_STRING_WITH_LEN("mysql")};
 
@@ -235,6 +241,16 @@ TABLE_CATEGORY get_table_category(const 
     return TABLE_CATEGORY_INFORMATION;
   }
 
+#ifdef LATER
+  if ((db->length == PERFORMANCE_SCHEMA_NAME.length) &&
+      (my_strcasecmp(system_charset_info,
+                    PERFORMANCE_SCHEMA_NAME.str,
+                    db->str) == 0))
+  {
+    return TABLE_CATEGORY_PERFORMANCE;
+  }
+#endif
+
   if ((db->length == MYSQL_SCHEMA_NAME.length) &&
       (my_strcasecmp(system_charset_info,
                     MYSQL_SCHEMA_NAME.str,

=== modified file 'storage/perfschema/Makefile.am'
--- a/storage/perfschema/Makefile.am	2008-11-04 16:11:21 +0000
+++ b/storage/perfschema/Makefile.am	2008-11-11 17:09:18 +0000
@@ -37,14 +37,14 @@ noinst_HEADERS = ha_perfschema.h psm_tab
                 psm_column_types.h psm_column_values.h \
                 table_setup_instruments.h table_performance_timers.h \
                 table_setup_timers.h table_setup_actors.h \
-                table_setup_consumers.h
+                table_setup_consumers.h table_acts_waits_current.h
 
 PSE_SOURCES = ha_perfschema.cc psm_table.cc psm.cc psm_server.cc \
 		psm_global.cc psm_sync_info.cc psm_sync.cc \
                 psm_bootstrap.cc psm_column_values.cc \
                 table_setup_instruments.cc table_performance_timers.cc \
                 table_setup_timers.cc table_setup_actors.cc \
-                table_setup_consumers.cc
+                table_setup_consumers.cc table_acts_waits_current.cc
 
 EXTRA_LIBRARIES = libperfschema.a
 noinst_LIBRARIES = @plugin_perfschema_static_target@

=== added file 'storage/perfschema/acts_waits.h'
--- a/storage/perfschema/acts_waits.h	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/acts_waits.h	2008-11-11 17:09:18 +0000
@@ -0,0 +1,61 @@
+/* Copyright (C) 2008 Sun Microsystems, Inc
+
+  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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+#ifndef PSM_ACTS_WAITS_H
+#define PSM_ACTS_WAITS_H
+
+#include "psm_column_types.h"
+
+struct PSM_mutex;
+struct PSM_rwlock;
+struct PSM_cond;
+struct PSM_thread;
+
+enum acts_waits_class
+{
+  NO_WAIT_CLASS= 0,
+  WAIT_CLASS_MUTEX,
+  WAIT_CLASS_RWLOCK,
+  WAIT_CLASS_COND
+};
+
+union acts_waits_target
+{
+  PSM_mutex *m_mutex;
+  PSM_rwlock *m_rwlock;
+  PSM_cond *m_cond;
+};
+
+struct acts_waits
+{
+  acts_waits_class m_wait_class;
+  PSM_thread *m_thread;
+  PSM_sync_info *m_info;
+  bool m_timed;
+  longlong m_act_id;
+  longlong m_timer_start;
+  longlong m_timer_end;
+  void *m_identity;
+};
+
+struct PSM_locker
+{
+  enum_timer_name m_timer_name;
+  acts_waits_target m_target;
+  struct acts_waits m_waits_current;
+};
+
+#endif
+

=== modified file 'storage/perfschema/plug.in'
--- a/storage/perfschema/plug.in	2008-10-30 00:41:16 +0000
+++ b/storage/perfschema/plug.in	2008-11-11 17:09:18 +0000
@@ -67,6 +67,31 @@ fi
 AC_MSG_RESULT([$psm_max_sync_info])
 
 dnl -------------------------------------------------------------------------
+dnl PSM_MAX_THREAD_INFO
+dnl -------------------------------------------------------------------------
+
+AC_ARG_WITH(
+  [psm-max-thread-info],
+  AS_HELP_STRING(
+    [--with-psm-max-thread-info=N],
+    [Performance Schema: maximum number of thread info objects.]),
+    [psm_max_thread_info="$withval"],
+    [psm_max_thread_info="0"]
+)
+
+AC_MSG_CHECKING([psm max thread info])
+
+if test "$psm_max_thread_info" != "0"
+then
+  AC_DEFINE_UNQUOTED(
+    [PSM_MAX_THREAD_INFO],
+    [$psm_max_thread_info],
+    [Performance Schema: Maximum number of thread info objects.])
+fi
+
+AC_MSG_RESULT([$psm_max_thread_info])
+
+dnl -------------------------------------------------------------------------
 dnl PSM_MAX_MUTEX
 dnl -------------------------------------------------------------------------
 

=== modified file 'storage/perfschema/psm.cc'
--- a/storage/perfschema/psm.cc	2008-11-01 01:05:08 +0000
+++ b/storage/perfschema/psm.cc	2008-11-11 17:09:18 +0000
@@ -16,20 +16,43 @@
 #include "psm.h"
 #include "psm_sync_info.h"
 #include "psm_sync.h"
+#include "psm_global.h"
+#include "psm_column_values.h"
 
 pthread_key(PSM_thread*, THR_PSM);
 
-static void format_category(const char* input, char* output, int *output_length)
+uint lost_locker= 0;
+
+static int build_prefix(const LEX_STRING *prefix, const char* input,
+                        char* output, int *output_length)
 {
   int len= strlen(input);
+  char *out_ptr= output;
+
+  if ((prefix->length + len + 1) >= MAX_PREFIX_NAME_LENGTH)
+  {
+    psm_print_error("build_prefix: prefix+category is too long <%s> <%s>",
+                    prefix->str, input);
+    return 1;
+  }
+
+  if (strchr(input, '/') != NULL)
+  {
+    psm_print_error("build_prefix: invalid category <%s>",
+                    input);
+    return 1;
+  }
 
-  DBUG_ASSERT(len < MAX_CATEGORY_LENGTH);
-  DBUG_ASSERT(strchr(input, '/') == NULL);
+  /* output = prefix + input + '/' */
+  memcpy(out_ptr, prefix->str, prefix->length);
+  out_ptr+= prefix->length;
+  memcpy(out_ptr, input, len);
+  out_ptr+= len;
+  *out_ptr= '/';
+  out_ptr++;
+  *output_length= out_ptr - output;
 
-  memcpy(output, input, len);
-  output[len]= '/';
-  len++;
-  *output_length= len;
+  return 0;
 }
 
 static void register_mutex_v1(const char* category,
@@ -37,19 +60,36 @@ static void register_mutex_v1(const char
                               int count)
 {
   PSM_sync_key key;
-  char formatted_category[MAX_CATEGORY_LENGTH];
-  int category_length;
+  char formatted_name[MAX_INFO_NAME_LENGTH];
+  int prefix_length;
+  int len;
 
   DBUG_ASSERT(category != NULL);
   DBUG_ASSERT(info != NULL);
-  format_category(category, formatted_category, & category_length);
+  if (build_prefix(& mutex_instrument_prefix, category,
+                   formatted_name, & prefix_length))
+    return ;
 
   for (; count>0; count--, info++)
   {
     DBUG_ASSERT(info->m_key != NULL);
     DBUG_ASSERT(info->m_name != NULL);
-    key= register_sync_info(SYNC_MUTEX, formatted_category, category_length,
-                            info->m_name, info->m_flags);
+    len= strlen(info->m_name);
+    if (prefix_length + len <= MAX_INFO_NAME_LENGTH)
+    {
+      memcpy(formatted_name + prefix_length, info->m_name, len);
+      key= register_sync_info(SYNC_MUTEX,
+                              formatted_name,
+                              prefix_length + len,
+                              info->m_flags);
+    }
+    else
+    {
+      psm_print_error("register_mutex_v1: name too long <%s> <%s>",
+                      category, info->m_name);
+      key= 0;
+    }
+
     *(info->m_key)= (PSI_mutex_key) key;
   }
   return;
@@ -60,18 +100,36 @@ static void register_rwlock_v1(const cha
                                int count)
 {
   PSM_sync_key key;
-  char formatted_category[MAX_CATEGORY_LENGTH];
-  int category_length;
+  char formatted_name[MAX_INFO_NAME_LENGTH];
+  int prefix_length;
+  int len;
 
   DBUG_ASSERT(category != NULL);
   DBUG_ASSERT(info != NULL);
-  format_category(category, formatted_category, & category_length);
+  if (build_prefix(& rwlock_instrument_prefix, category,
+                   formatted_name, & prefix_length))
+    return ;
 
   for (; count>0; count--, info++)
   {
     DBUG_ASSERT(info->m_key != NULL);
-    key= register_sync_info(SYNC_RWLOCK, formatted_category, category_length,
-                            info->m_name, info->m_flags);
+    DBUG_ASSERT(info->m_name != NULL);
+    len= strlen(info->m_name);
+    if (prefix_length + len <= MAX_INFO_NAME_LENGTH)
+    {
+      memcpy(formatted_name + prefix_length, info->m_name, len);
+      key= register_sync_info(SYNC_RWLOCK,
+                              formatted_name,
+                              prefix_length + len,
+                              info->m_flags);
+    }
+    else
+    {
+      psm_print_error("register_rwlock_v1: name too long <%s> <%s>",
+                      category, info->m_name);
+      key= 0;
+    }
+
     *(info->m_key)= (PSI_rwlock_key) key;
   }
   return;
@@ -82,23 +140,80 @@ static void register_cond_v1(const char*
                              int count)
 {
   PSM_sync_key key;
-  char formatted_category[MAX_CATEGORY_LENGTH];
-  int category_length;
+  char formatted_name[MAX_INFO_NAME_LENGTH];
+  int prefix_length;
+  int len;
 
   DBUG_ASSERT(category != NULL);
   DBUG_ASSERT(info != NULL);
-  format_category(category, formatted_category, & category_length);
+  if (build_prefix(& cond_instrument_prefix, category,
+                   formatted_name, & prefix_length))
+    return ;
 
   for (; count>0; count--, info++)
   {
     DBUG_ASSERT(info->m_key != NULL);
-    key= register_sync_info(SYNC_COND, formatted_category, category_length,
-                            info->m_name, info->m_flags);
+    DBUG_ASSERT(info->m_name != NULL);
+    len= strlen(info->m_name);
+    if (prefix_length + len <= MAX_INFO_NAME_LENGTH)
+    {
+      memcpy(formatted_name + prefix_length, info->m_name, len);
+      key= register_sync_info(SYNC_COND,
+                              formatted_name,
+                              prefix_length + len,
+                              info->m_flags);
+    }
+    else
+    {
+      psm_print_error("register_cond_v1: name too long <%s> <%s>",
+                      category, info->m_name);
+      key= 0;
+    }
+
     *(info->m_key)= (PSI_cond_key) key;
   }
   return;
 }
 
+static void register_thread_v1(const char* category,
+                               struct PSI_thread_info_v1 *info,
+                               int count)
+{
+  PSM_sync_key key;
+  char formatted_name[MAX_INFO_NAME_LENGTH];
+  int prefix_length;
+  int len;
+
+  DBUG_ASSERT(category != NULL);
+  DBUG_ASSERT(info != NULL);
+  if (build_prefix(& thread_instrument_prefix, category,
+                   formatted_name, & prefix_length))
+    return ;
+
+  for (; count>0; count--, info++)
+  {
+    DBUG_ASSERT(info->m_key != NULL);
+    DBUG_ASSERT(info->m_name != NULL);
+    len= strlen(info->m_name);
+    if (prefix_length + len <= MAX_INFO_NAME_LENGTH)
+    {
+      memcpy(formatted_name + prefix_length, info->m_name, len);
+      key= register_thread_info(formatted_name,
+                                prefix_length + len,
+                                info->m_flags);
+    }
+    else
+    {
+      psm_print_error("register_thread_v1: name too long <%s> <%s>",
+                      category, info->m_name);
+      key= 0;
+    }
+
+    *(info->m_key)= (PSI_thread_key) key;
+  }
+  return;
+}
+
 static PSI_mutex* init_mutex_v1(PSI_mutex_key key, void *identity)
 {
   PSM_sync_info *info;
@@ -159,15 +274,27 @@ static void destroy_cond_v1(PSI_cond* co
   destroy_cond(psm);
 }
 
-static PSI_thread* new_thread_v1()
+static PSI_thread* new_thread_v1(PSI_thread_key key, void *identity)
 {
-  static PSM_thread dummy;
-  PSM_thread *psm= & dummy;
+  PSM_thread_info *info;
+  PSM_thread *psm;
+
+  info= find_thread_info(key);
+  if (info)
+    psm= create_thread(info, identity);
+  else
+    psm = NULL;
 
-  my_pthread_setspecific_ptr(THR_PSM, psm);
   return (PSI_thread*) psm;
 }
 
+static void set_thread_id_v1(struct PSI_thread *thread, unsigned long id)
+{
+  DBUG_ASSERT(thread);
+  PSM_thread *psm= (PSM_thread*) thread;
+  psm->m_thread_id= id;
+}
+
 static PSI_thread* get_thread_v1()
 {
   PSM_thread *psm;
@@ -186,7 +313,38 @@ static void delete_thread_v1(PSI_thread 
   my_pthread_setspecific_ptr(THR_PSM, NULL);
 }
 
-static PSI_locker* get_thread_locker_v1()
+static PSI_locker* get_thread_mutex_locker_v1(PSI_mutex *mutex)
+{
+  PSM_mutex *psm_mutex= (PSM_mutex*) mutex;
+  PSM_thread *psm_thread;
+  DBUG_ASSERT(psm_mutex != NULL);
+  DBUG_ASSERT(psm_mutex->m_info != NULL);
+  if (! psm_mutex->m_info->m_enabled)
+    return NULL;
+  psm_thread= my_pthread_getspecific_ptr(PSM_thread*, THR_PSM);
+  if (psm_thread == NULL)
+    return NULL;
+  if (psm_thread->m_locker_count >= LOCKER_STACK_SIZE)
+  {
+    lost_locker++;
+    return NULL;
+  }
+  PSM_locker *psm_locker;
+  psm_locker= & psm_thread->m_locker_stack[psm_thread->m_locker_count];
+
+  psm_locker->m_timer_name= TIMER_NAME_CYCLE; // TODO
+  psm_locker->m_target.m_mutex= psm_mutex;
+  psm_locker->m_waits_current.m_thread= psm_thread;
+  psm_locker->m_waits_current.m_info= psm_mutex->m_info;
+  psm_locker->m_waits_current.m_timed= psm_mutex->m_info->m_timed;
+  psm_locker->m_waits_current.m_identity= psm_mutex->m_identity;
+  psm_locker->m_waits_current.m_wait_class= WAIT_CLASS_MUTEX;
+
+  psm_thread->m_locker_count++;
+  return (PSI_locker*) psm_locker;
+}
+
+static PSI_locker* get_thread_rwlock_locker_v1(PSI_rwlock *rwlock)
 {
   PSM_thread *psm;
   psm= my_pthread_getspecific_ptr(PSM_thread*, THR_PSM);
@@ -199,7 +357,36 @@ static PSI_locker* get_thread_locker_v1(
   return NULL;
 }
 
-static PSI_locker* get_locker_v1(PSI_thread *thread)
+static PSI_locker* get_thread_cond_locker_v1(PSI_cond *cond, PSI_mutex *mutex)
+{
+  PSM_thread *psm;
+  psm= my_pthread_getspecific_ptr(PSM_thread*, THR_PSM);
+  if (psm)
+  {
+    PSM_locker dummy;
+    PSM_locker *psm= & dummy;
+    return (PSI_locker*) psm;
+  }
+  return NULL;
+}
+
+static PSI_locker* get_mutex_locker_v1(PSI_thread *thread, PSI_mutex *mutex)
+{
+  PSM_locker dummy;
+  PSM_locker *psm= & dummy;
+  return (PSI_locker*) psm;
+}
+
+static PSI_locker* get_rwlock_locker_v1(PSI_thread *thread, PSI_rwlock *rwlock)
+{
+  PSM_locker dummy;
+  PSM_locker *psm= & dummy;
+  return (PSI_locker*) psm;
+}
+
+static PSI_locker* get_cond_locker_v1(PSI_thread *thread,
+                                      PSI_cond *cond,
+                                      PSI_mutex *mutex)
 {
   PSM_locker dummy;
   PSM_locker *psm= & dummy;
@@ -245,76 +432,84 @@ static void broadcast_cond_v1(PSI_thread
   psm_cond->m_stat.m_broadcast_count++;
 }
 
-static void start_wait_v1(PSI_locker* locker, PSI_mutex* mutex, int must)
+static void start_wait_v1(PSI_locker* locker, int must)
 {
   PSM_locker *psm_locker= (PSM_locker*) locker;
-  PSM_mutex *psm_mutex= (PSM_mutex*) mutex;
   DBUG_ASSERT(psm_locker != NULL);
-  DBUG_ASSERT(psm_mutex != NULL);
+  DBUG_ASSERT(psm_locker->m_waits_current.m_wait_class == WAIT_CLASS_MUTEX);
+  if (psm_locker->m_waits_current.m_timed)
+  {
+  }
+  else
+  {
+  }
 }
 
-static void end_wait_v1(PSI_locker* locker, PSI_mutex* mutex, int rc)
+static void end_wait_v1(PSI_locker* locker, int rc)
 {
   PSM_locker *psm_locker= (PSM_locker*) locker;
-  PSM_mutex *psm_mutex= (PSM_mutex*) mutex;
   DBUG_ASSERT(psm_locker != NULL);
-  DBUG_ASSERT(psm_mutex != NULL);
+  DBUG_ASSERT(psm_locker->m_waits_current.m_wait_class == WAIT_CLASS_MUTEX);
+  if (psm_locker->m_waits_current.m_timed)
+  {
+    psm_locker->m_waits_current.m_timer_end= 0;
+  }
   if (rc == 0)
-    psm_mutex->m_stat.m_lock_count++;
+  {
+    PSM_mutex *mutex= psm_locker->m_target.m_mutex;
+    mutex->m_stat.m_lock_count++;
+    mutex->m_owner= psm_locker->m_waits_current.m_thread;
+  }
+
+  psm_locker->m_waits_current.m_thread->m_locker_count--;
 }
 
-static void start_rdwait_v1(PSI_locker* locker, PSI_rwlock *rwlock, int must)
+static void start_rdwait_v1(PSI_locker* locker, int must)
 {
   PSM_locker *psm_locker= (PSM_locker*) locker;
-  PSM_rwlock *psm_rwlock= (PSM_rwlock*) rwlock;
   DBUG_ASSERT(psm_locker != NULL);
-  DBUG_ASSERT(psm_rwlock != NULL);
 }
 
-static void end_rdwait_v1(PSI_locker* locker, PSI_rwlock *rwlock, int rc)
+static void end_rdwait_v1(PSI_locker* locker, int rc)
 {
   PSM_locker *psm_locker= (PSM_locker*) locker;
-  PSM_rwlock *psm_rwlock= (PSM_rwlock*) rwlock;
   DBUG_ASSERT(psm_locker != NULL);
-  DBUG_ASSERT(psm_rwlock != NULL);
+#ifdef LATER
   if (rc == 0)
     psm_rwlock->m_stat.m_read_count++;
+#endif
 }
 
-static void start_wrwait_v1(PSI_locker* locker, PSI_rwlock *rwlock, int must)
+static void start_wrwait_v1(PSI_locker* locker, int must)
 {
   PSM_locker *psm_locker= (PSM_locker*) locker;
-  PSM_rwlock *psm_rwlock= (PSM_rwlock*) rwlock;
   DBUG_ASSERT(psm_locker != NULL);
-  DBUG_ASSERT(psm_rwlock != NULL);
 }
 
-static void end_wrwait_v1(PSI_locker* locker, PSI_rwlock *rwlock, int rc)
+static void end_wrwait_v1(PSI_locker* locker, int rc)
 {
   PSM_locker *psm_locker= (PSM_locker*) locker;
-  PSM_rwlock *psm_rwlock= (PSM_rwlock*) rwlock;
   DBUG_ASSERT(psm_locker != NULL);
-  DBUG_ASSERT(psm_rwlock != NULL);
+#ifdef LATER
   if (rc == 0)
     psm_rwlock->m_stat.m_write_count++;
+#endif
 }
 
-static void start_condwait_v1(PSI_locker* locker, PSI_cond* cond, int must)
+static void start_condwait_v1(PSI_locker* locker, int must)
 {
   PSM_locker *psm_locker= (PSM_locker*) locker;
-  PSM_cond *psm_cond= (PSM_cond*) cond;
   DBUG_ASSERT(psm_locker != NULL);
-  DBUG_ASSERT(psm_cond != NULL);
 }
 
-static void end_condwait_v1(PSI_locker* locker, PSI_cond* cond, int rc)
+static void end_condwait_v1(PSI_locker* locker, int rc)
 {
   PSM_locker *psm_locker= (PSM_locker*) locker;
-  PSM_cond *psm_cond= (PSM_cond*) cond;
   DBUG_ASSERT(psm_locker != NULL);
-  DBUG_ASSERT(psm_cond != NULL);
+#ifdef LATER
   if (rc == 0)
     psm_cond->m_stat.m_wait_count++;
+#endif
 }
 
 struct PSI_v1 PSM_v1=
@@ -322,6 +517,7 @@ struct PSI_v1 PSM_v1=
   register_mutex_v1,
   register_rwlock_v1,
   register_cond_v1,
+  register_thread_v1,
   init_mutex_v1,
   destroy_mutex_v1,
   init_rwlock_v1,
@@ -329,11 +525,16 @@ struct PSI_v1 PSM_v1=
   init_cond_v1,
   destroy_cond_v1,
   new_thread_v1,
+  set_thread_id_v1,
   get_thread_v1,
   set_thread_v1,
   delete_thread_v1,
-  get_thread_locker_v1,
-  get_locker_v1,
+  get_thread_mutex_locker_v1,
+  get_thread_rwlock_locker_v1,
+  get_thread_cond_locker_v1,
+  get_mutex_locker_v1,
+  get_rwlock_locker_v1,
+  get_cond_locker_v1,
   unlock_mutex_v1,
   unlock_rwlock_v1,
   signal_cond_v1,

=== modified file 'storage/perfschema/psm.h'
--- a/storage/perfschema/psm.h	2008-10-30 00:41:16 +0000
+++ b/storage/perfschema/psm.h	2008-11-11 17:09:18 +0000
@@ -24,16 +24,6 @@
 extern struct PSI_v1 PSM_v1;
 extern struct PSI_v2 PSM_v2;
 
-struct PSM_thread
-{
-  int todo;
-};
-
-struct PSM_locker
-{
-  int todo;
-};
-
 #include "mysql_priv.h"
 extern pthread_key(PSM_thread*, THR_PSM);
 

=== modified file 'storage/perfschema/psm_bootstrap.cc'
--- a/storage/perfschema/psm_bootstrap.cc	2008-11-04 16:11:21 +0000
+++ b/storage/perfschema/psm_bootstrap.cc	2008-11-11 17:09:18 +0000
@@ -18,6 +18,22 @@
 
 const char* psm_bootstrap_queries[]=
 {
+  "DROP TABLE IF EXISTS performance_schema.acts_waits_current;"
+  ,
+  "CREATE TABLE performance_schema.acts_waits_current("
+    "THREAD_ID INTEGER not null, "
+    "ACT_ID BIGINT not null, "
+    "ACT_NAME VARCHAR(64) character set utf8 collate utf8_unicode_ci not null, "
+    "TIMER_START BIGINT,"
+    "TIMER_END BIGINT,"
+    "TIMER_WAIT BIGINT,"
+    "SPINS INTEGER,"
+    "OBJECT_TYPE VARCHAR(64) character set utf8 collate utf8_unicode_ci, "
+    "OBJECT_SCHEMA VARCHAR(64) character set utf8 collate utf8_unicode_ci, "
+    "OBJECT_NAME VARCHAR(64) character set utf8 collate utf8_unicode_ci, "
+    "OBJECT_INSTANCE_BEGIN BIGINT not null"
+  ") ENGINE=PERFORMANCE_SCHEMA;"
+  ,
   "DROP TABLE IF EXISTS performance_schema.setup_actors;"
   ,
   "CREATE TABLE performance_schema.setup_actors("

=== modified file 'storage/perfschema/psm_column_values.cc'
--- a/storage/perfschema/psm_column_values.cc	2008-10-30 04:49:42 +0000
+++ b/storage/perfschema/psm_column_values.cc	2008-11-11 17:09:18 +0000
@@ -25,6 +25,9 @@ LEX_STRING rwlock_instrument_prefix=
 LEX_STRING cond_instrument_prefix=
 { C_STRING_WITH_LEN("Wait/Synch/Cond/") };
 
+LEX_STRING thread_instrument_prefix=
+{ C_STRING_WITH_LEN("Thread/") };
+
 LEX_STRING timer_name_wait=
 { C_STRING_WITH_LEN("Wait") };
 

=== modified file 'storage/perfschema/psm_column_values.h'
--- a/storage/perfschema/psm_column_values.h	2008-10-30 04:49:42 +0000
+++ b/storage/perfschema/psm_column_values.h	2008-11-11 17:09:18 +0000
@@ -19,6 +19,7 @@
 extern LEX_STRING mutex_instrument_prefix;
 extern LEX_STRING rwlock_instrument_prefix;
 extern LEX_STRING cond_instrument_prefix;
+extern LEX_STRING thread_instrument_prefix;
 
 extern LEX_STRING timer_name_wait;
 

=== modified file 'storage/perfschema/psm_global.cc'
--- a/storage/perfschema/psm_global.cc	2008-11-01 01:05:08 +0000
+++ b/storage/perfschema/psm_global.cc	2008-11-11 17:09:18 +0000
@@ -60,3 +60,7 @@ uint randomized_index(void *ptr, uint ma
   return (uint) index % max_size;
 }
 
+void psm_print_error(const char* format, ...)
+{
+}
+

=== modified file 'storage/perfschema/psm_global.h'
--- a/storage/perfschema/psm_global.h	2008-11-01 01:05:08 +0000
+++ b/storage/perfschema/psm_global.h	2008-11-11 17:09:18 +0000
@@ -24,5 +24,7 @@ void psm_free(void *ptr);
 
 uint randomized_index(void *ptr, uint max_size);
 
+void psm_print_error(const char* format, ...);
+
 #endif
 

=== modified file 'storage/perfschema/psm_server.cc'
--- a/storage/perfschema/psm_server.cc	2008-10-30 00:41:16 +0000
+++ b/storage/perfschema/psm_server.cc	2008-11-11 17:09:18 +0000
@@ -55,6 +55,12 @@ static uint sync_info_sizing= PSM_MAX_SY
 static uint sync_info_sizing= 1000;
 #endif
 
+#ifdef PSM_MAX_THREAD_INFO
+static uint thread_info_sizing= PSM_MAX_THREAD_INFO;
+#else
+static uint thread_info_sizing= 1000;
+#endif
+
 #ifdef PSM_MAX_MUTEX
 static uint mutex_sizing= PSM_MAX_MUTEX;
 #else
@@ -106,6 +112,13 @@ struct psm_option all_psm_options[] =
     NULL
   },
   {
+    "--psm-max-thread-info",
+    "Maximum number of thread info objects.",
+    OPTION_UINT,
+    & thread_info_sizing,
+    NULL
+  },
+  {
     "--psm-max-mutex",
     "Maximum number of instrumented MUTEX.",
     OPTION_UINT,
@@ -382,7 +395,8 @@ initialize_performance_schema(int argc_i
   }
 
   if (init_sync_info(sync_info_sizing) ||
-      init_sync(mutex_sizing, rwlock_sizing, cond_sizing))
+      init_thread_info(thread_info_sizing) ||
+      init_sync(mutex_sizing, rwlock_sizing, cond_sizing, thread_sizing))
   {
     /*
       The performance schema initialization failed.
@@ -459,6 +473,7 @@ int bootstrap_performance_schema(THD *th
 void shutdown_performance_schema()
 {
   cleanup_sync_info();
+  cleanup_thread_info();
   cleanup_sync();
 }
 

=== modified file 'storage/perfschema/psm_sync.cc'
--- a/storage/perfschema/psm_sync.cc	2008-11-01 01:05:08 +0000
+++ b/storage/perfschema/psm_sync.cc	2008-11-11 17:09:18 +0000
@@ -24,12 +24,18 @@ static uint rwlock_max;
 static uint rwlock_lost;
 static uint cond_max;
 static uint cond_lost;
+static uint thread_max;
+static uint thread_lost;
 
 static PSM_mutex *mutex_array= NULL;
 static PSM_rwlock *rwlock_array= NULL;
 static PSM_cond *cond_array= NULL;
+static PSM_thread *thread_array= NULL;
 
-int init_sync(uint mutex_sizing, uint rwlock_sizing, uint cond_sizing)
+int init_sync(uint mutex_sizing,
+              uint rwlock_sizing,
+              uint cond_sizing,
+              uint thread_sizing)
 {
   mutex_max= mutex_sizing;
   mutex_lost= 0;
@@ -37,12 +43,15 @@ int init_sync(uint mutex_sizing, uint rw
   rwlock_lost= 0;
   cond_max= cond_sizing;
   cond_lost= 0;
+  thread_max= thread_sizing;
+  thread_lost= 0;
 
   mutex_array= PSM_MALLOC_ARRAY(mutex_max, PSM_mutex, MYF(MY_ZEROFILL));
   rwlock_array= PSM_MALLOC_ARRAY(rwlock_max, PSM_rwlock, MYF(MY_ZEROFILL));
   cond_array= PSM_MALLOC_ARRAY(cond_max, PSM_cond, MYF(MY_ZEROFILL));
+  thread_array= PSM_MALLOC_ARRAY(thread_max, PSM_thread, MYF(MY_ZEROFILL));
 
-  return ((mutex_array && rwlock_array && cond_array) ? 0 : 1);
+  return ((mutex_array && rwlock_array && cond_array && thread_array) ? 0 : 1);
 }
 
 void cleanup_sync()
@@ -53,6 +62,8 @@ void cleanup_sync()
   rwlock_array= NULL;
   psm_free(cond_array);
   cond_array= NULL;
+  psm_free(thread_array);
+  thread_array= NULL;
 }
 
 PSM_mutex* create_mutex(PSM_sync_info *info, void *identity)
@@ -173,3 +184,38 @@ void destroy_cond(PSM_cond *psm)
   psm->m_allocated= false;
 }
 
+PSM_thread* create_thread(PSM_thread_info *info, void *identity)
+{
+  int pass;
+  PSM_thread *psm;
+  uint i= randomized_index(identity, thread_max);
+
+  /*
+    Pass 1: [random, thread_max-1]
+    Pass 2: [0  thread_max-1]
+  */
+  for (pass= 1; pass <= 2; i=0, pass++)
+  {
+    for ( ; i < cond_max; i++)
+    {
+      psm= & thread_array[i];
+      if (! psm->m_allocated)
+      {
+        // TODO: atomic here
+        psm->m_allocated= true;
+        psm->m_identity= identity;
+        psm->m_info= info;
+        return psm;
+      }
+    }
+  }
+
+  thread_lost++;
+  return NULL;
+}
+
+void destroy_thread(PSM_thread *psm)
+{
+  DBUG_ASSERT(psm != NULL);
+  psm->m_allocated= false;
+}

=== modified file 'storage/perfschema/psm_sync.h'
--- a/storage/perfschema/psm_sync.h	2008-10-30 00:41:16 +0000
+++ b/storage/perfschema/psm_sync.h	2008-11-11 17:09:18 +0000
@@ -17,6 +17,7 @@
 #define PSM_SYNC_H
 
 #include "psm_sync_info.h"
+#include "acts_waits.h"
 
 struct PSM_thread;
 
@@ -66,7 +67,22 @@ struct PSM_cond
   PSM_cond_stat m_stat;
 };
 
-int init_sync(uint mutex_sizing, uint rwlock_sizing, uint cond_sizing);
+#define LOCKER_STACK_SIZE 3
+
+struct PSM_thread
+{
+  bool m_allocated;
+  void *m_identity;
+  unsigned long m_thread_id;
+  PSM_thread_info *m_info;
+  uint m_locker_count;
+  PSM_locker m_locker_stack[LOCKER_STACK_SIZE];
+};
+
+int init_sync(uint mutex_sizing,
+              uint rwlock_sizing,
+              uint cond_sizing,
+              uint thread_sizing);
 void cleanup_sync();
 
 PSM_mutex* create_mutex(PSM_sync_info *info, void *identity);
@@ -78,5 +94,8 @@ void destroy_rwlock(PSM_rwlock *psm);
 PSM_cond* create_cond(PSM_sync_info *info, void *identity);
 void destroy_cond(PSM_cond *psm);
 
+PSM_thread* create_thread(PSM_thread_info *info, void *identity);
+void destroy_thread(PSM_thread *psm);
+
 #endif
 

=== modified file 'storage/perfschema/psm_sync_info.cc'
--- a/storage/perfschema/psm_sync_info.cc	2008-11-06 17:25:15 +0000
+++ b/storage/perfschema/psm_sync_info.cc	2008-11-11 17:09:18 +0000
@@ -45,6 +45,50 @@ static uint sync_info_lost;
 
 static PSM_sync_info *sync_info_array= NULL;
 
+/**
+  Current number or elements in thread_info_array.
+  This global variable is written to during:
+  - the performance schema initialization
+  - a plugin initialization
+*/
+static uint thread_info_count;
+
+/**
+  Maximum nember of elements in thread_info_array.
+  This global variable is written to during:
+  - the performance schema initialization,
+  and is constant afterwards.
+*/
+static uint thread_info_max;
+
+/**
+  Number of elements the code failed to record in thread_info_array.
+  Normally, this variable should be 0.
+*/
+static uint thread_info_lost;
+
+static PSM_thread_info *thread_info_array= NULL;
+
+#ifndef DBUG_OFF
+static void DEBUG_assert_main_or_plugin()
+{
+  extern int mysqld_server_started;
+  extern mysql_mutex_t LOCK_plugin;
+
+  /*
+    Make sure register_sync_info() is safe to execute:
+    - either the server is not started yet, the thread running main() is
+    performing registration for the server,
+    - or the server is started, and a plug-in is performing it's own
+    registration. In this case, we are protected by the LOCK_plugin mutex.
+  */
+  if (mysqld_server_started)
+  {
+    MYSQL_MUTEX_ASSERT_OWNER(& LOCK_plugin);
+  }
+}
+#endif
+
 int init_sync_info(uint sync_info_sizing)
 {
   sync_info_count= 0;
@@ -62,32 +106,33 @@ void cleanup_sync_info()
   sync_info_array= NULL;
 }
 
+int init_thread_info(uint thread_info_sizing)
+{
+  thread_info_count= 0;
+  thread_info_max= thread_info_sizing;
+  thread_info_lost= 0;
+
+  thread_info_array= PSM_MALLOC_ARRAY(thread_info_max, PSM_thread_info, 0);
+
+  return (thread_info_array ? 0 : 1);
+}
+
+void cleanup_thread_info()
+{
+  psm_free(thread_info_array);
+  thread_info_array= NULL;
+}
+
 PSM_sync_key register_sync_info(PSM_sync_type sync_type,
-                                const char* category,
-                                int category_length,
                                 const char* name,
+                                int name_length,
                                 int flags)
 {
   uint index;
   PSM_sync_info *entry;
 
 #ifndef DBUG_OFF
-  {
-    extern int mysqld_server_started;
-    extern mysql_mutex_t LOCK_plugin;
-
-    /*
-      Make sure register_sync_info() is safe to execute:
-      - either the server is not started yet, the thread running main() is
-      performing registration for the server,
-      - or the server is started, and a plug-in is performing it's own
-      registration. In this case, we are protected by the LOCK_plugin mutex.
-    */
-    if (mysqld_server_started)
-    {
-      MYSQL_MUTEX_ASSERT_OWNER(& LOCK_plugin);
-    }
-  }
+  DEBUG_assert_main_or_plugin();
 #endif
 
   for (index= 0; index < sync_info_count; index++)
@@ -95,8 +140,7 @@ PSM_sync_key register_sync_info(PSM_sync
     entry= & sync_info_array[index];
 
     if ((entry->m_type == sync_type) &&
-        (strncmp(entry->m_category, category, MAX_CATEGORY_LENGTH) == 0) &&
-        (strncmp(entry->m_name, name, MAX_SYNC_NAME_LENGTH) == 0))
+        (strncmp(entry->m_name, name, MAX_INFO_NAME_LENGTH) == 0))
     {
       DBUG_ASSERT(entry->m_flags == flags);
       return (index+1);
@@ -105,15 +149,11 @@ PSM_sync_key register_sync_info(PSM_sync
 
   if (sync_info_count < sync_info_max)
   {
-    int name_len;
     entry= & sync_info_array[sync_info_count];
     entry->m_type= sync_type;
-    strncpy(entry->m_category, category, category_length);
-    entry->m_category_length= category_length;
-    name_len= strlen(name);
-    DBUG_ASSERT(name_len <= MAX_SYNC_NAME_LENGTH);
-    strncpy(entry->m_name, name, name_len);
-    entry->m_name_length= name_len;
+    DBUG_ASSERT(name_length <= MAX_INFO_NAME_LENGTH);
+    strncpy(entry->m_name, name, name_length);
+    entry->m_name_length= name_length;
     entry->m_flags= flags;
     entry->m_enabled= true;
     entry->m_timed= true;
@@ -133,3 +173,51 @@ PSM_sync_info *find_sync_info(PSM_sync_k
   return & sync_info_array[key-1];
 }
 
+PSM_thread_key register_thread_info(const char* name,
+                                    int name_length,
+                                    int flags)
+{
+  uint index;
+  PSM_thread_info *entry;
+
+#ifndef DBUG_OFF
+  DEBUG_assert_main_or_plugin();
+#endif
+
+  for (index= 0; index < thread_info_count; index++)
+  {
+    entry= & thread_info_array[index];
+
+    if (strncmp(entry->m_name, name, MAX_INFO_NAME_LENGTH) == 0)
+    {
+      DBUG_ASSERT(entry->m_flags == flags);
+      return (index+1);
+    }
+  }
+
+  if (thread_info_count < thread_info_max)
+  {
+    entry= & thread_info_array[thread_info_count];
+    DBUG_ASSERT(name_length <= MAX_INFO_NAME_LENGTH);
+    strncpy(entry->m_name, name, name_length);
+    entry->m_name_length= name_length;
+    entry->m_flags= flags;
+    entry->m_enabled= true;
+    thread_info_count++;
+    return thread_info_count;
+  }
+
+  thread_info_lost++;
+  return 0;
+}
+
+
+PSM_thread_info *find_thread_info(PSM_sync_key key)
+{
+  if ((key == 0) || (key > thread_info_count))
+    return 0;
+
+  return & thread_info_array[key-1];
+}
+
+

=== modified file 'storage/perfschema/psm_sync_info.h'
--- a/storage/perfschema/psm_sync_info.h	2008-11-06 17:25:15 +0000
+++ b/storage/perfschema/psm_sync_info.h	2008-11-11 17:09:18 +0000
@@ -16,24 +16,13 @@
 #ifndef PSM_SYNC_INFO_H
 #define PSM_SYNC_INFO_H
 
-/*
-  A fully qualified instrument name contains:
-  - a prefix (Wait/Synch/Mutex/, Wait/Synch/Rwlock/, Wait/Synch/Cond/)
-  - a category (Core/, Maria/, <plugin-name>/)
-  - a name (LOCK_open, ...)
-  The total must fit into 64 characters, so we allocate size as follows:
-  - the max prefix is 18
-  - the max category length is 12
-  - the max name is 64 - 18 - 12 = 34
-*/
-
-#define MAX_PREFIX_LENGTH 18
-#define MAX_CATEGORY_LENGTH 12
-#define MAX_SYNC_NAME_LENGTH 34
+#define MAX_INFO_NAME_LENGTH 64
+#define MAX_PREFIX_NAME_LENGTH 32
 
 #include "mysql/psi.h"
 
 typedef unsigned int PSM_sync_key;
+typedef unsigned int PSM_thread_key;
 
 enum PSM_sync_type
 {
@@ -46,25 +35,39 @@ enum PSM_sync_type
 struct PSM_sync_info
 {
   PSM_sync_type m_type;
-  char m_category[MAX_CATEGORY_LENGTH];
-  int m_category_length;
-  char m_name[MAX_SYNC_NAME_LENGTH];
+  char m_name[MAX_INFO_NAME_LENGTH];
   int m_name_length;
   int m_flags;
   bool m_enabled;
   bool m_timed;
 };
 
+struct PSM_thread_info
+{
+  char m_name[MAX_INFO_NAME_LENGTH];
+  int m_name_length;
+  int m_flags;
+  bool m_enabled;
+};
+
 int init_sync_info(uint sync_info_sizing);
 void cleanup_sync_info();
 
+int init_thread_info(uint thread_info_sizing);
+void cleanup_thread_info();
+
 PSM_sync_key register_sync_info(PSM_sync_type sync_type,
-                                const char* category,
-                                int category_length,
                                 const char* name,
+                                int name_length,
                                 int flags);
 
 PSM_sync_info *find_sync_info(PSM_sync_key key);
 
+PSM_thread_key register_thread_info(const char* name,
+                                    int name_length,
+                                    int flags);
+
+PSM_thread_info *find_thread_info(PSM_sync_key key);
+
 #endif
 

=== modified file 'storage/perfschema/psm_table.cc'
--- a/storage/perfschema/psm_table.cc	2008-11-06 17:25:15 +0000
+++ b/storage/perfschema/psm_table.cc	2008-11-11 17:09:18 +0000
@@ -16,6 +16,7 @@
 #include "mysql_priv.h"
 #include "psm_table.h"
 
+#include "table_acts_waits_current.h"
 #include "table_setup_actors.h"
 #include "table_setup_consumers.h"
 #include "table_setup_instruments.h"
@@ -24,6 +25,7 @@
 
 static psm_table_info *psm_all_tables[]=
 {
+  & table_acts_waits_current::m_info,
   & table_setup_actors::m_info,
   & table_setup_consumers::m_info,
   & table_setup_instruments::m_info,

=== added file 'storage/perfschema/table_acts_waits_current.cc'
--- a/storage/perfschema/table_acts_waits_current.cc	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_acts_waits_current.cc	2008-11-11 17:09:18 +0000
@@ -0,0 +1,126 @@
+/* Copyright (C) 2008 Sun Microsystems, Inc
+
+  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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+#include "mysql_priv.h"
+#include "table_acts_waits_current.h"
+
+psm_table_info
+table_acts_waits_current::m_info=
+{
+  { C_STRING_WITH_LEN("acts_waits_current") },
+  & table_acts_waits_current::create,
+  NULL,
+  1000, // TODO: records
+  0, // deleted
+  sizeof(row_acts_waits_current), // rec length
+  0, // options
+  sizeof(pos_acts_waits_current), // ref length
+  1000 // TODO: estimate rows upper bound
+};
+
+psm_table* table_acts_waits_current::create()
+{
+  return new table_acts_waits_current();
+}
+
+table_acts_waits_current::table_acts_waits_current()
+{
+  m_pos.m_thread_index= 0;
+  m_pos.m_local_index= 0;
+  m_row= NULL;
+}
+
+int table_acts_waits_current::rnd_next(void *ref)
+{
+  int result;
+
+  result= HA_ERR_END_OF_FILE;
+
+  return result;
+}
+
+int table_acts_waits_current::rnd_pos(void *ref, const void *pos)
+{
+  set_position(pos);
+  if (ref != pos)
+    record_position(ref);
+
+  return HA_ERR_WRONG_COMMAND;
+}
+
+void table_acts_waits_current::record_position(void *ref)
+{
+  memcpy(ref, & m_pos, sizeof(pos_acts_waits_current));
+}
+
+void table_acts_waits_current::set_position(const void *ref)
+{
+  memcpy(& m_pos, ref, sizeof(pos_acts_waits_current));
+}
+
+int table_acts_waits_current::read_row_values(TABLE *table,
+                                              unsigned char *buf,
+                                              Field **fields)
+{
+#ifdef LATER
+  Field *f;
+  Field_enum *col_timer_name;
+  Field_longlong *col_timer_frequency;
+  Field_longlong *col_timer_interval;
+  Field_longlong *col_timer_overhead;
+
+  DBUG_ASSERT(m_row);
+
+  /* Set the null bits */
+  DBUG_ASSERT(table->s->null_bytes == 1);
+  buf[0]= 0;
+
+  for (; *fields ; fields++)
+  {
+    f= *fields;
+
+    if (bitmap_is_set(table->read_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case 0:
+        DBUG_ASSERT(f->real_type() == MYSQL_TYPE_ENUM);
+        col_timer_name= (Field_enum*) f;
+        col_timer_name->store_type(m_row->m_timer_name);
+        break;
+      case 1:
+        DBUG_ASSERT(f->real_type() == MYSQL_TYPE_LONGLONG);
+        col_timer_frequency= (Field_longlong*) f;
+        col_timer_frequency->store(m_row->m_timer_frequency);
+        break;
+      case 2:
+        DBUG_ASSERT(f->real_type() == MYSQL_TYPE_LONGLONG);
+        col_timer_interval= (Field_longlong*) f;
+        col_timer_interval->store(m_row->m_timer_interval);
+        break;
+      case 3:
+        DBUG_ASSERT(f->real_type() == MYSQL_TYPE_LONGLONG);
+        col_timer_overhead= (Field_longlong*) f;
+        col_timer_overhead->store(m_row->m_timer_overhead);
+        break;
+      default:
+        DBUG_ASSERT(false);
+      }
+    }
+  }
+#endif
+  return 0;
+}
+

=== added file 'storage/perfschema/table_acts_waits_current.h'
--- a/storage/perfschema/table_acts_waits_current.h	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_acts_waits_current.h	2008-11-11 17:09:18 +0000
@@ -0,0 +1,64 @@
+/* Copyright (C) 2008 Sun Microsystems, Inc
+
+  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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+#ifndef TABLE_ACTS_WAITS_CURRENT_H
+#define TABLE_ACTS_WAITS_CURRENT_H
+
+#include "psm_column_types.h"
+#include "psm_table.h"
+
+struct row_acts_waits_current
+{
+  ulong m_thread_id;
+  longlong m_act_id;
+  longlong m_timer_start;
+  longlong m_timer_end;
+  longlong m_timer_wait;
+  void * m_object_instance;
+};
+
+struct pos_acts_waits_current
+{
+  uint m_thread_index;
+  uint m_local_index;
+};
+
+class table_acts_waits_current : public psm_readonly_table
+{
+public:
+  static psm_table_info m_info;
+  static psm_table* create();
+
+  virtual int rnd_next(void *ref);
+  virtual int rnd_pos(void *ref, const void *pos);
+  virtual void record_position(void *ref);
+  virtual void set_position(const void *ref);
+
+protected:
+  virtual int read_row_values(TABLE *table, unsigned char *buf, Field **fields);
+
+protected:
+  table_acts_waits_current();
+
+public:
+  ~table_acts_waits_current()
+  {}
+
+private:
+  pos_acts_waits_current m_pos;
+  row_acts_waits_current *m_row;
+};
+
+#endif

=== modified file 'storage/perfschema/table_setup_instruments.cc'
--- a/storage/perfschema/table_setup_instruments.cc	2008-11-06 17:25:15 +0000
+++ b/storage/perfschema/table_setup_instruments.cc	2008-11-11 17:09:18 +0000
@@ -89,37 +89,14 @@ void table_setup_instruments::set_positi
 
 void table_setup_instruments::make_row(PSM_sync_info *info)
 {
-  char* name_ptr;
-  const LEX_STRING *prefix;
-
   if (info == NULL)
   {
     m_row_exists= false;
     return;
   }
 
-  switch (info->m_type) {
-  case SYNC_MUTEX:
-    prefix= & mutex_instrument_prefix;
-    break;
-  case SYNC_RWLOCK:
-    prefix= & rwlock_instrument_prefix;
-    break;
-  case SYNC_COND:
-    prefix= & cond_instrument_prefix;
-    break;
-  default:
-    DBUG_ASSERT(false);
-  }
-  DBUG_ASSERT(prefix->length <= MAX_PREFIX_LENGTH);
-  /* Instrument name = Prefix + category + name */
-  memcpy(m_row.m_name, prefix->str, prefix->length);
-  name_ptr= m_row.m_name + prefix->length;
-  memcpy(name_ptr, info->m_category, info->m_category_length);
-  name_ptr+= info->m_category_length;
-  memcpy(name_ptr, info->m_name, info->m_name_length);
-  name_ptr+= info->m_name_length;
-  m_row.m_name_length= name_ptr - m_row.m_name;
+  m_row.m_name= & info->m_name[0];
+  m_row.m_name_length= info->m_name_length;
   m_row.m_enabled_ptr= & info->m_enabled;
   m_row.m_timed_ptr= & info->m_timed;
   m_row_exists= true;

=== modified file 'storage/perfschema/table_setup_instruments.h'
--- a/storage/perfschema/table_setup_instruments.h	2008-11-06 17:25:15 +0000
+++ b/storage/perfschema/table_setup_instruments.h	2008-11-11 17:09:18 +0000
@@ -21,7 +21,7 @@
 
 struct row_setup_instruments
 {
-  char m_name[64];
+  const char *m_name;
   int m_name_length;
   bool *m_enabled_ptr;
   bool *m_timed_ptr;

Thread
bzr commit into mysql-6.0-perf branch (marc.alff:2731) Marc Alff11 Nov