List:Commits« Previous MessageNext Message »
From:Marc Alff Date:April 19 2011 3:29am
Subject:bzr commit into mysql-trunk branch (marc.alff:3325) Bug#12346211
View as plain text  
#At file:///Users/malff/BZR_TREE/mysql-trunk-bug12346211/ based on revid:alexander.nozdrin@stripped

 3325 Marc Alff	2011-04-18
      Bug#12346211 PERF IMPACT OF PERFORMANCE-SCHEMA WITH DISABLED INSTRUMENTS/CONSUMERS
      
      Not a fix.
      
      Instrumentation patch, to help investigations.
      
      The code can now be compiled with the added #defines:
      DISABLE_PSI_MUTEX
      DISABLE_PSI_RWLOCK
      DISABLE_PSI_COND
      DISABLE_PSI_FILE
      DISABLE_PSI_TABLE
      DISABLE_PSI_STAGE
      DISABLE_PSI_STATEMENT
      
      to avoid building with a given instrumentation.
      
      For example,
      to disable mutexes, add -DDISABLE_PSI_MUTEX to CFLAGS.

    modified:
      include/mysql/psi/mysql_file.h
      include/mysql/psi/mysql_stage.h
      include/mysql/psi/mysql_statement.h
      include/mysql/psi/mysql_table.h
      include/mysql/psi/mysql_thread.h
      include/mysql/psi/psi.h
      mysys/my_init.c
      plugin/semisync/semisync_master_plugin.cc
      sql/debug_sync.cc
      sql/events.cc
      sql/ha_ndbcluster.cc
      sql/handler.cc
      sql/item_func.cc
      sql/mdl.cc
      sql/mysqld.cc
      sql/rpl_master.cc
      sql/rpl_slave.cc
      sql/sp_cache.cc
      sql/sql_acl.cc
      sql/sql_audit.cc
      sql/sql_base.cc
      sql/sql_class.cc
      sql/sql_db.cc
      sql/sql_parse.cc
      sql/sql_plugin.cc
      sql/sql_servers.cc
      sql/sql_udf.cc
      sql/table.cc
      sql/tztime.cc
      storage/archive/ha_archive.cc
      storage/blackhole/ha_blackhole.cc
      storage/csv/ha_tina.cc
      storage/example/ha_example.cc
      storage/federated/ha_federated.cc
      storage/heap/hp_static.c
      storage/innobase/handler/ha_innodb.cc
      storage/myisam/mi_static.c
      storage/myisammrg/myrg_static.c
=== modified file 'include/mysql/psi/mysql_file.h'
--- a/include/mysql/psi/mysql_file.h	2010-12-21 15:27:40 +0000
+++ b/include/mysql/psi/mysql_file.h	2011-04-19 03:29:06 +0000
@@ -50,11 +50,18 @@
 */
 
 /**
+  @def mysql_file_register(P1, P2, P3)
+  File registration.
+*/
+#define mysql_file_register(P1, P2, P3) \
+  inline_mysql_file_register(P1, P2, P3)
+
+/**
   @def mysql_file_fgets(P1, P2, F)
   Instrumented fgets.
   @c mysql_file_fgets is a replacement for @c fgets.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_fgets(P1, P2, F) \
     inline_mysql_file_fgets(__FILE__, __LINE__, P1, P2, F)
 #else
@@ -67,7 +74,7 @@
   Instrumented fgetc.
   @c mysql_file_fgetc is a replacement for @c fgetc.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_fgetc(F) inline_mysql_file_fgetc(__FILE__, __LINE__, F)
 #else
   #define mysql_file_fgetc(F) inline_mysql_file_fgetc(F)
@@ -78,7 +85,7 @@
   Instrumented fputs.
   @c mysql_file_fputs is a replacement for @c fputs.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_fputs(P1, F) \
     inline_mysql_file_fputs(__FILE__, __LINE__, P1, F)
 #else
@@ -91,7 +98,7 @@
   Instrumented fputc.
   @c mysql_file_fputc is a replacement for @c fputc.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_fputc(P1, F) \
     inline_mysql_file_fputc(__FILE__, __LINE__, P1, F)
 #else
@@ -111,7 +118,7 @@
   Instrumented vfprintf.
   @c mysql_file_vfprintf is a replacement for @c vfprintf.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_vfprintf(F, P1, P2) \
     inline_mysql_file_vfprintf(__FILE__, __LINE__, F, P1, P2)
 #else
@@ -124,7 +131,7 @@
   Instrumented fflush.
   @c mysql_file_fflush is a replacement for @c fflush.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_fflush(F) \
     inline_mysql_file_fflush(__FILE__, __LINE__, F)
 #else
@@ -144,7 +151,7 @@
   Instrumented fstat.
   @c mysql_file_fstat is a replacement for @c my_fstat.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_fstat(FN, S, FL) \
     inline_mysql_file_fstat(__FILE__, __LINE__, FN, S, FL)
 #else
@@ -157,7 +164,7 @@
   Instrumented stat.
   @c mysql_file_stat is a replacement for @c my_stat.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_stat(K, FN, S, FL) \
     inline_mysql_file_stat(K, __FILE__, __LINE__, FN, S, FL)
 #else
@@ -170,7 +177,7 @@
   Instrumented chsize.
   @c mysql_file_chsize is a replacement for @c my_chsize.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_chsize(F, P1, P2, P3) \
     inline_mysql_file_chsize(__FILE__, __LINE__, F, P1, P2, P3)
 #else
@@ -183,7 +190,7 @@
   Instrumented fopen.
   @c mysql_file_fopen is a replacement for @c my_fopen.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_fopen(K, N, F1, F2) \
     inline_mysql_file_fopen(K, __FILE__, __LINE__, N, F1, F2)
 #else
@@ -203,7 +210,7 @@
   @code DBUG_ASSERT(file != NULL) @endcode,
   since doing so could introduce regressions.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_fclose(FD, FL) \
     inline_mysql_file_fclose(__FILE__, __LINE__, FD, FL)
 #else
@@ -216,7 +223,7 @@
   Instrumented fread.
   @c mysql_file_fread is a replacement for @c my_fread.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_fread(FD, P1, P2, P3) \
     inline_mysql_file_fread(__FILE__, __LINE__, FD, P1, P2, P3)
 #else
@@ -229,7 +236,7 @@
   Instrumented fwrite.
   @c mysql_file_fwrite is a replacement for @c my_fwrite.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_fwrite(FD, P1, P2, P3) \
     inline_mysql_file_fwrite(__FILE__, __LINE__, FD, P1, P2, P3)
 #else
@@ -242,7 +249,7 @@
   Instrumented fseek.
   @c mysql_file_fseek is a replacement for @c my_fseek.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_fseek(FD, P, W, F) \
     inline_mysql_file_fseek(__FILE__, __LINE__, FD, P, W, F)
 #else
@@ -255,7 +262,7 @@
   Instrumented ftell.
   @c mysql_file_ftell is a replacement for @c my_ftell.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_ftell(FD, F) \
     inline_mysql_file_ftell(__FILE__, __LINE__, FD, F)
 #else
@@ -268,7 +275,7 @@
   Instrumented create.
   @c mysql_file_create is a replacement for @c my_create.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_create(K, N, F1, F2, F3) \
   inline_mysql_file_create(K, __FILE__, __LINE__, N, F1, F2, F3)
 #else
@@ -281,7 +288,7 @@
   Instrumented create_temp_file.
   @c mysql_file_create_temp is a replacement for @c create_temp_file.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_create_temp(K, T, D, P, M, F) \
     inline_mysql_file_create_temp(K, T, D, P, M, F)
 #else
@@ -294,7 +301,7 @@
   Instrumented open.
   @c mysql_file_open is a replacement for @c my_open.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_open(K, N, F1, F2) \
     inline_mysql_file_open(K, __FILE__, __LINE__, N, F1, F2)
 #else
@@ -307,7 +314,7 @@
   Instrumented close.
   @c mysql_file_close is a replacement for @c my_close.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_close(FD, F) \
     inline_mysql_file_close(__FILE__, __LINE__, FD, F)
 #else
@@ -320,7 +327,7 @@
   Instrumented read.
   @c mysql_read is a replacement for @c my_read.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_read(FD, B, S, F) \
     inline_mysql_file_read(__FILE__, __LINE__, FD, B, S, F)
 #else
@@ -333,7 +340,7 @@
   Instrumented write.
   @c mysql_file_write is a replacement for @c my_write.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_write(FD, B, S, F) \
     inline_mysql_file_write(__FILE__, __LINE__, FD, B, S, F)
 #else
@@ -346,7 +353,7 @@
   Instrumented pread.
   @c mysql_pread is a replacement for @c my_pread.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_pread(FD, B, S, O, F) \
     inline_mysql_file_pread(__FILE__, __LINE__, FD, B, S, O, F)
 #else
@@ -359,7 +366,7 @@
   Instrumented pwrite.
   @c mysql_file_pwrite is a replacement for @c my_pwrite.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_pwrite(FD, B, S, O, F) \
     inline_mysql_file_pwrite(__FILE__, __LINE__, FD, B, S, O, F)
 #else
@@ -372,7 +379,7 @@
   Instrumented seek.
   @c mysql_file_seek is a replacement for @c my_seek.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_seek(FD, P, W, F) \
     inline_mysql_file_seek(__FILE__, __LINE__, FD, P, W, F)
 #else
@@ -385,7 +392,7 @@
   Instrumented tell.
   @c mysql_file_tell is a replacement for @c my_tell.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_tell(FD, F) \
     inline_mysql_file_tell(__FILE__, __LINE__, FD, F)
 #else
@@ -398,7 +405,7 @@
   Instrumented delete.
   @c mysql_file_delete is a replacement for @c my_delete.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_delete(K, P1, P2) \
     inline_mysql_file_delete(K, __FILE__, __LINE__, P1, P2)
 #else
@@ -411,7 +418,7 @@
   Instrumented rename.
   @c mysql_file_rename is a replacement for @c my_rename.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_rename(K, P1, P2, P3) \
     inline_mysql_file_rename(K, __FILE__, __LINE__, P1, P2, P3)
 #else
@@ -425,7 +432,7 @@
   @c mysql_file_create_with_symlink is a replacement
   for @c my_create_with_symlink.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_create_with_symlink(K, P1, P2, P3, P4, P5) \
   inline_mysql_file_create_with_symlink(K, __FILE__, __LINE__, \
                                         P1, P2, P3, P4, P5)
@@ -440,7 +447,7 @@
   @c mysql_file_delete_with_symlink is a replacement
   for @c my_delete_with_symlink.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_delete_with_symlink(K, P1, P2) \
   inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2)
 #else
@@ -454,7 +461,7 @@
   @c mysql_file_rename_with_symlink is a replacement
   for @c my_rename_with_symlink.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_rename_with_symlink(K, P1, P2, P3) \
   inline_mysql_file_rename_with_symlink(K, __FILE__, __LINE__, P1, P2, P3)
 #else
@@ -467,7 +474,7 @@
   Instrumented file sync.
   @c mysql_file_sync is a replacement for @c my_sync.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   #define mysql_file_sync(P1, P2) \
     inline_mysql_file_sync(__FILE__, __LINE__, P1, P2)
 #else
@@ -498,15 +505,33 @@ struct st_mysql_file
 */
 typedef struct st_mysql_file MYSQL_FILE;
 
