List:Commits« Previous MessageNext Message »
From:Marc Alff Date:October 31 2008 2:27am
Subject:bzr commit into mysql-6.0-perf branch (marc.alff:2722)
View as plain text  
#At file:///home/malff/BZR-TREE/mysql-6.0-perf/

 2722 Marc Alff	2008-10-30
      Doxygen documentation for the instrumentation interface
modified:
  include/mysql/mysql_mutex.h
  include/mysql/psi.h
  storage/maria/ma_static.c
  storage/perfschema/psm_column_types.h
  storage/perfschema/table_setup_instruments.cc

=== modified file 'include/mysql/mysql_mutex.h'
--- a/include/mysql/mysql_mutex.h	2008-10-30 00:41:16 +0000
+++ b/include/mysql/mysql_mutex.h	2008-10-31 02:26:32 +0000
@@ -1,7 +1,24 @@
+/* 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 MYSQL_MUTEX_H
 #define MYSQL_MUTEX_H
 
+/**
+  @file mysql/mysql_mutex.h
+ */
 /*
   Note: there are several orthogonal dimensions here.
 
@@ -18,6 +35,8 @@
   - the pthread library
   - fast mutexes
   - window apis
+
+  This causes complexity with '#ifdef'-ery that can't be avoided.
 */
 
 #ifdef HAVE_PSI_INTERFACE
@@ -29,56 +48,229 @@ struct PSI_rwlock;
 struct PSI_cond;
 #endif
 
-#define MYSQL_MUTEX_ASSERT_OWNER(M) safe_mutex_assert_owner(& (M)->m_mutex)
-#define MYSQL_MUTEX_ASSERT_NOT_OWNER(M) safe_mutex_assert_not_owner(& (M)->m_mutex)
+/**
+  @defgroup Mutex_instrumentation Mutex Instrumentation
+  @ingroup Performance_schema_interface
+  @{
+*/
+
+/**
+  \def MYSQL_MUTEX_ASSERT_OWNER(M)
+  Instrumented mutex_assert_owner.
+  @c MYSQL_MUTEX_ASSERT_OWNER is a drop in replacement
+  for @c safe_mutex_assert_owner.
+*/
+#define MYSQL_MUTEX_ASSERT_OWNER(M) \
+  safe_mutex_assert_owner(& (M)->m_mutex)
 
+/**
+  \def MYSQL_MUTEX_ASSERT_NOT_OWNER(M)
+  Instrumented mutex_assert_not_owner.
+  @c MYSQL_MUTEX_ASSERT_NOT_OWNER is a drop in replacement
+  for @c safe_mutex_assert_not_owner.
+*/
+#define MYSQL_MUTEX_ASSERT_NOT_OWNER(M) \
+  safe_mutex_assert_not_owner(& (M)->m_mutex)
+
+/**
+  \def MYSQL_MUTEX_INIT(M,K,A)
+  Instrumented mutex_init.
+  @c MYSQL_MUTEX_INIT is a replacement
+  for @c pthread_mutex_init.
+  @param M the mutex to initialize
+  @param K the PSM_mutex_key for this instrumented mutex
+  @param A mutex attributes
+*/
 #ifdef HAVE_PSI_INTERFACE
   #ifdef SAFE_MUTEX
     #define MYSQL_MUTEX_INIT(M,K,A) mysql_mutex_init(M,K,A,__FILE__,__LINE__)
   #else
     #define MYSQL_MUTEX_INIT(M,K,A) mysql_mutex_init(M,K,A)
   #endif
-  #define MYSQL_RWLOCK_INIT(M,K) mysql_rwlock_init(M,K)
-  #define MYSQL_COND_INIT(C,K,A) mysql_cond_init(C,K,A)
 #else
   #ifdef SAFE_MUTEX
     #define MYSQL_MUTEX_INIT(M,K,A) mysql_mutex_init(M,A,__FILE__,__LINE__)
   #else
     #define MYSQL_MUTEX_INIT(M,K,A) mysql_mutex_init(M,A)
   #endif