+static inline void inline_mysql_file_register(
+#ifdef HAVE_PSI_FILE_INTERFACE
+  const char *category,
+  PSI_file_info *info,
+  int count
+#else
+  const char *category __attribute__ ((unused)),
+  PSI_file_info *info __attribute__ ((unused)),
+  int count __attribute__ ((unused))
+#endif
+)
+{
+#ifdef HAVE_PSI_FILE_INTERFACE
+  if (likely(PSI_server != NULL))
+    PSI_server->register_file(category, info, count);
+#endif
+}
+
 static inline char *
 inline_mysql_file_fgets(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   char *str, int size, MYSQL_FILE *file)
 {
   char *result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server && file->m_psi))
@@ -518,7 +543,7 @@ inline_mysql_file_fgets(
   }
 #endif
   result= fgets(str, size, file->m_file);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, result ? strlen(result) : 0);
 #endif
@@ -527,13 +552,13 @@ inline_mysql_file_fgets(
 
 static inline int
 inline_mysql_file_fgetc(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   MYSQL_FILE *file)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server && file->m_psi))
@@ -545,7 +570,7 @@ inline_mysql_file_fgetc(
   }
 #endif
   result= fgetc(file->m_file);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) 1);
 #endif
@@ -554,13 +579,13 @@ inline_mysql_file_fgetc(
 
 static inline int
 inline_mysql_file_fputs(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   const char *str, MYSQL_FILE *file)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   size_t bytes= 0;
@@ -576,7 +601,7 @@ inline_mysql_file_fputs(
   }
 #endif
   result= fputs(str, file->m_file);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, bytes);
 #endif
@@ -585,13 +610,13 @@ inline_mysql_file_fputs(
 
 static inline int
 inline_mysql_file_fputc(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   char c, MYSQL_FILE *file)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server && file->m_psi))
@@ -603,7 +628,7 @@ inline_mysql_file_fputc(
   }
 #endif
   result= fputc(c, file->m_file);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) 1);
 #endif
@@ -618,7 +643,7 @@ inline_mysql_file_fprintf(MYSQL_FILE *fi
   */
   int result;
   va_list args;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server && file->m_psi))
@@ -632,7 +657,7 @@ inline_mysql_file_fprintf(MYSQL_FILE *fi
   va_start(args, format);
   result= vfprintf(file->m_file, format, args);
   va_end(args);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) result);
 #endif
@@ -641,13 +666,13 @@ inline_mysql_file_fprintf(MYSQL_FILE *fi
 
 static inline int
 inline_mysql_file_vfprintf(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   MYSQL_FILE *file, const char *format, va_list args)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server && file->m_psi))
@@ -659,7 +684,7 @@ inline_mysql_file_vfprintf(
   }
 #endif
   result= vfprintf(file->m_file, format, args);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) result);
 #endif
@@ -668,13 +693,13 @@ inline_mysql_file_vfprintf(
 
 static inline int
 inline_mysql_file_fflush(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   MYSQL_FILE *file)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server && file->m_psi))
@@ -686,7 +711,7 @@ inline_mysql_file_fflush(
   }
 #endif
   result= fflush(file->m_file);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) 0);
 #endif
@@ -701,13 +726,13 @@ static inline int inline_mysql_file_feof
 
 static inline int
 inline_mysql_file_fstat(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   int filenr, MY_STAT *stat_area, myf flags)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -719,7 +744,7 @@ inline_mysql_file_fstat(
   }
 #endif
   result= my_fstat(filenr, stat_area, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) 0);
 #endif