-  #define MYSQL_RWLOCK_INIT(M,K) mysql_rwlock_init(M)
-  #define MYSQL_COND_INIT(C,K,A) mysql_cond_init(C,A)
 #endif
 
+/**
+  \def MYSQL_MUTEX_DESTROY(M)
+  Instrumented mutex_destroy.
+  @c MYSQL_MUTEX_DESTROY is a drop in replacement
+  for @c pthread_mutex_destroy.
+*/
 #ifdef SAFE_MUTEX
   #define MYSQL_MUTEX_DESTROY(M) mysql_mutex_destroy(M,__FILE__,__LINE__)
-  #define MYSQL_MUTEX_LOCK(M) mysql_mutex_lock(M,__FILE__,__LINE__)
-  #define MYSQL_MUTEX_UNLOCK(M) mysql_mutex_unlock(M,__FILE__,__LINE__)
 #else
   #define MYSQL_MUTEX_DESTROY(M) mysql_mutex_destroy(M)
+#endif
+
+/**
+  \def MYSQL_MUTEX_LOCK(M)
+  Instrumented mutex_lock.
+  @c MYSQL_MUTEX_LOCK is a drop in replacement
+  for @c pthread_mutex_lock.
+*/
+#ifdef SAFE_MUTEX
+  #define MYSQL_MUTEX_LOCK(M) mysql_mutex_lock(M,__FILE__,__LINE__)
+#else
   #define MYSQL_MUTEX_LOCK(M) mysql_mutex_lock(M)
+#endif
+
+/**
+  \def MYSQL_MUTEX_UNLOCK(M)
+  Instrumented mutex_unlock.
+  @c MYSQL_MUTEX_UNLOCK is a drop in replacement
+  for @c pthread_mutex_unlock.
+*/
+#ifdef SAFE_MUTEX
+  #define MYSQL_MUTEX_UNLOCK(M) mysql_mutex_unlock(M,__FILE__,__LINE__)
+#else
   #define MYSQL_MUTEX_UNLOCK(M) mysql_mutex_unlock(M)
 #endif
 
-#define MYSQL_RWLOCK_DESTROY(M) mysql_rwlock_destroy(M)
-#define MYSQL_RWLOCK_RDLOCK(M) mysql_rwlock_rdlock(M)
-#define MYSQL_RWLOCK_WRLOCK(M) mysql_rwlock_wrlock(M)
-#define MYSQL_RWLOCK_TRYRDLOCK(M) mysql_rwlock_tryrdlock(M)
-#define MYSQL_RWLOCK_TRYWRLOCK(M) mysql_rwlock_trywrlock(M)
-#define MYSQL_RWLOCK_UNLOCK(M) mysql_rwlock_unlock(M)
+/**
+  \def MYSQL_RWLOCK_INIT(RW,K)
+  Instrumented rwlock_init.
+  @c MYSQL_RWLOCK_INIT is a replacement
+  for @c pthread_rwlock_init.
+  Note that pthread_rwlockattr_t is not supported in MySQL.
+  @param RW the rwlock to initialize
+  @param K the PSM_rwlock_key for this instrumented rwlock
+*/
+#ifdef HAVE_PSI_INTERFACE
+  #define MYSQL_RWLOCK_INIT(RW,K) mysql_rwlock_init(RW,K)
+#else
+  #define MYSQL_RWLOCK_INIT(RW,K) mysql_rwlock_init(RW)
+#endif
+
+/**
+  \def MYSQL_RWLOCK_DESTROY(RW)
+  Instrumented rwlock_destroy.
+  @c MYSQL_RWLOCK_DESTROY is a drop in replacement
+  for @c pthread_rwlock_destroy.
+*/
+#define MYSQL_RWLOCK_DESTROY(RW) mysql_rwlock_destroy(RW)
+
+/**
+  \def MYSQL_RWLOCK_RDLOCK(RW)
+  Instrumented rwlock_rdlock.
+  @c MYSQL_RWLOCK_RDLOCK is a drop in replacement
+  for @c pthread_rwlock_rdlock.
+*/
+#define MYSQL_RWLOCK_RDLOCK(RW) mysql_rwlock_rdlock(RW)
+
+/**
+  \def MYSQL_RWLOCK_WRLOCK(RW)
+  Instrumented rwlock_wrlock.
+  @c MYSQL_RWLOCK_WRLOCK is a drop in replacement
+  for @c pthread_rwlock_wrlock.
+*/
+#define MYSQL_RWLOCK_WRLOCK(RW) mysql_rwlock_wrlock(RW)
 
+/**
+  \def MYSQL_RWLOCK_TRYRDLOCK(RW)
+  Instrumented rwlock_tryrdlock.
+  @c MYSQL_RWLOCK_TRYRDLOCK is a drop in replacement
+  for @c pthread_rwlock_tryrdlock.
+*/
+#define MYSQL_RWLOCK_TRYRDLOCK(RW) mysql_rwlock_tryrdlock(RW)
+
+/**
+  \def MYSQL_RWLOCK_TRYWRLOCK(RW)
+  Instrumented rwlock_trywrlock.
+  @c MYSQL_RWLOCK_TRYWRLOCK is a drop in replacement
+  for @c pthread_rwlock_trywrlock.
+*/
+#define MYSQL_RWLOCK_TRYWRLOCK(RW) mysql_rwlock_trywrlock(RW)
+
+/**
+  \def MYSQL_RWLOCK_UNLOCK(RW)
+  Instrumented rwlock_unlock.
+  @c MYSQL_RWLOCK_UNLOCK is a drop in replacement
+  for @c pthread_rwlock_unlock.
+*/
+#define MYSQL_RWLOCK_UNLOCK(RW) mysql_rwlock_unlock(RW)
+
+/**
+  \def MYSQL_COND_INIT(C,K,A)
+  Instrumented rwlock_init.
+  @c MYSQL_COND_INIT is a replacement
+  for @c pthread_cond_init.
+  @param C the cond to initialize
+  @param K the PSM_cond_key for this instrumented cond
+  @param A condition attributes
+*/
+#ifdef HAVE_PSI_INTERFACE
+  #define MYSQL_COND_INIT(C,K,A) mysql_cond_init(C,K,A)
+#else
+  #define MYSQL_COND_INIT(C,K,A) mysql_cond_init(C,A)
+#endif
+
+/**
+  \def MYSQL_COND_DESTROY(C)
+  Instrumented cond_destroy.
+  @c MYSQL_COND_DESTROY is a drop in replacement
+  for @c pthread_cond_destroy.
+*/
 #define MYSQL_COND_DESTROY(C) mysql_cond_destroy(C)
+
+/**
+  \def MYSQL_COND_WAIT(C)
+  Instrumented cond_wait.
+  @c MYSQL_COND_WAIT is a drop in replacement
+  for @c pthread_cond_wait.
+*/
 #define MYSQL_COND_WAIT(C,M) mysql_cond_wait(C,M)
+
+/**
+  \def MYSQL_COND_TIMEDWAIT(C,M,W)
+  Instrumented cond_timedwait.
+  @c MYSQL_COND_TIMEDWAIT is a drop in replacement
+  for @c pthread_cond_timedwait.
+*/
 #define MYSQL_COND_TIMEDWAIT(C,M,W) mysql_cond_timedwait(C,M,W)
+
+/**
+  \def MYSQL_COND_SIGNAL(C)
+  Instrumented cond_signal.
+  @c MYSQL_COND_SIGNAL is a drop in replacement
+  for @c pthread_cond_signal.
+*/
 #define MYSQL_COND_SIGNAL(C) mysql_cond_signal(C)
-#define MYSQL_COND_BROADCAST(C) mysql_cond_broadcast(C)
 