@@ -728,13 +753,13 @@ inline_mysql_file_fstat(
 
 static inline MY_STAT *
 inline_mysql_file_stat(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   PSI_file_key key, const char *src_file, uint src_line,
 #endif
   const char *path, MY_STAT *stat_area, myf flags)
 {
   MY_STAT *result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -747,7 +772,7 @@ inline_mysql_file_stat(
   }
 #endif
   result= my_stat(path, stat_area, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) 0);
 #endif
@@ -756,13 +781,13 @@ inline_mysql_file_stat(
 
 static inline int
 inline_mysql_file_chsize(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   File file, my_off_t newlength, int filler, myf flags)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -775,7 +800,7 @@ inline_mysql_file_chsize(
   }
 #endif
   result= my_chsize(file, newlength, filler, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) newlength);
 #endif
@@ -784,7 +809,7 @@ inline_mysql_file_chsize(
 
 static inline MYSQL_FILE*
 inline_mysql_file_fopen(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   PSI_file_key key, const char *src_file, uint src_line,
 #endif
   const char *filename, int flags, myf myFlags)
@@ -795,7 +820,7 @@ inline_mysql_file_fopen(
   {
     that->m_psi= NULL;
     {
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
       struct PSI_file_locker *locker= NULL;
       PSI_file_locker_state state;
       if (likely(PSI_server != NULL))
@@ -808,7 +833,7 @@ inline_mysql_file_fopen(
       }
 #endif
       that->m_file= my_fopen(filename, flags, myFlags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
       if (likely(locker != NULL))
         PSI_server->end_file_open_wait(locker);
 #endif
@@ -824,7 +849,7 @@ inline_mysql_file_fopen(
 
 static inline int
 inline_mysql_file_fclose(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   MYSQL_FILE *file, myf flags)
@@ -832,7 +857,7 @@ inline_mysql_file_fclose(
   int result= 0;
   if (likely(file != NULL))
   {
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
     struct PSI_file_locker *locker= NULL;
     PSI_file_locker_state state;
     DBUG_ASSERT(file != NULL);
@@ -845,7 +870,7 @@ inline_mysql_file_fclose(
     }
 #endif
     result= my_fclose(file->m_file, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
     if (likely(locker != NULL))
       PSI_server->end_file_wait(locker, (size_t) 0);
 #endif
@@ -856,13 +881,13 @@ inline_mysql_file_fclose(
 
 static inline size_t
 inline_mysql_file_fread(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   MYSQL_FILE *file, uchar *buffer, size_t count, myf flags)
 {
   size_t result= 0;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server && file->m_psi))
@@ -874,7 +899,7 @@ inline_mysql_file_fread(
   }
 #endif
   result= my_fread(file->m_file, buffer, count, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
   {
     size_t bytes_read;
@@ -890,13 +915,13 @@ inline_mysql_file_fread(
 
 static inline size_t
 inline_mysql_file_fwrite(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   MYSQL_FILE *file, const uchar *buffer, size_t count, myf flags)
 {
   size_t result= 0;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server && file->m_psi))
@@ -908,7 +933,7 @@ inline_mysql_file_fwrite(
   }
 #endif
   result= my_fwrite(file->m_file, buffer, count, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
   {
     size_t bytes_written;
@@ -924,13 +949,13 @@ inline_mysql_file_fwrite(
 
 static inline my_off_t
 inline_mysql_file_fseek(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   MYSQL_FILE *file, my_off_t pos, int whence, myf flags)
 {
   my_off_t result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server && file->m_psi))
@@ -942,7 +967,7 @@ inline_mysql_file_fseek(
   }
 #endif
   result= my_fseek(file->m_file, pos, whence, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) 0);
 #endif
@@ -951,13 +976,13 @@ inline_mysql_file_fseek(
 
 static inline my_off_t
 inline_mysql_file_ftell(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   MYSQL_FILE *file, myf flags)
 {
   my_off_t result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server && file->m_psi))
@@ -969,7 +994,7 @@ inline_mysql_file_ftell(
   }
 #endif
   result= my_ftell(file->m_file, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) 0);
 #endif
@@ -978,13 +1003,13 @@ inline_mysql_file_ftell(
 
 static inline File
 inline_mysql_file_create(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   PSI_file_key key, const char *src_file, uint src_line,
 #endif
   const char *filename, int create_flags, int access_flags, myf myFlags)
 {
   File file;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -996,7 +1021,7 @@ inline_mysql_file_create(
   }
 #endif
   file= my_create(filename, create_flags, access_flags, myFlags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file);
 #endif
@@ -1005,7 +1030,7 @@ inline_mysql_file_create(
 
 static inline File
 inline_mysql_file_create_temp(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   PSI_file_key key,
 #endif
   char *to, const char *dir, const char *pfx, int mode, myf myFlags)
@@ -1017,7 +1042,7 @@ inline_mysql_file_create_temp(
     before the create_temp_file call.
   */
   file= create_temp_file(to, dir, pfx, mode, myFlags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(PSI_server != NULL))
     PSI_server->create_file(key, to, file);
 #endif
@@ -1026,13 +1051,13 @@ inline_mysql_file_create_temp(
 
 static inline File
 inline_mysql_file_open(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   PSI_file_key key, const char *src_file, uint src_line,
 #endif
   const char *filename, int flags, myf myFlags)
 {
   File file;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -1044,7 +1069,7 @@ inline_mysql_file_open(
   }
 #endif
   file= my_open(filename, flags, myFlags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file);
 #endif
@@ -1053,13 +1078,13 @@ inline_mysql_file_open(
 
 static inline int
 inline_mysql_file_close(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   File file, myf flags)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -1071,7 +1096,7 @@ inline_mysql_file_close(
   }
 #endif
   result= my_close(file, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) 0);
 #endif
@@ -1080,13 +1105,13 @@ inline_mysql_file_close(
 
 static inline size_t
 inline_mysql_file_read(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   File file, uchar *buffer, size_t count, myf flags)
 {
   size_t result= 0;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -1098,7 +1123,7 @@ inline_mysql_file_read(
   }
 #endif
   result= my_read(file, buffer, count, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
   {
     size_t bytes_read;
@@ -1114,13 +1139,13 @@ inline_mysql_file_read(
 
 static inline size_t
 inline_mysql_file_write(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   File file, const uchar *buffer, size_t count, myf flags)
 {
   size_t result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -1132,7 +1157,7 @@ inline_mysql_file_write(
   }
 #endif
   result= my_write(file, buffer, count, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
   {
     size_t bytes_written;
@@ -1148,13 +1173,13 @@ inline_mysql_file_write(
 
 static inline size_t
 inline_mysql_file_pread(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   File file, uchar *buffer, size_t count, my_off_t offset, myf flags)
 {
   size_t result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -1165,7 +1190,7 @@ inline_mysql_file_pread(
   }
 #endif
   result= my_pread(file, buffer, count, offset, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
   {
     size_t bytes_read;
@@ -1181,13 +1206,13 @@ inline_mysql_file_pread(
 
 static inline size_t
 inline_mysql_file_pwrite(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   File file, const uchar *buffer, size_t count, my_off_t offset, myf flags)
 {
   size_t result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -1199,7 +1224,7 @@ inline_mysql_file_pwrite(
   }
 #endif
   result= my_pwrite(file, buffer, count, offset, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
   {
     size_t bytes_written;
@@ -1215,13 +1240,13 @@ inline_mysql_file_pwrite(
 
 static inline my_off_t
 inline_mysql_file_seek(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   File file, my_off_t pos, int whence, myf flags)
 {
   my_off_t result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -1232,7 +1257,7 @@ inline_mysql_file_seek(
   }
 #endif
   result= my_seek(file, pos, whence, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) 0);
 #endif
@@ -1241,13 +1266,13 @@ inline_mysql_file_seek(
 
 static inline my_off_t
 inline_mysql_file_tell(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   File file, myf flags)
 {
   my_off_t result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -1258,7 +1283,7 @@ inline_mysql_file_tell(
   }
 #endif
   result= my_tell(file, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) 0);
 #endif
@@ -1267,13 +1292,13 @@ inline_mysql_file_tell(
 
 static inline int
 inline_mysql_file_delete(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   PSI_file_key key, const char *src_file, uint src_line,
 #endif
   const char *name, myf flags)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -1285,7 +1310,7 @@ inline_mysql_file_delete(
   }
 #endif
   result= my_delete(name, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) 0);
 #endif
@@ -1294,13 +1319,13 @@ inline_mysql_file_delete(
 
 static inline int
 inline_mysql_file_rename(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   PSI_file_key key, const char *src_file, uint src_line,
 #endif
   const char *from, const char *to, myf flags)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -1312,7 +1337,7 @@ inline_mysql_file_rename(
   }
 #endif
   result= my_rename(from, to, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) 0);
 #endif
@@ -1321,14 +1346,14 @@ inline_mysql_file_rename(
 
 static inline File
 inline_mysql_file_create_with_symlink(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   PSI_file_key key, const char *src_file, uint src_line,
 #endif
   const char *linkname, const char *filename, int create_flags,
   int access_flags, myf flags)
 {
   File file;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -1341,7 +1366,7 @@ inline_mysql_file_create_with_symlink(
 #endif
   file= my_create_with_symlink(linkname, filename, create_flags, access_flags,
                                flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_open_wait_and_bind_to_descriptor(locker, file);
 #endif
@@ -1350,13 +1375,13 @@ inline_mysql_file_create_with_symlink(
 
 static inline int
 inline_mysql_file_delete_with_symlink(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   PSI_file_key key, const char *src_file, uint src_line,
 #endif
   const char *name, myf flags)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -1368,7 +1393,7 @@ inline_mysql_file_delete_with_symlink(
   }
 #endif
   result= my_delete_with_symlink(name, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) 0);
 #endif
@@ -1377,13 +1402,13 @@ inline_mysql_file_delete_with_symlink(
 
 static inline int
 inline_mysql_file_rename_with_symlink(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   PSI_file_key key, const char *src_file, uint src_line,
 #endif
   const char *from, const char *to, myf flags)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -1395,7 +1420,7 @@ inline_mysql_file_rename_with_symlink(
   }
 #endif
   result= my_rename_with_symlink(from, to, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) 0);
 #endif
@@ -1404,13 +1429,13 @@ inline_mysql_file_rename_with_symlink(
 
 static inline int
 inline_mysql_file_sync(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   const char *src_file, uint src_line,
 #endif
   File fd, myf flags)
 {
   int result= 0;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker= NULL;
   PSI_file_locker_state state;
   if (likely(PSI_server != NULL))
@@ -1421,7 +1446,7 @@ inline_mysql_file_sync(
   }
 #endif
   result= my_sync(fd, flags);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_FILE_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_file_wait(locker, (size_t) 0);
 #endif

=== modified file 'include/mysql/psi/mysql_stage.h'
--- a/include/mysql/psi/mysql_stage.h	2011-02-14 14:23:55 +0000
+++ b/include/mysql/psi/mysql_stage.h	2011-04-19 03:29:06 +0000
@@ -29,7 +29,19 @@
   @{
 */
 
-#ifdef HAVE_PSI_INTERFACE
+/**
+  @def mysql_stage_register(P1, P2, P3)
+  Stage registration.
+*/
+#ifdef HAVE_PSI_STAGE_INTERFACE
+#define mysql_stage_register(P1, P2, P3) \
+  inline_mysql_stage_register(P1, P2, P3)
+#else
+#define mysql_stage_register(P1, P2, P3) \
+  do {} while (0)
+#endif
+
+#ifdef HAVE_PSI_STAGE_INTERFACE
   #define MYSQL_SET_STAGE(K, F, L) \
     inline_mysql_set_stage(K, F, L)
 #else
@@ -37,7 +49,16 @@
     do {} while (0)
 #endif
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STAGE_INTERFACE
+static inline void inline_mysql_stage_register(
+  const char *category, PSI_stage_info **info, int count)
+{
+  if (likely(PSI_server != NULL))
+    PSI_server->register_stage(category, info, count);
+}
+#endif
+
+#ifdef HAVE_PSI_STAGE_INTERFACE
 static inline void
 inline_mysql_set_stage(PSI_stage_key key,
                        const char *src_file, int src_line)

=== modified file 'include/mysql/psi/mysql_statement.h'
--- a/include/mysql/psi/mysql_statement.h	2011-02-14 14:23:55 +0000
+++ b/include/mysql/psi/mysql_statement.h	2011-04-19 03:29:06 +0000
@@ -29,7 +29,19 @@
   @{
 */
 
-#ifdef HAVE_PSI_INTERFACE
+/**
+  @def mysql_statement_register(P1, P2, P3)
+  Statement registration.
+*/
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+#define mysql_statement_register(P1, P2, P3) \
+  inline_mysql_statement_register(P1, P2, P3)
+#else
+#define mysql_statement_register(P1, P2, P3) \
+  do {} while (0)
+#endif
+
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
   #define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN) \
     inline_mysql_start_statement(STATE, K, DB, DB_LEN, __FILE__, __LINE__)
 #else
@@ -37,7 +49,7 @@
     NULL
 #endif
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
   #define MYSQL_REFINE_STATEMENT(LOCKER, K) \
     inline_mysql_refine_statement(LOCKER, K)
 #else
@@ -45,7 +57,7 @@
     NULL
 #endif
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
   #define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \
     inline_mysql_set_statement_text(LOCKER, P1, P2)
 #else
@@ -53,7 +65,7 @@
     do {} while (0)
 #endif
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
   #define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \
     inline_mysql_set_statement_lock_time(LOCKER, P1)
 #else
@@ -61,7 +73,7 @@
     do {} while (0)
 #endif
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
   #define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \
     inline_mysql_set_statement_rows_sent(LOCKER, P1)
 #else
@@ -69,7 +81,7 @@
     do {} while (0)
 #endif
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
   #define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \
     inline_mysql_set_statement_rows_examined(LOCKER, P1)
 #else
@@ -77,7 +89,7 @@
     do {} while (0)
 #endif
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
   #define MYSQL_END_STATEMENT(LOCKER, DA) \
     inline_mysql_end_statement(LOCKER, DA)
 #else
@@ -85,7 +97,14 @@
     do {} while (0)
 #endif
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+static inline void inline_mysql_statement_register(
+  const char *category, PSI_statement_info *info, int count)
+{
+  if (likely(PSI_server != NULL))
+    PSI_server->register_statement(category, info, count);
+}
+
 static inline struct PSI_statement_locker *
 inline_mysql_start_statement(PSI_statement_locker_state *state,
                              PSI_statement_key key,

=== modified file 'include/mysql/psi/mysql_table.h'
--- a/include/mysql/psi/mysql_table.h	2010-12-09 16:17:13 +0000
+++ b/include/mysql/psi/mysql_table.h	2011-04-19 03:29:06 +0000
@@ -41,7 +41,7 @@
   @sa MYSQL_START_TABLE_LOCK_WAIT.
   @sa MYSQL_END_TABLE_LOCK_WAIT.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
   #define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE) \
     struct PSI_table_locker* LOCKER; \
     PSI_table_locker_state STATE;
@@ -61,7 +61,7 @@
   @param FLAGS per table operation flags.
   @sa MYSQL_END_TABLE_WAIT.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
   #define MYSQL_START_TABLE_IO_WAIT(LOCKER, STATE, PSI, OP, INDEX, FLAGS) \
     LOCKER= inline_mysql_start_table_io_wait(STATE, PSI, \
                                              OP, INDEX, __FILE__, __LINE__)
@@ -77,7 +77,7 @@
   @param LOCKER the locker
   @sa MYSQL_START_TABLE_IO_WAIT.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
   #define MYSQL_END_TABLE_IO_WAIT(LOCKER) \
     inline_mysql_end_table_io_wait(LOCKER)
 #else
@@ -85,7 +85,7 @@
     do {} while (0)
 #endif
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
 /**
   Instrumentation calls for MYSQL_START_TABLE_IO_WAIT.
   @sa MYSQL_END_TABLE_IO_WAIT.
@@ -130,7 +130,7 @@ inline_mysql_end_table_io_wait(struct PS
   @param FLAGS per table operation flags.
   @sa MYSQL_END_TABLE_LOCK_WAIT.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
   #define MYSQL_START_TABLE_LOCK_WAIT(LOCKER, STATE, PSI, OP, FLAGS) \
     LOCKER= inline_mysql_start_table_lock_wait(STATE, PSI, \
                                                OP, FLAGS, __FILE__, __LINE__)
@@ -146,7 +146,7 @@ inline_mysql_end_table_io_wait(struct PS
   @param LOCKER the locker
   @sa MYSQL_START_TABLE_LOCK_WAIT.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
   #define MYSQL_END_TABLE_LOCK_WAIT(LOCKER) \
     inline_mysql_end_table_lock_wait(LOCKER)
 #else
@@ -154,7 +154,7 @@ inline_mysql_end_table_io_wait(struct PS
     do {} while (0)
 #endif
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
 /**
   Instrumentation calls for MYSQL_START_TABLE_LOCK_WAIT.
   @sa MYSQL_END_TABLE_LOCK_WAIT.

=== modified file 'include/mysql/psi/mysql_thread.h'
--- a/include/mysql/psi/mysql_thread.h	2010-10-01 10:23:16 +0000
+++ b/include/mysql/psi/mysql_thread.h	2011-04-19 03:29:06 +0000
@@ -222,6 +222,13 @@ typedef struct st_mysql_cond mysql_cond_
   rw_pr_lock_assert_not_write_owner(&(M)->m_prlock)
 
 /**
+  @def mysql_mutex_register(P1, P2, P3)
+  Mutex registration.
+*/
+#define mysql_mutex_register(P1, P2, P3) \
+  inline_mysql_mutex_register(P1, P2, P3)
+
+/**
   @def mysql_mutex_init(K, M, A)
   Instrumented mutex_init.
   @c mysql_mutex_init is a replacement for @c pthread_mutex_init.
@@ -230,7 +237,7 @@ typedef struct st_mysql_cond mysql_cond_
   @param A Mutex attributes
 */
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
   #ifdef SAFE_MUTEX
     #define mysql_mutex_init(K, M, A) \
       inline_mysql_mutex_init(K, M, A, __FILE__, __LINE__)
@@ -269,7 +276,7 @@ typedef struct st_mysql_cond mysql_cond_
   @param M The mutex to lock
 */
 
-#if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE)
+#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE)
   #define mysql_mutex_lock(M) \
     inline_mysql_mutex_lock(M, __FILE__, __LINE__)
 #else
@@ -284,7 +291,7 @@ typedef struct st_mysql_cond mysql_cond_
   for @c pthread_mutex_trylock.
 */
 
-#if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE)
+#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE)
   #define mysql_mutex_trylock(M) \
     inline_mysql_mutex_trylock(M, __FILE__, __LINE__)
 #else
@@ -306,6 +313,13 @@ typedef struct st_mysql_cond mysql_cond_
 #endif
 
 /**
+  @def mysql_rwlock_register(P1, P2, P3)
+  Rwlock registration.
+*/
+#define mysql_rwlock_register(P1, P2, P3) \
+  inline_mysql_rwlock_register(P1, P2, P3)
+
+/**
   @def mysql_rwlock_init(K, RW)
   Instrumented rwlock_init.
   @c mysql_rwlock_init is a replacement for @c pthread_rwlock_init.
@@ -313,7 +327,7 @@ typedef struct st_mysql_cond mysql_cond_
   @param K The PSI_rwlock_key for this instrumented rwlock
   @param RW The rwlock to initialize
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   #define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(K, RW)
 #else
   #define mysql_rwlock_init(K, RW) inline_mysql_rwlock_init(RW)
@@ -326,7 +340,7 @@ typedef struct st_mysql_cond mysql_cond_
   @param K The PSI_rwlock_key for this instrumented prlock
   @param RW The prlock to initialize
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   #define mysql_prlock_init(K, RW) inline_mysql_prlock_init(K, RW)
 #else
   #define mysql_prlock_init(K, RW) inline_mysql_prlock_init(RW)
@@ -354,7 +368,7 @@ typedef struct st_mysql_cond mysql_cond_
   @c mysql_rwlock_rdlock is a drop-in replacement
   for @c pthread_rwlock_rdlock.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   #define mysql_rwlock_rdlock(RW) \
     inline_mysql_rwlock_rdlock(RW, __FILE__, __LINE__)
 #else
@@ -368,7 +382,7 @@ typedef struct st_mysql_cond mysql_cond_
   @c mysql_prlock_rdlock is a drop-in replacement
   for @c rw_pr_rdlock.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   #define mysql_prlock_rdlock(RW) \
     inline_mysql_prlock_rdlock(RW, __FILE__, __LINE__)
 #else
@@ -382,7 +396,7 @@ typedef struct st_mysql_cond mysql_cond_
   @c mysql_rwlock_wrlock is a drop-in replacement
   for @c pthread_rwlock_wrlock.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   #define mysql_rwlock_wrlock(RW) \
     inline_mysql_rwlock_wrlock(RW, __FILE__, __LINE__)
 #else
@@ -396,7 +410,7 @@ typedef struct st_mysql_cond mysql_cond_
   @c mysql_prlock_wrlock is a drop-in replacement
   for @c rw_pr_wrlock.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   #define mysql_prlock_wrlock(RW) \
     inline_mysql_prlock_wrlock(RW, __FILE__, __LINE__)
 #else
@@ -410,7 +424,7 @@ typedef struct st_mysql_cond mysql_cond_
   @c mysql_rwlock_tryrdlock is a drop-in replacement
   for @c pthread_rwlock_tryrdlock.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   #define mysql_rwlock_tryrdlock(RW) \
     inline_mysql_rwlock_tryrdlock(RW, __FILE__, __LINE__)
 #else
@@ -424,7 +438,7 @@ typedef struct st_mysql_cond mysql_cond_
   @c mysql_rwlock_trywrlock is a drop-in replacement
   for @c pthread_rwlock_trywrlock.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   #define mysql_rwlock_trywrlock(RW) \
     inline_mysql_rwlock_trywrlock(RW, __FILE__, __LINE__)
 #else
@@ -449,6 +463,13 @@ typedef struct st_mysql_cond mysql_cond_
 #define mysql_prlock_unlock(RW) inline_mysql_prlock_unlock(RW)
 
 /**
+  @def mysql_cond_register(P1, P2, P3)
+  Cond registration.
+*/
+#define mysql_cond_register(P1, P2, P3) \
+  inline_mysql_cond_register(P1, P2, P3)
+
+/**
   @def mysql_cond_init(K, C, A)
   Instrumented cond_init.
   @c mysql_cond_init is a replacement for @c pthread_cond_init.
@@ -456,7 +477,7 @@ typedef struct st_mysql_cond mysql_cond_
   @param K The PSI_cond_key for this instrumented cond
   @param A Condition attributes
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
   #define mysql_cond_init(K, C, A) inline_mysql_cond_init(K, C, A)
 #else
   #define mysql_cond_init(K, C, A) inline_mysql_cond_init(C, A)
@@ -474,7 +495,7 @@ typedef struct st_mysql_cond mysql_cond_
   Instrumented cond_wait.
   @c mysql_cond_wait is a drop-in replacement for @c pthread_cond_wait.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
   #define mysql_cond_wait(C, M) \
     inline_mysql_cond_wait(C, M, __FILE__, __LINE__)
 #else
@@ -488,7 +509,7 @@ typedef struct st_mysql_cond mysql_cond_
   @c mysql_cond_timedwait is a drop-in replacement
   for @c pthread_cond_timedwait.
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
   #define mysql_cond_timedwait(C, M, W) \
     inline_mysql_cond_timedwait(C, M, W, __FILE__, __LINE__)
 #else
@@ -511,6 +532,12 @@ typedef struct st_mysql_cond mysql_cond_
 */
 #define mysql_cond_broadcast(C) inline_mysql_cond_broadcast(C)
 
+/**
+  @def mysql_thread_register(P1, P2, P3)
+  Thread registration.
+*/
+#define mysql_thread_register(P1, P2, P3) \
+  inline_mysql_thread_register(P1, P2, P3)
 
 /**
   @def mysql_thread_create(K, P1, P2, P3, P4)
@@ -529,7 +556,7 @@ typedef struct st_mysql_cond mysql_cond_
   @param P3 pthread_create parameter 3
   @param P4 pthread_create parameter 4
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_THREAD_INTERFACE
   #define mysql_thread_create(K, P1, P2, P3, P4) \
     inline_mysql_thread_create(K, P1, P2, P3, P4)
 #else
@@ -542,14 +569,32 @@ typedef struct st_mysql_cond mysql_cond_
   Set the thread indentifier for the instrumentation.
   @param I The thread identifier
 */
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_THREAD_INTERFACE
   #define mysql_thread_set_psi_id(I) inline_mysql_thread_set_psi_id(I)
 #else
   #define mysql_thread_set_psi_id(I) do {} while (0)
 #endif
 
+static inline void inline_mysql_mutex_register(
+#ifdef HAVE_PSI_MUTEX_INTERFACE
+  const char *category,
+  PSI_mutex_info *info,
+  int count
+#else
+  const char *category __attribute__ ((unused)),
+  PSI_mutex_info *info __attribute__ ((unused)),
+  int count __attribute__ ((unused))
+#endif
+)
+{
+#ifdef HAVE_PSI_MUTEX_INTERFACE
+  if (likely(PSI_server != NULL))
+    PSI_server->register_mutex(category, info, count);
+#endif
+}
+
 static inline int inline_mysql_mutex_init(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
   PSI_mutex_key key,
 #endif
   mysql_mutex_t *that,
@@ -559,7 +604,7 @@ static inline int inline_mysql_mutex_ini
 #endif
   )
 {
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
   that->m_psi= PSI_server ? PSI_server->init_mutex(key, &that->m_mutex)
                           : NULL;
 #else
@@ -579,7 +624,7 @@ static inline int inline_mysql_mutex_des
 #endif
   )
 {
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
   if (likely(PSI_server && that->m_psi))
   {
     PSI_server->destroy_mutex(that->m_psi);
@@ -595,13 +640,13 @@ static inline int inline_mysql_mutex_des
 
 static inline int inline_mysql_mutex_lock(
   mysql_mutex_t *that
-#if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE)
+#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE)
   , const char *src_file, uint src_line
 #endif
   )
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
   struct PSI_mutex_locker *locker= NULL;
   PSI_mutex_locker_state state;
   if (likely(PSI_server && that->m_psi))
@@ -616,7 +661,7 @@ static inline int inline_mysql_mutex_loc
 #else
   result= pthread_mutex_lock(&that->m_mutex);
 #endif
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_mutex_wait(locker, result);
 #endif
@@ -625,13 +670,13 @@ static inline int inline_mysql_mutex_loc
 
 static inline int inline_mysql_mutex_trylock(
   mysql_mutex_t *that
-#if defined(SAFE_MUTEX) || defined (HAVE_PSI_INTERFACE)
+#if defined(SAFE_MUTEX) || defined (HAVE_PSI_MUTEX_INTERFACE)
   , const char *src_file, uint src_line
 #endif
   )
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
   struct PSI_mutex_locker *locker= NULL;
   PSI_mutex_locker_state state;
   if (likely(PSI_server && that->m_psi))
@@ -646,7 +691,7 @@ static inline int inline_mysql_mutex_try
 #else
   result= pthread_mutex_trylock(&that->m_mutex);
 #endif
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_mutex_wait(locker, result);
 #endif
@@ -661,7 +706,7 @@ static inline int inline_mysql_mutex_unl
   )
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_MUTEX_INTERFACE
   if (likely(PSI_server && that->m_psi))
     PSI_server->unlock_mutex(that->m_psi);
 #endif
@@ -673,13 +718,31 @@ static inline int inline_mysql_mutex_unl
   return result;
 }
 
+static inline void inline_mysql_rwlock_register(
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+  const char *category,
+  PSI_rwlock_info *info,
+  int count
+#else
+  const char *category __attribute__ ((unused)),
+  PSI_rwlock_info *info __attribute__ ((unused)),
+  int count __attribute__ ((unused))
+#endif
+)
+{
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
+  if (likely(PSI_server != NULL))
+    PSI_server->register_rwlock(category, info, count);
+#endif
+}
+
 static inline int inline_mysql_rwlock_init(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   PSI_rwlock_key key,
 #endif
   mysql_rwlock_t *that)
 {
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   that->m_psi= (PSI_server ? PSI_server->init_rwlock(key, &that->m_rwlock)
                            : NULL);
 #else
@@ -693,12 +756,12 @@ static inline int inline_mysql_rwlock_in
 
 #ifndef DISABLE_MYSQL_PRLOCK_H
 static inline int inline_mysql_prlock_init(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   PSI_rwlock_key key,
 #endif
   mysql_prlock_t *that)
 {
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   that->m_psi= (PSI_server ? PSI_server->init_rwlock(key, &that->m_prlock)
                            : NULL);
 #else
@@ -711,7 +774,7 @@ static inline int inline_mysql_prlock_in
 static inline int inline_mysql_rwlock_destroy(
   mysql_rwlock_t *that)
 {
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   if (likely(PSI_server && that->m_psi))
   {
     PSI_server->destroy_rwlock(that->m_psi);
@@ -725,7 +788,7 @@ static inline int inline_mysql_rwlock_de
 static inline int inline_mysql_prlock_destroy(
   mysql_prlock_t *that)
 {
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   if (likely(PSI_server && that->m_psi))
   {
     PSI_server->destroy_rwlock(that->m_psi);
@@ -738,13 +801,13 @@ static inline int inline_mysql_prlock_de
 
 static inline int inline_mysql_rwlock_rdlock(
   mysql_rwlock_t *that
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   , const char *src_file, uint src_line
 #endif
   )
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   struct PSI_rwlock_locker *locker= NULL;
   PSI_rwlock_locker_state state;
   if (likely(PSI_server && that->m_psi))
@@ -756,7 +819,7 @@ static inline int inline_mysql_rwlock_rd
   }
 #endif
   result= rw_rdlock(&that->m_rwlock);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_rwlock_rdwait(locker, result);
 #endif
@@ -766,13 +829,13 @@ static inline int inline_mysql_rwlock_rd
 #ifndef DISABLE_MYSQL_PRLOCK_H
 static inline int inline_mysql_prlock_rdlock(
   mysql_prlock_t *that
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   , const char *src_file, uint src_line
 #endif
   )
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   struct PSI_rwlock_locker *locker= NULL;
   PSI_rwlock_locker_state state;
   if (likely(PSI_server && that->m_psi))
@@ -784,7 +847,7 @@ static inline int inline_mysql_prlock_rd
   }
 #endif
   result= rw_pr_rdlock(&that->m_prlock);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_rwlock_rdwait(locker, result);
 #endif
@@ -794,13 +857,13 @@ static inline int inline_mysql_prlock_rd
 
 static inline int inline_mysql_rwlock_wrlock(
   mysql_rwlock_t *that
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   , const char *src_file, uint src_line
 #endif
   )
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   struct PSI_rwlock_locker *locker= NULL;
   PSI_rwlock_locker_state state;
   if (likely(PSI_server && that->m_psi))
@@ -812,7 +875,7 @@ static inline int inline_mysql_rwlock_wr
   }
 #endif
   result= rw_wrlock(&that->m_rwlock);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_rwlock_wrwait(locker, result);
 #endif
@@ -822,13 +885,13 @@ static inline int inline_mysql_rwlock_wr
 #ifndef DISABLE_MYSQL_PRLOCK_H
 static inline int inline_mysql_prlock_wrlock(
   mysql_prlock_t *that
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   , const char *src_file, uint src_line
 #endif
   )
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   struct PSI_rwlock_locker *locker= NULL;
   PSI_rwlock_locker_state state;
   if (likely(PSI_server && that->m_psi))
@@ -840,7 +903,7 @@ static inline int inline_mysql_prlock_wr
   }
 #endif
   result= rw_pr_wrlock(&that->m_prlock);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_rwlock_wrwait(locker, result);
 #endif
@@ -850,13 +913,13 @@ static inline int inline_mysql_prlock_wr
 
 static inline int inline_mysql_rwlock_tryrdlock(
   mysql_rwlock_t *that
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   , const char *src_file, uint src_line
 #endif
   )
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   struct PSI_rwlock_locker *locker= NULL;
   PSI_rwlock_locker_state state;
   if (likely(PSI_server && that->m_psi))
@@ -868,7 +931,7 @@ static inline int inline_mysql_rwlock_tr
   }
 #endif
   result= rw_tryrdlock(&that->m_rwlock);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_rwlock_rdwait(locker, result);
 #endif
@@ -877,13 +940,13 @@ static inline int inline_mysql_rwlock_tr
 
 static inline int inline_mysql_rwlock_trywrlock(
   mysql_rwlock_t *that
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   , const char *src_file, uint src_line
 #endif
   )
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   struct PSI_rwlock_locker *locker= NULL;
   PSI_rwlock_locker_state state;
   if (likely(PSI_server && that->m_psi))
@@ -895,7 +958,7 @@ static inline int inline_mysql_rwlock_tr
   }
 #endif
   result= rw_trywrlock(&that->m_rwlock);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_rwlock_wrwait(locker, result);
 #endif
@@ -906,7 +969,7 @@ static inline int inline_mysql_rwlock_un
   mysql_rwlock_t *that)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   if (likely(PSI_server && that->m_psi))
     PSI_server->unlock_rwlock(that->m_psi);
 #endif
@@ -919,7 +982,7 @@ static inline int inline_mysql_prlock_un
   mysql_prlock_t *that)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_RWLOCK_INTERFACE
   if (likely(PSI_server && that->m_psi))
     PSI_server->unlock_rwlock(that->m_psi);
 #endif
@@ -928,14 +991,32 @@ static inline int inline_mysql_prlock_un
 }
 #endif
 
+static inline void inline_mysql_cond_register(
+#ifdef HAVE_PSI_COND_INTERFACE
+  const char *category,
+  PSI_cond_info *info,
+  int count
+#else
+  const char *category __attribute__ ((unused)),
+  PSI_cond_info *info __attribute__ ((unused)),
+  int count __attribute__ ((unused))
+#endif
+)
+{
+#ifdef HAVE_PSI_COND_INTERFACE
+  if (likely(PSI_server != NULL))
+    PSI_server->register_cond(category, info, count);
+#endif
+}
+
 static inline int inline_mysql_cond_init(
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
   PSI_cond_key key,
 #endif
   mysql_cond_t *that,
   const pthread_condattr_t *attr)
 {
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
   that->m_psi= (PSI_server ? PSI_server->init_cond(key, &that->m_cond)
                            : NULL);
 #else
@@ -947,7 +1028,7 @@ static inline int inline_mysql_cond_init
 static inline int inline_mysql_cond_destroy(
   mysql_cond_t *that)
 {
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
   if (likely(PSI_server && that->m_psi))
   {
     PSI_server->destroy_cond(that->m_psi);
@@ -960,13 +1041,13 @@ static inline int inline_mysql_cond_dest
 static inline int inline_mysql_cond_wait(
   mysql_cond_t *that,
   mysql_mutex_t *mutex
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
   , const char *src_file, uint src_line
 #endif
   )
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
   struct PSI_cond_locker *locker= NULL;
   PSI_cond_locker_state state;
   if (likely(PSI_server && that->m_psi))
@@ -978,7 +1059,7 @@ static inline int inline_mysql_cond_wait
   }
 #endif
   result= pthread_cond_wait(&that->m_cond, &mutex->m_mutex);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_cond_wait(locker, result);
 #endif
@@ -989,13 +1070,13 @@ static inline int inline_mysql_cond_time
   mysql_cond_t *that,
   mysql_mutex_t *mutex,
   struct timespec *abstime
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
   , const char *src_file, uint src_line
 #endif
   )
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
   struct PSI_cond_locker *locker= NULL;
   PSI_cond_locker_state state;
   if (likely(PSI_server && that->m_psi))
@@ -1007,7 +1088,7 @@ static inline int inline_mysql_cond_time
   }
 #endif
   result= pthread_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
   if (likely(locker != NULL))
     PSI_server->end_cond_wait(locker, result);
 #endif
@@ -1018,7 +1099,7 @@ static inline int inline_mysql_cond_sign
   mysql_cond_t *that)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
   if (likely(PSI_server && that->m_psi))
     PSI_server->signal_cond(that->m_psi);
 #endif
@@ -1030,7 +1111,7 @@ static inline int inline_mysql_cond_broa
   mysql_cond_t *that)
 {
   int result;
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_COND_INTERFACE
   if (likely(PSI_server && that->m_psi))
     PSI_server->broadcast_cond(that->m_psi);
 #endif
@@ -1038,7 +1119,25 @@ static inline int inline_mysql_cond_broa
   return result;
 }
 
-#ifdef HAVE_PSI_INTERFACE
+static inline void inline_mysql_thread_register(
+#ifdef HAVE_PSI_THREAD__INTERFACE
+  const char *category,
+  PSI_thread_info *info,
+  int count
+#else
+  const char *category __attribute__ ((unused)),
+  PSI_thread_info *info __attribute__ ((unused)),
+  int count __attribute__ ((unused))
+#endif
+)
+{
+#ifdef HAVE_PSI_THREAD_INTERFACE
+  if (likely(PSI_server != NULL))
+    PSI_server->register_thread(category, info, count);
+#endif
+}
+
+#ifdef HAVE_PSI_THREAD_INTERFACE
 static inline int inline_mysql_thread_create(
   PSI_thread_key key,
   pthread_t *thread, const pthread_attr_t *attr,

=== modified file 'include/mysql/psi/psi.h'
--- a/include/mysql/psi/psi.h	2011-02-14 14:23:55 +0000
+++ b/include/mysql/psi/psi.h	2011-04-19 03:29:06 +0000
@@ -116,6 +116,90 @@ struct PSI_bootstrap
 #ifdef HAVE_PSI_INTERFACE
 
 /**
+  @def DISABLE_PSI_MUTEX
+  Compiling option to disable the mutex instrumentation.
+  This option is mostly intended to be used during development,
+  when doing special builds with only a subset of the performance schema instrumentation,
+  for code analysis / profiling / performance tuning of a specific instrumentation alone.
+  For this reason, DISABLE_PSI_MUTEX is not advertised in the cmake general options.
+  To disable mutexes, add -DDISABLE_PSI_MUTEX to CFLAGS.
+  @sa DISABLE_PSI_RWLOCK
+  @sa DISABLE_PSI_COND
+  @sa DISABLE_PSI_FILE
+  @sa DISABLE_PSI_TABLE
+  @sa DISABLE_PSI_STAGE
+  @sa DISABLE_PSI_STATEMENT
+*/
+
+#ifndef DISABLE_PSI_MUTEX
+#define HAVE_PSI_MUTEX_INTERFACE
+#endif
+
+/**
+  @def DISABLE_PSI_RWLOCK
+  Compiling option to disable the rwlock instrumentation.
+  @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_RWLOCK
+#define HAVE_PSI_RWLOCK_INTERFACE
+#endif
+
+/**
+  @def DISABLE_PSI_COND
+  Compiling option to disable the cond instrumentation.
+  @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_COND
+#define HAVE_PSI_COND_INTERFACE
+#endif
+
+/**
+  @def DISABLE_PSI_FILE
+  Compiling option to disable the file instrumentation.
+  @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_FILE
+#define HAVE_PSI_FILE_INTERFACE
+#endif
+
+/* No flag to disable the thread instrumentation. */
+
+#define HAVE_PSI_THREAD_INTERFACE
+
+/**
+  @def DISABLE_PSI_TABLE
+  Compiling option to disable the table instrumentation.
+  @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_TABLE
+#define HAVE_PSI_TABLE_INTERFACE
+#endif
+
+/**
+  @def DISABLE_PSI_STAGE
+  Compiling option to disable the stage instrumentation.
+  @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_STAGE
+#define HAVE_PSI_STAGE_INTERFACE
+#endif
+
+/**
+  @def DISABLE_PSI_STATEMENT
+  Compiling option to disable the statement instrumentation.
+  @sa DISABLE_PSI_MUTEX
+*/
+
+#ifndef DISABLE_PSI_STATEMENT
+#define HAVE_PSI_STATEMENT_INTERFACE
+#endif
+
+/**
   @def PSI_VERSION_1
   Performance Schema Interface number for version 1.
   This version is supported.

=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c	2011-04-13 19:16:45 +0000
+++ b/mysys/my_init.c	2011-04-19 03:29:06 +0000
@@ -543,22 +543,19 @@ void my_init_mysys_psi_keys()
   const char* category= "mysys";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= sizeof(all_mysys_mutexes)/sizeof(all_mysys_mutexes[0]);
-  PSI_server->register_mutex(category, all_mysys_mutexes, count);
+  mysql_mutex_register(category, all_mysys_mutexes, count);
 
   count= sizeof(all_mysys_conds)/sizeof(all_mysys_conds[0]);
-  PSI_server->register_cond(category, all_mysys_conds, count);
+  mysql_cond_register(category, all_mysys_conds, count);
 
 #ifdef USE_ALARM_THREAD
   count= sizeof(all_mysys_threads)/sizeof(all_mysys_threads[0]);
-  PSI_server->register_thread(category, all_mysys_threads, count);
+  mysql_thread_register(category, all_mysys_threads, count);
 #endif /* USE_ALARM_THREAD */
 
   count= sizeof(all_mysys_files)/sizeof(all_mysys_files[0]);
-  PSI_server->register_file(category, all_mysys_files, count);
+  mysql_file_register(category, all_mysys_files, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'plugin/semisync/semisync_master_plugin.cc'
--- a/plugin/semisync/semisync_master_plugin.cc	2010-05-31 15:29:54 +0000
+++ b/plugin/semisync/semisync_master_plugin.cc	2011-04-19 03:29:06 +0000
@@ -359,14 +359,11 @@ static void init_semisync_psi_keys(void)
   const char* category= "semisync";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_semisync_mutexes);
-  PSI_server->register_mutex(category, all_semisync_mutexes, count);
+  mysql_mutex_register(category, all_semisync_mutexes, count);
 
   count= array_elements(all_semisync_conds);
-  PSI_server->register_cond(category, all_semisync_conds, count);
+  mysql_cond_register(category, all_semisync_conds, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'sql/debug_sync.cc'
--- a/sql/debug_sync.cc	2010-11-16 10:05:56 +0000
+++ b/sql/debug_sync.cc	2011-04-19 03:29:06 +0000
@@ -453,14 +453,11 @@ static void init_debug_sync_psi_keys(voi
   const char* category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_debug_sync_mutexes);
-  PSI_server->register_mutex(category, all_debug_sync_mutexes, count);
+  mysql_mutex_register(category, all_debug_sync_mutexes, count);
 
   count= array_elements(all_debug_sync_conds);
-  PSI_server->register_cond(category, all_debug_sync_conds, count);
+  mysql_cond_register(category, all_debug_sync_conds, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'sql/events.cc'
--- a/sql/events.cc	2010-11-18 16:34:56 +0000
+++ b/sql/events.cc	2011-04-19 03:29:06 +0000
@@ -945,17 +945,14 @@ static void init_events_psi_keys(void)
   const char* category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_events_mutexes);
-  PSI_server->register_mutex(category, all_events_mutexes, count);
+  mysql_mutex_register(category, all_events_mutexes, count);
 
   count= array_elements(all_events_conds);
-  PSI_server->register_cond(category, all_events_conds, count);
+  mysql_cond_register(category, all_events_conds, count);
 
   count= array_elements(all_events_threads);
-  PSI_server->register_thread(category, all_events_threads, count);
+  mysql_thread_register(category, all_events_threads, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2011-03-22 11:44:40 +0000
+++ b/sql/ha_ndbcluster.cc	2011-04-19 03:29:06 +0000
@@ -7532,20 +7532,17 @@ void init_ndbcluster_psi_keys()
   const char* category= "ndbcluster";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_ndbcluster_mutexes);
-  PSI_server->register_mutex(category, all_ndbcluster_mutexes, count);
+  mysql_mutex_register(category, all_ndbcluster_mutexes, count);
 
   count= array_elements(all_ndbcluster_conds);
-  PSI_server->register_cond(category, all_ndbcluster_conds, count);
+  mysql_cond_register(category, all_ndbcluster_conds, count);
 
   count= array_elements(all_ndbcluster_threads);
-  PSI_server->register_thread(category, all_ndbcluster_threads, count);
+  mysql_thread_register(category, all_ndbcluster_threads, count);
 
   count= array_elements(all_ndbcluster_files);
-  PSI_server->register_file(category, all_ndbcluster_files, count);
+  mysql_file_register(category, all_ndbcluster_files, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2011-03-28 08:10:39 +0000
+++ b/sql/handler.cc	2011-04-19 03:29:06 +0000
@@ -2080,7 +2080,7 @@ int ha_delete_table(THD *thd, handlerton
   }
   delete file;
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
   if (likely((error == 0) && (PSI_server != NULL)))
     PSI_server->drop_table_share(db, strlen(db), alias, strlen(alias));
 #endif
@@ -2173,7 +2173,7 @@ int handler::ha_open(TABLE *table_arg, c
   {
     DBUG_ASSERT(m_psi == NULL);
     DBUG_ASSERT(table_share != NULL);
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
     if (likely(PSI_server != NULL))
     {    
       PSI_table_share *share_psi= ha_table_share_psi(table_share);
@@ -2202,7 +2202,7 @@ int handler::ha_open(TABLE *table_arg, c
 
 int handler::ha_close(void)
 {
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
   if (likely(PSI_server && m_psi))
   {
     PSI_server->close_table(m_psi);
@@ -3894,7 +3894,7 @@ int ha_create_table(THD *thd, const char
   if (open_table_def(thd, &share, 0))
     goto err;
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
   if (likely(PSI_server != NULL))
   {
     my_bool temp= (create_info->options & HA_LEX_CREATE_TMP_TABLE ? TRUE : FALSE);
@@ -3973,7 +3973,7 @@ int ha_create_table_from_engine(THD* thd
     DBUG_RETURN(3);
   }
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
   /*
     Table discovery is not instrumented.
     Once discovered, the table will be opened normally,

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2011-04-15 09:04:21 +0000
+++ b/sql/item_func.cc	2011-04-19 03:29:06 +0000
@@ -3661,14 +3661,10 @@ static PSI_mutex_info all_user_mutexes[]
 
 static void init_user_lock_psi_keys(void)
 {
-  const char* category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_user_mutexes);
-  PSI_server->register_mutex(category, all_user_mutexes, count);
+  mysql_mutex_register("sql", all_user_mutexes, count);
 }
 #endif
 

=== modified file 'sql/mdl.cc'
--- a/sql/mdl.cc	2011-01-27 15:31:18 +0000
+++ b/sql/mdl.cc	2011-04-19 03:29:06 +0000
@@ -51,20 +51,16 @@ static PSI_cond_info all_mdl_conds[]=
 */
 static void init_mdl_psi_keys(void)
 {
-  const char *category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_mdl_mutexes);
-  PSI_server->register_mutex(category, all_mdl_mutexes, count);
+  mysql_mutex_register("sql", all_mdl_mutexes, count);
 
   count= array_elements(all_mdl_rwlocks);
-  PSI_server->register_rwlock(category, all_mdl_rwlocks, count);
+  mysql_rwlock_register("sql", all_mdl_rwlocks, count);
 
   count= array_elements(all_mdl_conds);
-  PSI_server->register_cond(category, all_mdl_conds, count);
+  mysql_cond_register("sql", all_mdl_conds, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-04-15 09:33:58 +0000
+++ b/sql/mysqld.cc	2011-04-19 03:29:06 +0000
@@ -2073,7 +2073,7 @@ static bool cache_thread()
     DBUG_PRINT("info", ("Adding thread to cache"));
     cached_thread_count++;
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_THREAD_INTERFACE
     /*
       Delete the instrumentation for the job that just completed,
       before parking this pthread in the cache (blocked on COND_thread_cache).
@@ -2095,7 +2095,7 @@ static bool cache_thread()
       thd->thread_stack= (char*) &thd;          // For store_globals
       (void) thd->store_globals();
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_THREAD_INTERFACE
       /*
         Create new instrumentation for the new THD job,
         and attach it to this running pthread.
@@ -2734,7 +2734,7 @@ pthread_handler_t signal_hand(void *arg 
       if (!abort_loop)
       {
 	abort_loop=1;				// mark abort for threads
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_THREAD_INTERFACE
         /* Delete the instrumentation for the signal thread */
         if (likely(PSI_server != NULL))
           PSI_server->delete_current_thread();
@@ -4939,7 +4939,7 @@ int mysqld_main(int argc, char **argv)
 #endif
 #endif /* __WIN__ */
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_THREAD_INTERFACE
   /*
     Disable the main thread instrumentation,
     to avoid recording events during the shutdown.
@@ -8513,35 +8513,34 @@ void init_server_psi_keys(void)
   const char* category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_server_mutexes);
-  PSI_server->register_mutex(category, all_server_mutexes, count);
+  mysql_mutex_register(category, all_server_mutexes, count);
 
   count= array_elements(all_server_rwlocks);
-  PSI_server->register_rwlock(category, all_server_rwlocks, count);
+  mysql_rwlock_register(category, all_server_rwlocks, count);
 
   count= array_elements(all_server_conds);
-  PSI_server->register_cond(category, all_server_conds, count);
+  mysql_cond_register(category, all_server_conds, count);
 
   count= array_elements(all_server_threads);
-  PSI_server->register_thread(category, all_server_threads, count);
+  mysql_thread_register(category, all_server_threads, count);
 
   count= array_elements(all_server_files);
-  PSI_server->register_file(category, all_server_files, count);
+  mysql_file_register(category, all_server_files, count);
 
   count= array_elements(all_server_stages);
-  PSI_server->register_stage(category, all_server_stages, count);
+  mysql_stage_register(category, all_server_stages, count);
 
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
   init_sql_statement_info();
   count= array_elements(sql_statement_info);
-  PSI_server->register_statement(category, sql_statement_info, count);
+  mysql_statement_register(category, sql_statement_info, count);
 
   category= "com";
   init_com_statement_info();
   count= array_elements(com_statement_info);
-  PSI_server->register_statement(category, com_statement_info, count);
+  mysql_statement_register(category, com_statement_info, count);
+#endif
 }
 
 #endif /* HAVE_PSI_INTERFACE */

=== modified file 'sql/rpl_master.cc'
--- a/sql/rpl_master.cc	2011-02-18 16:14:04 +0000
+++ b/sql/rpl_master.cc	2011-04-19 03:29:06 +0000
@@ -75,14 +75,10 @@ static PSI_mutex_info all_slave_list_mut
 
 static void init_all_slave_list_mutexes(void)
 {
-  const char* category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_slave_list_mutexes);
-  PSI_server->register_mutex(category, all_slave_list_mutexes, count);
+  mysql_mutex_register("sql", all_slave_list_mutexes, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2011-04-04 10:06:13 +0000
+++ b/sql/rpl_slave.cc	2011-04-19 03:29:06 +0000
@@ -245,11 +245,8 @@ static void init_slave_psi_keys(void)
   const char* category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_slave_threads);
-  PSI_server->register_thread(category, all_slave_threads, count);
+  mysql_thread_register(category, all_slave_threads, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'sql/sp_cache.cc'
--- a/sql/sp_cache.cc	2011-03-22 11:44:40 +0000
+++ b/sql/sp_cache.cc	2011-04-19 03:29:06 +0000
@@ -75,11 +75,8 @@ static void init_sp_cache_psi_keys(void)
   const char* category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_sp_cache_mutexes);
-  PSI_server->register_mutex(category, all_sp_cache_mutexes, count);
+  mysql_mutex_register(category, all_sp_cache_mutexes, count);
 }
 #endif
 

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	2011-04-04 08:47:25 +0000
+++ b/sql/sql_acl.cc	2011-04-19 03:29:06 +0000
@@ -9464,8 +9464,8 @@ acl_authenticate(THD *thd, uint connect_
   thd->net.skip_big_packet= TRUE;
 #endif
 
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server)
+#ifdef HAVE_PSI_THREAD_INTERFACE
+  if (likely(PSI_server != NULL))
   {
     PSI_server->set_thread_user_host(thd->main_security_ctx.user,
                                      strlen(thd->main_security_ctx.user),

=== modified file 'sql/sql_audit.cc'
--- a/sql/sql_audit.cc	2010-12-14 14:38:42 +0000
+++ b/sql/sql_audit.cc	2011-04-19 03:29:06 +0000
@@ -290,11 +290,8 @@ static void init_audit_psi_keys(void)
   const char* category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_audit_mutexes);
-  PSI_server->register_mutex(category, all_audit_mutexes, count);
+  mysql_mutex_register(category, all_audit_mutexes, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2011-04-12 10:59:59 +0000
+++ b/sql/sql_base.cc	2011-04-19 03:29:06 +0000
@@ -116,11 +116,8 @@ static void init_tdc_psi_keys(void)
   const char *category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_tdc_mutexes);
-  PSI_server->register_mutex(category, all_tdc_mutexes, count);
+  mysql_mutex_register(category, all_tdc_mutexes, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 
@@ -549,7 +546,7 @@ TABLE_SHARE *get_table_share(THD *thd, T
   }
   share->ref_count++;				// Mark in use
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
   if (likely(PSI_server != NULL))
     share->m_psi= PSI_server->get_table_share(false, share);
 #endif
@@ -5896,7 +5893,7 @@ TABLE *open_table_uncached(THD *thd, con
     DBUG_RETURN(0);
   }
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
   if (likely(PSI_server != NULL))
     share->m_psi= PSI_server->get_table_share(true, share);
 #endif

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2011-04-15 12:14:35 +0000
+++ b/sql/sql_class.cc	2011-04-19 03:29:06 +0000
@@ -260,8 +260,8 @@ const char *set_thd_proc_info(void *thd_
   thd->profiling.status_change(info, calling_function, basename, calling_line);
 #endif
   thd->proc_info= info;
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server)
+#ifdef HAVE_PSI_THREAD_INTERFACE
+  if (likely(PSI_server != NULL))
     PSI_server->set_thread_state(info);
 #endif
   return old_info;
@@ -3540,8 +3540,8 @@ void THD::inc_examined_row_count(ha_rows
 void THD::inc_status_created_tmp_disk_tables()
 {
   status_var_increment(status_var.created_tmp_disk_tables);
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+  if (likely(PSI_server && m_statement_psi))
     PSI_server->inc_statement_created_tmp_disk_tables(m_statement_psi, 1);
 #endif
 }
@@ -3549,8 +3549,8 @@ void THD::inc_status_created_tmp_disk_ta
 void THD::inc_status_created_tmp_tables()
 {
   status_var_increment(status_var.created_tmp_tables);
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+  if (likely(PSI_server && m_statement_psi))
     PSI_server->inc_statement_created_tmp_tables(m_statement_psi, 1);
 #endif
 }
@@ -3558,8 +3558,8 @@ void THD::inc_status_created_tmp_tables(
 void THD::inc_status_select_full_join()
 {
   status_var_increment(status_var.select_full_join_count);
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+  if (likely(PSI_server && m_statement_psi))
     PSI_server->inc_statement_select_full_join(m_statement_psi, 1);
 #endif
 }
@@ -3567,8 +3567,8 @@ void THD::inc_status_select_full_join()
 void THD::inc_status_select_full_range_join()
 {
   status_var_increment(status_var.select_full_range_join_count);
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+  if (likely(PSI_server && m_statement_psi))
     PSI_server->inc_statement_select_full_range_join(m_statement_psi, 1);
 #endif
 }
@@ -3576,8 +3576,8 @@ void THD::inc_status_select_full_range_j
 void THD::inc_status_select_range()
 {
   status_var_increment(status_var.select_range_count);
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+  if (likely(PSI_server && m_statement_psi))
     PSI_server->inc_statement_select_range(m_statement_psi, 1);
 #endif
 }
@@ -3585,8 +3585,8 @@ void THD::inc_status_select_range()
 void THD::inc_status_select_range_check()
 {
   status_var_increment(status_var.select_range_check_count);
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+  if (likely(PSI_server && m_statement_psi))
     PSI_server->inc_statement_select_range_check(m_statement_psi, 1);
 #endif
 }
@@ -3594,8 +3594,8 @@ void THD::inc_status_select_range_check(
 void THD::inc_status_select_scan()
 {
   status_var_increment(status_var.select_scan_count);
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+  if (likely(PSI_server && m_statement_psi))
     PSI_server->inc_statement_select_scan(m_statement_psi, 1);
 #endif
 }
@@ -3603,8 +3603,8 @@ void THD::inc_status_select_scan()
 void THD::inc_status_sort_merge_passes()
 {
   status_var_increment(status_var.filesort_merge_passes);
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+  if (likely(PSI_server && m_statement_psi))
     PSI_server->inc_statement_sort_merge_passes(m_statement_psi, 1);
 #endif
 }
@@ -3612,8 +3612,8 @@ void THD::inc_status_sort_merge_passes()
 void THD::inc_status_sort_range()
 {
   status_var_increment(status_var.filesort_range_count);
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+  if (likely(PSI_server && m_statement_psi))
     PSI_server->inc_statement_sort_range(m_statement_psi, 1);
 #endif
 }
@@ -3621,8 +3621,8 @@ void THD::inc_status_sort_range()
 void THD::inc_status_sort_rows(ha_rows count)
 {
   statistic_add(status_var.filesort_rows, count, &LOCK_status);
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+  if (likely(PSI_server && m_statement_psi))
     PSI_server->inc_statement_sort_rows(m_statement_psi, count);
 #endif
 }
@@ -3630,8 +3630,8 @@ void THD::inc_status_sort_rows(ha_rows c
 void THD::inc_status_sort_scan()
 {
   status_var_increment(status_var.filesort_scan_count);
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+  if (likely(PSI_server && m_statement_psi))
     PSI_server->inc_statement_sort_scan(m_statement_psi, 1);
 #endif
 }
@@ -3639,8 +3639,8 @@ void THD::inc_status_sort_scan()
 void THD::set_status_no_index_used()
 {
   server_status|= SERVER_QUERY_NO_INDEX_USED;
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+  if (likely(PSI_server && m_statement_psi))
     PSI_server->set_statement_no_index_used(m_statement_psi);
 #endif
 }
@@ -3648,8 +3648,8 @@ void THD::set_status_no_index_used()
 void THD::set_status_no_good_index_used()
 {
   server_status|= SERVER_QUERY_NO_GOOD_INDEX_USED;
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server && m_statement_psi)
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
+  if (likely(PSI_server && m_statement_psi))
     PSI_server->set_statement_no_good_index_used(m_statement_psi);
 #endif
 }
@@ -3657,8 +3657,8 @@ void THD::set_status_no_good_index_used(
 void THD::set_command(enum enum_server_command command)
 {
   m_command= command;
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server)
+#ifdef HAVE_PSI_THREAD_INTERFACE
+  if (likely(PSI_server != NULL))
     PSI_server->set_thread_command(m_command);
 #endif
 }
@@ -3672,8 +3672,8 @@ void THD::set_query(const CSET_STRING &s
   set_query_inner(string_arg);
   mysql_mutex_unlock(&LOCK_thd_data);
 
-#ifdef HAVE_PSI_INTERFACE
-  if (PSI_server)
+#ifdef HAVE_PSI_THREAD_INTERFACE
+  if (likely(PSI_server != NULL))
     PSI_server->set_thread_info(query(), query_length());
 #endif
 }
@@ -3808,11 +3808,8 @@ static void init_xid_psi_keys(void)
   const char* category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_xid_mutexes);
-  PSI_server->register_mutex(category, all_xid_mutexes, count);
+  mysql_mutex_register(category, all_xid_mutexes, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'sql/sql_db.cc'
--- a/sql/sql_db.cc	2011-03-17 09:47:50 +0000
+++ b/sql/sql_db.cc	2011-04-19 03:29:06 +0000
@@ -128,11 +128,8 @@ static void init_database_names_psi_keys
   const char* category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_database_names_rwlocks);
-  PSI_server->register_rwlock(category, all_database_names_rwlocks, count);
+  mysql_rwlock_register(category, all_database_names_rwlocks, count);
 }
 #endif
 

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2011-04-15 12:14:35 +0000
+++ b/sql/sql_parse.cc	2011-04-19 03:29:06 +0000
@@ -911,7 +911,7 @@ static my_bool deny_updates_if_read_only
 bool dispatch_command(enum enum_server_command command, THD *thd,
 		      char* packet, uint packet_length)
 {
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_STATEMENT_INTERFACE
   PSI_statement_locker_state state;
 #endif
 

=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc	2011-02-22 02:58:40 +0000
+++ b/sql/sql_plugin.cc	2011-04-19 03:29:06 +0000
@@ -1185,11 +1185,8 @@ static void init_plugin_psi_keys(void)
   const char* category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_plugin_mutexes);
-  PSI_server->register_mutex(category, all_plugin_mutexes, count);
+  mysql_mutex_register(category, all_plugin_mutexes, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'sql/sql_servers.cc'
--- a/sql/sql_servers.cc	2010-08-20 08:48:59 +0000
+++ b/sql/sql_servers.cc	2011-04-19 03:29:06 +0000
@@ -108,11 +108,8 @@ static void init_servers_cache_psi_keys(
   const char* category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_servers_cache_rwlocks);
-  PSI_server->register_rwlock(category, all_servers_cache_rwlocks, count);
+  mysql_rwlock_register(category, all_servers_cache_rwlocks, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'sql/sql_udf.cc'
--- a/sql/sql_udf.cc	2011-03-22 11:44:40 +0000
+++ b/sql/sql_udf.cc	2011-04-19 03:29:06 +0000
@@ -115,11 +115,8 @@ static void init_udf_psi_keys(void)
   const char* category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_udf_rwlocks);
-  PSI_server->register_rwlock(category, all_udf_rwlocks, count);
+  mysql_rwlock_register(category, all_udf_rwlocks, count);
 }
 #endif
 

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2011-04-04 08:47:25 +0000
+++ b/sql/table.cc	2011-04-19 03:29:06 +0000
@@ -470,7 +470,7 @@ void TABLE_SHARE::destroy()
   }
 #endif /* WITH_PARTITION_STORAGE_ENGINE */
 
-#ifdef HAVE_PSI_INTERFACE
+#ifdef HAVE_PSI_TABLE_INTERFACE
   if (likely(PSI_server && m_psi))
     PSI_server->release_table_share(m_psi);
 #endif

=== modified file 'sql/tztime.cc'
--- a/sql/tztime.cc	2011-03-22 11:44:40 +0000
+++ b/sql/tztime.cc	2011-04-19 03:29:06 +0000
@@ -1549,11 +1549,8 @@ static void init_tz_psi_keys(void)
   const char* category= "sql";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_tz_mutexes);
-  PSI_server->register_mutex(category, all_tz_mutexes, count);
+  mysql_mutex_register(category, all_tz_mutexes, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc	2011-03-22 11:44:40 +0000
+++ b/storage/archive/ha_archive.cc	2011-04-19 03:29:06 +0000
@@ -157,11 +157,8 @@ static void init_archive_psi_keys(void)
   const char* category= "archive";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_archive_mutexes);
-  PSI_server->register_mutex(category, all_archive_mutexes, count);
+  mysql_mutex_register(category, all_archive_mutexes, count);
 }
 
 #endif /* HAVE_PSI_INTERFACE */

=== modified file 'storage/blackhole/ha_blackhole.cc'
--- a/storage/blackhole/ha_blackhole.cc	2011-03-22 11:44:40 +0000
+++ b/storage/blackhole/ha_blackhole.cc	2011-04-19 03:29:06 +0000
@@ -389,11 +389,8 @@ void init_blackhole_psi_keys()
   const char* category= "blackhole";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_blackhole_mutexes);
-  PSI_server->register_mutex(category, all_blackhole_mutexes, count);
+  mysql_mutex_register(category, all_blackhole_mutexes, count);
 }
 #endif
 

=== modified file 'storage/csv/ha_tina.cc'
--- a/storage/csv/ha_tina.cc	2011-03-22 11:44:40 +0000
+++ b/storage/csv/ha_tina.cc	2011-04-19 03:29:06 +0000
@@ -129,14 +129,11 @@ static void init_tina_psi_keys(void)
   const char* category= "csv";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_tina_mutexes);
-  PSI_server->register_mutex(category, all_tina_mutexes, count);
+  mysql_mutex_register(category, all_tina_mutexes, count);
 
   count= array_elements(all_tina_files);
-  PSI_server->register_file(category, all_tina_files, count);
+  mysql_file_register(category, all_tina_files, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'storage/example/ha_example.cc'
--- a/storage/example/ha_example.cc	2011-03-22 11:44:40 +0000
+++ b/storage/example/ha_example.cc	2011-04-19 03:29:06 +0000
@@ -136,11 +136,8 @@ static void init_example_psi_keys()
   const char* category= "example";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_example_mutexes);
-  PSI_server->register_mutex(category, all_example_mutexes, count);
+  mysql_mutex_register(category, all_example_mutexes, count);
 }
 #endif
 

=== modified file 'storage/federated/ha_federated.cc'
--- a/storage/federated/ha_federated.cc	2011-03-22 11:44:40 +0000
+++ b/storage/federated/ha_federated.cc	2011-04-19 03:29:06 +0000
@@ -441,11 +441,8 @@ static void init_federated_psi_keys(void
   const char* category= "federated";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_federated_mutexes);
-  PSI_server->register_mutex(category, all_federated_mutexes, count);
+  mysql_mutex_register(category, all_federated_mutexes, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'storage/heap/hp_static.c'
--- a/storage/heap/hp_static.c	2011-01-11 09:09:21 +0000
+++ b/storage/heap/hp_static.c	2011-04-19 03:29:06 +0000
@@ -41,11 +41,8 @@ void init_heap_psi_keys()
   const char* category= "memory";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_heap_mutexes);
-  PSI_server->register_mutex(category, all_heap_mutexes, count);
+  mysql_mutex_register(category, all_heap_mutexes, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2011-04-13 18:43:08 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2011-04-19 03:29:06 +0000
@@ -2665,35 +2665,35 @@ innobase_change_buffering_inited_ok:
 
 		count = array_elements(all_pthread_mutexes);
 
- 		PSI_server->register_mutex(
+ 		mysql_mutex_register(
 			"innodb", all_pthread_mutexes, count);
 
 # ifdef UNIV_PFS_MUTEX
 		count = array_elements(all_innodb_mutexes);
-		PSI_server->register_mutex("innodb",
+		mysql_mutex_register("innodb",
 					   all_innodb_mutexes, count);
 # endif /* UNIV_PFS_MUTEX */
 
 # ifdef UNIV_PFS_RWLOCK
 		count = array_elements(all_innodb_rwlocks);
-		PSI_server->register_rwlock("innodb",
+		mysql_rwlock_register("innodb",
 					    all_innodb_rwlocks, count);
 # endif /* UNIV_PFS_MUTEX */
 
 # ifdef UNIV_PFS_THREAD
 		count = array_elements(all_innodb_threads);
-		PSI_server->register_thread("innodb",
+		mysql_thread_register("innodb",
 					    all_innodb_threads, count);
 # endif /* UNIV_PFS_THREAD */
 
 # ifdef UNIV_PFS_IO
 		count = array_elements(all_innodb_files);
-		PSI_server->register_file("innodb",
+		mysql_file_register("innodb",
 					  all_innodb_files, count);
 # endif /* UNIV_PFS_IO */
 
 		count = array_elements(all_innodb_conds);
-		PSI_server->register_cond("innodb",
+		mysql_cond_register("innodb",
 					  all_innodb_conds, count);
 	}
 #endif /* HAVE_PSI_INTERFACE */

=== modified file 'storage/myisam/mi_static.c'
--- a/storage/myisam/mi_static.c	2011-01-11 09:09:21 +0000
+++ b/storage/myisam/mi_static.c	2011-04-19 03:29:06 +0000
@@ -118,23 +118,20 @@ void init_myisam_psi_keys()
   const char* category= "myisam";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_myisam_mutexes);
-  PSI_server->register_mutex(category, all_myisam_mutexes, count);
+  mysql_mutex_register(category, all_myisam_mutexes, count);
 
   count= array_elements(all_myisam_rwlocks);
-  PSI_server->register_rwlock(category, all_myisam_rwlocks, count);
+  mysql_rwlock_register(category, all_myisam_rwlocks, count);
 
   count= array_elements(all_myisam_conds);
-  PSI_server->register_cond(category, all_myisam_conds, count);
+  mysql_cond_register(category, all_myisam_conds, count);
 
   count= array_elements(all_myisam_files);
-  PSI_server->register_file(category, all_myisam_files, count);
+  mysql_file_register(category, all_myisam_files, count);
 
   count= array_elements(all_myisam_threads);
-  PSI_server->register_thread(category, all_myisam_threads, count);
+  mysql_thread_register(category, all_myisam_threads, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 

=== modified file 'storage/myisammrg/myrg_static.c'
--- a/storage/myisammrg/myrg_static.c	2009-12-05 01:26:15 +0000
+++ b/storage/myisammrg/myrg_static.c	2011-04-19 03:29:06 +0000
@@ -48,14 +48,11 @@ void init_myisammrg_psi_keys()
   const char* category= "myisammrg";
   int count;
 
-  if (PSI_server == NULL)
-    return;
-
   count= array_elements(all_myisammrg_mutexes);
-  PSI_server->register_mutex(category, all_myisammrg_mutexes, count);
+  mysql_mutex_register(category, all_myisammrg_mutexes, count);
 
   count= array_elements(all_myisammrg_files);
-  PSI_server->register_file(category, all_myisammrg_files, count);
+  mysql_file_register(category, all_myisammrg_files, count);
 }
 #endif /* HAVE_PSI_INTERFACE */
 


Attachment: [text/bzr-bundle] bzr/marc.alff@oracle.com-20110419032906-rccwzmubt6u3yo80.bundle
Thread
bzr commit into mysql-trunk branch (marc.alff:3325) Bug#12346211Marc Alff19 Apr