+/**
+  \def MYSQL_COND_BROADCAST(C)
+  Instrumented cond_broadcast.
+  @c MYSQL_COND_BROADCAST is a drop in replacement
+  for @c pthread_cond_broadcast.
+*/
+#define MYSQL_COND_BROADCAST(C) mysql_cond_broadcast(C)
 
+/**
+  An instrumented mutex structure.
+  @sa mysql_mutex_t
+*/
 struct s_mysql_mutex
 {
+  /** The real mutex. */
   pthread_mutex_t m_mutex;
+  /** The instrumentation hook. */
   struct PSI_mutex *m_psi;
 };
+
+/**
+  Type of an instrumented mutex.
+  @c mysql_mutex_t is a drop in replacement for @c pthread_mutex_t.
+  @sa MYSQL_MUTEX_ASSERT_OWNER
+  @sa MYSQL_MUTEX_ASSERT_NOT_OWNER
+  @sa MYSQL_MUTEX_INIT
+  @sa MYSQL_MUTEX_LOCK
+  @sa MYSQL_MUTEX_UNLOCK
+  @sa MYSQL_MUTEX_DESTROY
+*/
 typedef struct s_mysql_mutex mysql_mutex_t;
 
 static inline int mysql_mutex_init(
@@ -170,11 +362,29 @@ static inline int mysql_mutex_unlock(
   return result;
 }
 
+/**
+  An instrumented rwlock structure.
+  @sa mysql_rwlock_t
+*/
 struct s_mysql_rwlock
 {
+  /** The real rwlock */
   rw_lock_t m_rwlock;
+  /** The instrumentation hook. */
   struct PSI_rwlock *m_psi;
 };
+
+/**
+  Type of an instrumented rwlock.
+  @c mysql_rwlock_t is a drop in replacement for @c pthread_rwlock_t.
+  @sa MYSQL_RWLOCK_INIT
+  @sa MYSQL_RWLOCK_RDLOCK
+  @sa MYSQL_RWLOCK_TRYRDLOCK
+  @sa MYSQL_RWLOCK_WRLOCK
+  @sa MYSQL_RWLOCK_TRYWRLOCK
+  @sa MYSQL_RWLOCK_UNLOCK
+  @sa MYSQL_RWLOCK_DESTROY
+*/
 typedef struct s_mysql_rwlock mysql_rwlock_t;
 
 static inline int mysql_rwlock_init(
@@ -291,11 +501,28 @@ static inline int mysql_rwlock_unlock(
   return result;
 }
 
+/**
+  An instrumented cond structure.
+  @sa mysql_cond_t
+*/
 struct s_mysql_cond
 {
+  /** The real condition */
   pthread_cond_t m_cond;
+  /** The instrumentation hook. */
   struct PSI_cond *m_psi;
 };
+
+/**
+  Type of an instrumented condition.
+  @c mysql_cond_t is a drop in replacement for @c pthread_cond_t.
+  @sa MYSQL_COND_INIT
+  @sa MYSQL_COND_WAIT
+  @sa MYSQL_COND_TIMEDWAIT
+  @sa MYSQL_COND_SIGNAL
+  @sa MYSQL_COND_BROADCAST
+  @sa MYSQL_COND_DESTROY
+*/
 typedef struct s_mysql_cond mysql_cond_t;
 
 static inline int mysql_cond_init(
@@ -391,5 +618,9 @@ static inline int mysql_cond_broadcast(
   return result;
 }
 
+/**
+  @} (end of group Mutex_instrumentation)
+*/
+
 #endif
 

=== modified file 'include/mysql/psi.h'
--- a/include/mysql/psi.h	2008-10-23 18:22:09 +0000
+++ b/include/mysql/psi.h	2008-10-31 02:26:32 +0000
@@ -1,9 +1,47 @@
+/* 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 MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H
 #define MYSQL_PERFORMANCE_SCHEMA_INTERFACE_H
 
+/**
+  @file mysql/psi.h
+  @defgroup Performance_schema_interface Performance Schema Interface
+  @ingroup Performance_schema
+  @{
+*/
+
+/**
+  \def PSI_VERSION_1
+  Performance Schema Interface number for version 1.
+  This version is supported.
+*/
 #define PSI_VERSION_1 1
+
+/**
+  \def PSI_VERSION_2
+  Performance Schema Interface number for version 2.
+  This version is not implemented, it's a placeholder.
+*/
 #define PSI_VERSION_2 2
+
+/**
+  \def PSI_CURRENT_VERSION
+  Performance Schema Interface number for the most recent version.
+  The most current version is @c PSI_VERSION_1
+*/
 #define PSI_CURRENT_VERSION 1
 
 #ifndef USE_PSI_2
@@ -12,132 +50,448 @@
 #endif
 #endif
 
+/**
+  Entry point for the performance schema interface.
+*/
 struct PSI_bootstrap
 {
+  /**
+    ABI interface finder.
+    Calling this method with an interface version number returns either
+    an instance of the API for this version, or NULL.
+    @param version the interface version number to find
+    @return a versioned interface (PSI_v1, PSI_v2 or PSI)
+    @sa PSI_VERSION_1
+    @sa PSI_v1
+    @sa PSI_VERSION_2
+    @sa PSI_v2
+    @sa PSI_CURRENT_VERSION
+    @sa PSI
+  */
   void* (*get_PSI)(int version);
 };
 
-/* Opaque structure */
+/**
+  Interface for an instrumented mutex.
+  This is an opaque structure.
+*/
 struct PSI_mutex;
+
+/**
+  Interface for an instrumented rwlock.
+  This is an opaque structure.
+*/
 struct PSI_rwlock;
+
+/**
+  Interface for an instrumented condition.
+  This is an opaque structure.
+*/
 struct PSI_cond;
+
+/**
+  Interface for an instrumented thread.
+  This is an opaque structure.
+*/
 struct PSI_thread;
+
+/**
+  Interface for an instrumented lock operation.
+  This is an opaque structure.
+*/
 struct PSI_locker;
 
-/* Opaque key */
+/**
+  Instrumented mutex key.
+  This is an opaque key.
+*/
 typedef unsigned int PSI_mutex_key;
+
+/**
+  Instrumented rwlock key.
+  This is an opaque key.
+*/
 typedef unsigned int PSI_rwlock_key;
+
+/**
+  Instrumented cond key.
+  This is an opaque key.
+*/
 typedef unsigned int PSI_cond_key;
 
+/**
+  \def USE_PSI_1
+  Define USE_PSI_1 to use the interface version 1.
+*/
+
+/**
+  \def USE_PSI_2
+  Define USE_PSI_2 to use the interface version 2.
+*/
+
+/**
+  \def HAVE_PSI_1
+  Define HAVE_PSI_1 if the interface version 1 needs to be compiled in.
+*/
+
+/**
+  \def HAVE_PSI_2
+  Define HAVE_PSI_2 if the interface version 2 needs to be compiled in.
+*/
+
+/**
+  Global flag.
+  This flag indicate that an instrumentation point is a global variable,
+  or a singleton.
+*/
+#define PSI_FLAG_GLOBAL (1 << 1)
+
 #ifdef USE_PSI_1
 #define HAVE_PSI_1
 #endif
 
 #ifdef HAVE_PSI_1
+
 /**
-  Performance Schema Application Binary Interface, version 1.
+  @defgroup Group_PSI_v1 Application Programming Interface, version 1
+  @ingroup Performance_schema_interface
+  @{
 */
 
-#define PSI_FLAG_GLOBAL 1
-
+/**
+  Mutex information.
+  @since PSI_VERSION_1
+  This structure is used to register an instrumented mutex.
+*/
 struct PSI_mutex_info_v1
 {
+  /**
+    Pointer to the key assigned to the registered mutex.
+  */
   PSI_mutex_key *m_key;
+  /**
+    The name of the mutex to register.
+  */
   const char* m_name;
+  /**
+    The flags of the mutex to register.
+    @sa PSI_FLAG_GLOBAL
+  */
   int m_flags;
 };
 
+/**
+  Rwlock information.
+  @since PSI_VERSION_1
+  This structure is used to register an instrumented rwlock.
+*/
 struct PSI_rwlock_info_v1
 {
+  /**
+    Pointer to the key assigned to the registered rwlock.
+  */
   PSI_rwlock_key *m_key;
+  /**
+    The name of the rwlock to register.
+  */
   const char* m_name;
+  /**
+    The flags of the rwlock to register.
+    @sa PSI_FLAG_GLOBAL
+  */
   int m_flags;
 };
 
+/**
+  Condition information.
+  @since PSI_VERSION_1
+  This structure is used to register an instrumented cond.
+*/
 struct PSI_cond_info_v1
 {
+  /**
+    Pointer to the key assigned to the registered cond.
+  */
   PSI_cond_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
+*/
 struct PSI_v1
 {
+  /**
+    Mutex registration API.
+    @param category a category name (typically a plugin name)
+    @param info an array of mutex info to register
+    @param count the size of the info array
+  */
   void (*register_mutex)(const char* category,
                          struct PSI_mutex_info_v1 *info,
                          int count);
+
+  /**
+    Rwlock registration API.
+    @param category a category name (typically a plugin name)
+    @param info an array of rwlock info to register
+    @param count the size of the info array
+  */
   void (*register_rwlock)(const char* category,
                           struct PSI_rwlock_info_v1 *info,
                           int count);
+
+  /**
+    Cond registration API.
+    @param category a category name (typically a plugin name)
+    @param info an array of cond info to register
+    @param count the size of the info array
+  */
   void (*register_cond)(const char* category,
                         struct PSI_cond_info_v1 *info,
                         int count);
 
+  /**
+    Mutex initialisation API.
+    @param key the registered mutex key
+    @param identity the address of the mutex itself
+    @return an instrumented mutex
+  */
   struct PSI_mutex* (*init_mutex)(PSI_mutex_key key,
                                   void *identity);
+
+  /**
+    Mutex destruction API.
+    @param mutex the mutex to destroy
+  */
   void (*destroy_mutex)(struct PSI_mutex *mutex);
+
+  /**
+    Rwlock initialisation API.
+    @param key the registered rwlock key
+    @param identity the address of the rwlock itself
+    @return an instrumented rwlock
+  */
   struct PSI_rwlock* (*init_rwlock)(PSI_rwlock_key key,
                                     void *identity);
+
+  /**
+    Rwlock destruction API.
+    @param rwlock the rwlock to destroy
+  */
   void (*destroy_rwlock)(struct PSI_rwlock *rwlock);
+
+  /**
+    Cond initialisation API.
+    @param key the registered key
+    @param identity the address of the rwlock itself
+    @return an instrumented cond
+  */
   struct PSI_cond* (*init_cond)(PSI_cond_key key,
                                 void *identity);
+
+  /**
+    Cond destruction API.
+    @param cond the rcond to destroy
+  */
   void (*destroy_cond)(struct PSI_cond *cond);
 
+  /**
+    Create an instrumented thread.
+    @return an instrumented thread
+  */
   struct PSI_thread* (*new_thread)();
+
+  /**
+    Get the instrumentation for the running thread.
+    For this function to return a result,
+    the thread instrumentation must have been attached to the
+    running thread using @c get_thread()
+    @return the instrumentation for the running thread
+  */
   struct PSI_thread* (*get_thread)();
+
+  /**
+    Attach a thread instrumentation to the running thread.
+    In case of thread pools, this method should be called when
+    a worker thread picks a work item and runs it.
+    Also, this method should be called if the instrumented code does not
+    keep the pointer returned by @c new_thread() and relies on @c get_thread()
+    instead.
+    @param thread the thread instrumentation
+  */
   void (*set_thread)(struct PSI_thread *thread);
+
+  /**
+    Delete a thread instrumentation.
+    @param thread the thread instrumentation to delete
+  */
   void (*delete_thread)(struct PSI_thread *thread);
 
+  /**
+    Get a thread locker.
+    This method is a helper that calls @c get_thread() and
+    then @c get_locker(). Please call @c get_locker() directy if the
+    current thread instrumentation is already available.
+    @return a thread locker
+  */
   struct PSI_locker* (*get_thread_locker)();
+
+  /**
+    Get a thread locker.
+    @param thread the instrumentation for the current thread
+    @return a thread locker
+  */
   struct PSI_locker* (*get_locker)(struct PSI_thread *thread);
 
+  /**
+    Record a mutex unlock event.
+    @param thread the running thread instrumentation
+    @param mutex the mutex instrumentation
+  */
   void (*unlock_mutex)(struct PSI_thread *thread,
                        struct PSI_mutex *mutex);
+
+  /**
+    Record a rwlock unlock event.
+    @param thread the running thread instrumentation
+    @param rwlock the rwlock instrumentation
+  */
   void (*unlock_rwlock)(struct PSI_thread *thread,
                         struct PSI_rwlock *rwlock);
+
+  /**
+    Record a condition signal event.
+    @param thread the running thread instrumentation
+    @param cond the cond instrumentation
+  */
   void (*signal_cond)(struct PSI_thread *thread,
                       struct PSI_cond *cond);
+
+  /**
+    Record a condition broadcast event.
+    @param thread the running thread instrumentation
+    @param cond the cond instrumentation
+  */
   void (*broadcast_cond)(struct PSI_thread *thread,
                          struct PSI_cond *cond);
 
+  /**
+    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 must,
                    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 must,
                      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 must,
                      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 must,
                        int rc);
 };
-#endif
+
+/**
+  @} (end of group Group_PSI_v1)
+*/
+
+#endif /* HAVE_PSI_1 */
 
 #ifdef USE_PSI_2
 #define HAVE_PSI_2
 #endif
 
 #ifdef HAVE_PSI_2
+
+/**
+  @defgroup Group_PSI_v2 Application Programming Interface, version 2
+  @ingroup Performance_schema_interface
+  @{
+*/
+
 /**
-  Performance Schema Application Binary Interface, version 2.
+  Performance Schema Interface, version 2.
+  This is a placeholder, this interface is not defined yet.
+  @since PSI_VERSION_2
 */
 struct PSI_v2
 {
@@ -145,22 +499,50 @@ struct PSI_v2
   /* ... extended interface ... */
 };
 
+/** Placeholder */
 struct PSI_mutex_info_v2
 {
   int placeholder;
 };
 
+/** Placeholder */
 struct PSI_rwlock_info_v2
 {
   int placeholder;
 };
 
+/** Placeholder */
 struct PSI_cond_info_v2
 {
   int placeholder;
 };
 
-#endif
+/**
+  @} (end of group Group_PSI_v2)
+*/
+
+#endif /* HAVE_PSI_2 */
+
+/**
+  \typedef PSI
+  The instrumentation interface for the current version.
+  @sa PSI_CURRENT_VERSION
+*/
+
+/**
+  \typedef PSI_mutex_info
+  The mutex information structure for the current version.
+*/
+
+/**
+  \typedef PSI_rwlock_info
+  The rwlock information structure for the current version.
+*/
+
+/**
+  \typedef PSI_cond_info
+  The cond information structure for the current version.
+*/
 
 /* Export the required version */
 #ifdef USE_PSI_1
@@ -177,5 +559,9 @@ typedef struct PSI_rwlock_info_v2 PSI_rw
 typedef struct PSI_cond_info_v2 PSI_cond_info;
 #endif
 
+/**
+  @} (end of group Performance_schema_interface)
+*/
+
 #endif
 

=== modified file 'storage/maria/ma_static.c'
--- a/storage/maria/ma_static.c	2008-10-30 04:49:42 +0000
+++ b/storage/maria/ma_static.c	2008-10-31 02:26:32 +0000
@@ -187,11 +187,11 @@ PSI_cond_key key_translog_descriptor_log
 static PSI_cond_info all_maria_conds[]=
 {
   { & key_MARIA_SHARE_intern_cond,
-    "MARIA_SHARE::intern_cond", PSI_FLAG_GLOBAL},
+    "MARIA_SHARE::intern_cond", 0},
   { & key_MARIA_FILE_BITMAP_bitmap_cond,
-    "MARIA_FILE_BITMAP::bitmap_cond", PSI_FLAG_GLOBAL},
+    "MARIA_FILE_BITMAP::bitmap_cond", 0},
   { & key_MARIA_SORT_INFO_cond,
-    "MARIA_SORT_INFO::cond", PSI_FLAG_GLOBAL},
+    "MARIA_SORT_INFO::cond", 0},
   { & key_COND_checkpoint,
     "COND_checkpoint", PSI_FLAG_GLOBAL},
   { & key_translog_buffer_waiting_filling_buffer,

=== modified file 'storage/perfschema/psm_column_types.h'
--- a/storage/perfschema/psm_column_types.h	2008-10-30 04:49:42 +0000
+++ b/storage/perfschema/psm_column_types.h	2008-10-31 02:26:32 +0000
@@ -38,13 +38,11 @@ enum enum_timer_name
   - performance_schema.setup_instruments (ENABLED)
   - performance_schema.setup_instruments (TIMED)
   - performance_schema.setup_consumers (ENABLED)
-  @note 'YES' is the first value listed in the SQL enum,
-  and therefore is stored as 0, while 'NO' is stored as 1.
 */
 enum enum_yes_no
 {
-  ENUM_YES= 0,
-  ENUM_NO= 1
+  ENUM_YES= 1,
+  ENUM_NO= 2
 };
 
 /**

=== modified file 'storage/perfschema/table_setup_instruments.cc'
--- a/storage/perfschema/table_setup_instruments.cc	2008-10-30 04:49:42 +0000
+++ b/storage/perfschema/table_setup_instruments.cc	2008-10-31 02:26:32 +0000
@@ -66,7 +66,7 @@ int pse_scan_setup_instruments::read_row
     name_ptr+= info->m_name_length;
     row.m_name_length= name_ptr - row.m_name;
     row.m_enabled= false;
-    row.m_timed= false;
+    row.m_timed= true;
     result= read_row_values(table, buf, fields, & row);
   }
   else
@@ -101,19 +101,19 @@ int pse_scan_setup_instruments::read_row
       switch(f->field_index)
       {
       case 0:
-        DBUG_ASSERT(f->type() == MYSQL_TYPE_VARCHAR);
+        DBUG_ASSERT(f->real_type() == MYSQL_TYPE_VARCHAR);
         col_name= (Field_varstring*) f;
         col_name->store(row->m_name, row->m_name_length, cs);
         break;
       case 1:
-        DBUG_ASSERT(f->type() == MYSQL_TYPE_STRING);
+        DBUG_ASSERT(f->real_type() == MYSQL_TYPE_ENUM);
         col_enabled= (Field_enum*) f;
         col_enabled->store_type(row->m_enabled ? ENUM_YES : ENUM_NO);
         break;
       case 2:
-        DBUG_ASSERT(f->type() == MYSQL_TYPE_STRING);
+        DBUG_ASSERT(f->real_type() == MYSQL_TYPE_ENUM);
         col_timed= (Field_enum*) f;
-        col_timed->store_type(row->m_enabled ? ENUM_YES : ENUM_NO);
+        col_timed->store_type(row->m_timed ? ENUM_YES : ENUM_NO);
         break;
       default:
         DBUG_ASSERT(false);

Thread
bzr commit into mysql-6.0-perf branch (marc.alff:2722) Marc Alff31 Oct