List:Commits« Previous MessageNext Message »
From:Marc Alff Date:May 14 2012 2:06pm
Subject:bzr push into mysql-trunk-pfs-tuning branch (marc.alff:3509 to 3510)
View as plain text  
 3510 Marc Alff	2012-05-14
      Pre requisite to implement static psi calls:
      - replaces PSI_CALL by PSI_XXX_CALL for each type of instrumentation

    modified:
      include/mysql/psi/mysql_file.h
      include/mysql/psi/mysql_idle.h
      include/mysql/psi/mysql_socket.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_thr_init.c
      sql/handler.cc
      sql/mysqld.cc
      sql/sql_acl.cc
      sql/sql_base.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_table.cc
      sql/table.cc
      storage/innobase/include/os0file.h
      storage/innobase/include/os0sync.ic
      storage/innobase/include/srv0srv.h
      storage/innobase/include/sync0rw.ic
      storage/innobase/include/sync0sync.ic
      storage/perfschema/unittest/pfs_benchmark-t.cc
 3509 Marc Alff	2012-05-14
      Table io / table lock cleanup for global statistics

    modified:
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_events_waits.cc
      storage/perfschema/pfs_instr_class.cc
      storage/perfschema/pfs_instr_class.h
      storage/perfschema/pfs_server.cc
      storage/perfschema/pfs_visitor.cc
=== modified file 'include/mysql/psi/mysql_file.h'
--- a/include/mysql/psi/mysql_file.h	2011-07-05 08:15:52 +0000
+++ b/include/mysql/psi/mysql_file.h	2012-05-14 14:05:47 +0000
@@ -518,7 +518,7 @@ static inline void inline_mysql_file_reg
 )
 {
 #ifdef HAVE_PSI_FILE_INTERFACE
-  PSI_CALL(register_file)(category, info, count);
+  PSI_FILE_CALL(register_file)(category, info, count);
 #endif
 }
 
@@ -533,13 +533,13 @@ inline_mysql_file_fgets(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
-                                                  PSI_FILE_READ);
+  locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+    (&state, file->m_psi, PSI_FILE_READ);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) size, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) size, src_file, src_line);
     result= fgets(str, size, file->m_file);
-    PSI_CALL(end_file_wait)(locker, result ? strlen(result) : 0);
+    PSI_FILE_CALL(end_file_wait)(locker, result ? strlen(result) : 0);
     return result;
   }
 #endif
@@ -559,13 +559,13 @@ inline_mysql_file_fgetc(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
-                                                  PSI_FILE_READ);
+  locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+    (&state, file->m_psi, PSI_FILE_READ);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
     result= fgetc(file->m_file);
-    PSI_CALL(end_file_wait)(locker, (size_t) 1);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) 1);
     return result;
   }
 #endif
@@ -586,14 +586,14 @@ inline_mysql_file_fputs(
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
   size_t bytes;
-  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
-                                                  PSI_FILE_WRITE);
+  locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+    (&state, file->m_psi, PSI_FILE_WRITE);
   if (likely(locker != NULL))
   {
     bytes= str ? strlen(str) : 0;
-    PSI_CALL(start_file_wait)(locker, bytes, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, bytes, src_file, src_line);
     result= fputs(str, file->m_file);
-    PSI_CALL(end_file_wait)(locker, bytes);
+    PSI_FILE_CALL(end_file_wait)(locker, bytes);
     return result;
   }
 #endif
@@ -613,13 +613,13 @@ inline_mysql_file_fputc(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
-                                                  PSI_FILE_WRITE);
+  locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+    (&state, file->m_psi, PSI_FILE_WRITE);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 1, src_file, src_line);
     result= fputc(c, file->m_file);
-    PSI_CALL(end_file_wait)(locker, (size_t) 1);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) 1);
     return result;
   }
 #endif
@@ -639,15 +639,15 @@ inline_mysql_file_fprintf(MYSQL_FILE *fi
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
-                                                  PSI_FILE_WRITE);
+  locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+    (&state, file->m_psi, PSI_FILE_WRITE);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 0, __FILE__, __LINE__);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, __FILE__, __LINE__);
     va_start(args, format);
     result= vfprintf(file->m_file, format, args);
     va_end(args);
-    PSI_CALL(end_file_wait)(locker, (size_t) result);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) result);
     return result;
   }
 #endif
@@ -669,13 +669,13 @@ inline_mysql_file_vfprintf(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
-                                                  PSI_FILE_WRITE);
+  locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+    (&state, file->m_psi, PSI_FILE_WRITE);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
     result= vfprintf(file->m_file, format, args);
-    PSI_CALL(end_file_wait)(locker, (size_t) result);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) result);
     return result;
   }
 #endif
@@ -695,13 +695,13 @@ inline_mysql_file_fflush(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
-                                                  PSI_FILE_FLUSH);
+  locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+    (&state, file->m_psi, PSI_FILE_FLUSH);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
     result= fflush(file->m_file);
-    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
     return result;
   }
 #endif
@@ -727,13 +727,13 @@ inline_mysql_file_fstat(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, filenr,
-                                                      PSI_FILE_FSTAT);
+  locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+    (&state, filenr, PSI_FILE_FSTAT);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
     result= my_fstat(filenr, stat_area, flags);
-    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
     return result;
   }
 #endif
@@ -753,14 +753,13 @@ inline_mysql_file_stat(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_name_locker)(&state,
-                                                key, PSI_FILE_STAT,
-                                                path, &locker);
+  locker= PSI_FILE_CALL(get_thread_file_name_locker)
+    (&state, key, PSI_FILE_STAT, path, &locker);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
+    PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
     result= my_stat(path, stat_area, flags);
-    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
     return result;
   }
 #endif
@@ -780,14 +779,14 @@ inline_mysql_file_chsize(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
-                                                      PSI_FILE_CHSIZE);
+  locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+    (&state, file, PSI_FILE_CHSIZE);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) newlength, src_file,
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) newlength, src_file,
                               src_line);
     result= my_chsize(file, newlength, filler, flags);
-    PSI_CALL(end_file_wait)(locker, (size_t) newlength);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) newlength);
     return result;
   }
 #endif
@@ -810,14 +809,14 @@ inline_mysql_file_fopen(
 #ifdef HAVE_PSI_FILE_INTERFACE
     struct PSI_file_locker *locker;
     PSI_file_locker_state state;
-    locker= PSI_CALL(get_thread_file_name_locker)
+    locker= PSI_FILE_CALL(get_thread_file_name_locker)
         (&state, key, PSI_FILE_STREAM_OPEN, filename, that);
     if (likely(locker != NULL))
     {
-      that->m_psi= PSI_CALL(start_file_open_wait)(locker, src_file,
-                                                  src_line);
+      that->m_psi= PSI_FILE_CALL(start_file_open_wait)
+        (locker, src_file, src_line);
       that->m_file= my_fopen(filename, flags, myFlags);
-      PSI_CALL(end_file_open_wait)(locker);
+      PSI_FILE_CALL(end_file_open_wait)(locker);
       if (unlikely(that->m_file == NULL))
       {
         my_free(that);
@@ -851,13 +850,13 @@ inline_mysql_file_fclose(
 #ifdef HAVE_PSI_FILE_INTERFACE
     struct PSI_file_locker *locker;
     PSI_file_locker_state state;
-    locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
-                                                    PSI_FILE_STREAM_CLOSE);
+    locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+      (&state, file->m_psi, PSI_FILE_STREAM_CLOSE);
     if (likely(locker != NULL))
     {
-      PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+      PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
       result= my_fclose(file->m_file, flags);
-      PSI_CALL(end_file_wait)(locker, (size_t) 0);
+      PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
       my_free(file);
       return result;
     }
@@ -881,17 +880,17 @@ inline_mysql_file_fread(
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
   size_t bytes_read;
-  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
-                                                  PSI_FILE_READ);
+  locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+    (&state, file->m_psi, PSI_FILE_READ);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
     result= my_fread(file->m_file, buffer, count, flags);
     if (flags & (MY_NABP | MY_FNABP))
       bytes_read= (result == 0) ? count : 0;
     else
       bytes_read= (result != MY_FILE_ERROR) ? result : 0;
-    PSI_CALL(end_file_wait)(locker, bytes_read);
+    PSI_FILE_CALL(end_file_wait)(locker, bytes_read);
     return result;
   }
 #endif
@@ -912,17 +911,17 @@ inline_mysql_file_fwrite(
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
   size_t bytes_written;
-  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
-                                                  PSI_FILE_WRITE);
+  locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+    (&state, file->m_psi, PSI_FILE_WRITE);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
     result= my_fwrite(file->m_file, buffer, count, flags);
     if (flags & (MY_NABP | MY_FNABP))
       bytes_written= (result == 0) ? count : 0;
     else
       bytes_written= (result != MY_FILE_ERROR) ? result : 0;
-    PSI_CALL(end_file_wait)(locker, bytes_written);
+    PSI_FILE_CALL(end_file_wait)(locker, bytes_written);
     return result;
   }
 #endif
@@ -942,13 +941,13 @@ inline_mysql_file_fseek(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
-                                                  PSI_FILE_SEEK);
+  locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+    (&state, file->m_psi, PSI_FILE_SEEK);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
     result= my_fseek(file->m_file, pos, whence, flags);
-    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
     return result;
   }
 #endif
@@ -968,13 +967,13 @@ inline_mysql_file_ftell(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_stream_locker)(&state, file->m_psi,
-                                                  PSI_FILE_TELL);
+  locker= PSI_FILE_CALL(get_thread_file_stream_locker)
+    (&state, file->m_psi, PSI_FILE_TELL);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
     result= my_ftell(file->m_file, flags);
-    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
     return result;
   }
 #endif
@@ -994,13 +993,13 @@ inline_mysql_file_create(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_CREATE,
-                                                filename, &locker);
+  locker= PSI_FILE_CALL(get_thread_file_name_locker)
+    (&state, key, PSI_FILE_CREATE, filename, &locker);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
+    PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
     file= my_create(filename, create_flags, access_flags, myFlags);
-    PSI_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
+    PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
     return file;
   }
 #endif
@@ -1024,7 +1023,7 @@ inline_mysql_file_create_temp(
   */
   file= create_temp_file(to, dir, pfx, mode, myFlags);
 #ifdef HAVE_PSI_FILE_INTERFACE
-  PSI_CALL(create_file)(key, to, file);
+  PSI_FILE_CALL(create_file)(key, to, file);
 #endif
   return file;
 }
@@ -1040,13 +1039,13 @@ inline_mysql_file_open(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_OPEN,
-                                                filename, &locker);
+  locker= PSI_FILE_CALL(get_thread_file_name_locker)
+    (&state, key, PSI_FILE_OPEN, filename, &locker);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
+    PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
     file= my_open(filename, flags, myFlags);
-    PSI_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
+    PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
     return file;
   }
 #endif
@@ -1066,13 +1065,13 @@ inline_mysql_file_close(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
-                                                      PSI_FILE_CLOSE);
+  locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+    (&state, file, PSI_FILE_CLOSE);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
     result= my_close(file, flags);
-    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
     return result;
   }
 #endif
@@ -1093,17 +1092,17 @@ inline_mysql_file_read(
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
   size_t bytes_read;
-  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
-                                                      PSI_FILE_READ);
+  locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+    (&state, file, PSI_FILE_READ);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
     result= my_read(file, buffer, count, flags);
     if (flags & (MY_NABP | MY_FNABP))
       bytes_read= (result == 0) ? count : 0;
     else
       bytes_read= (result != MY_FILE_ERROR) ? result : 0;
-    PSI_CALL(end_file_wait)(locker, bytes_read);
+    PSI_FILE_CALL(end_file_wait)(locker, bytes_read);
     return result;
   }
 #endif
@@ -1124,17 +1123,17 @@ inline_mysql_file_write(
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
   size_t bytes_written;
-  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
-                                                      PSI_FILE_WRITE);
+  locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+    (&state, file, PSI_FILE_WRITE);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
     result= my_write(file, buffer, count, flags);
     if (flags & (MY_NABP | MY_FNABP))
       bytes_written= (result == 0) ? count : 0;
     else
       bytes_written= (result != MY_FILE_ERROR) ? result : 0;
-    PSI_CALL(end_file_wait)(locker, bytes_written);
+    PSI_FILE_CALL(end_file_wait)(locker, bytes_written);
     return result;
   }
 #endif
@@ -1155,16 +1154,17 @@ inline_mysql_file_pread(
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
   size_t bytes_read;
-  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_READ);
+  locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+    (&state, file, PSI_FILE_READ);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
     result= my_pread(file, buffer, count, offset, flags);
     if (flags & (MY_NABP | MY_FNABP))
       bytes_read= (result == 0) ? count : 0;
     else
       bytes_read= (result != MY_FILE_ERROR) ? result : 0;
-    PSI_CALL(end_file_wait)(locker, bytes_read);
+    PSI_FILE_CALL(end_file_wait)(locker, bytes_read);
     return result;
   }
 #endif
@@ -1185,17 +1185,17 @@ inline_mysql_file_pwrite(
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
   size_t bytes_written;
-  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file,
-                                                      PSI_FILE_WRITE);
+  locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+    (&state, file, PSI_FILE_WRITE);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, count, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, count, src_file, src_line);
     result= my_pwrite(file, buffer, count, offset, flags);
     if (flags & (MY_NABP | MY_FNABP))
       bytes_written= (result == 0) ? count : 0;
     else
       bytes_written= (result != MY_FILE_ERROR) ? result : 0;
-    PSI_CALL(end_file_wait)(locker, bytes_written);
+    PSI_FILE_CALL(end_file_wait)(locker, bytes_written);
     return result;
   }
 #endif
@@ -1215,12 +1215,13 @@ inline_mysql_file_seek(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_SEEK);
+  locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+    (&state, file, PSI_FILE_SEEK);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
     result= my_seek(file, pos, whence, flags);
-    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
     return result;
   }
 #endif
@@ -1240,12 +1241,13 @@ inline_mysql_file_tell(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, file, PSI_FILE_TELL);
+  locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+    (&state, file, PSI_FILE_TELL);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
     result= my_tell(file, flags);
-    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
     return result;
   }
 #endif
@@ -1265,13 +1267,13 @@ inline_mysql_file_delete(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_DELETE,
-                                                name, &locker);
+  locker= PSI_FILE_CALL(get_thread_file_name_locker)
+    (&state, key, PSI_FILE_DELETE, name, &locker);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
     result= my_delete(name, flags);
-    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
     return result;
   }
 #endif
@@ -1291,13 +1293,13 @@ inline_mysql_file_rename(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_RENAME,
-                                                to, &locker);
+  locker= PSI_FILE_CALL(get_thread_file_name_locker)
+    (&state, key, PSI_FILE_RENAME, to, &locker);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
     result= my_rename(from, to, flags);
-    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
     return result;
   }
 #endif
@@ -1318,14 +1320,14 @@ inline_mysql_file_create_with_symlink(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_CREATE,
-                                                filename, &locker);
+  locker= PSI_FILE_CALL(get_thread_file_name_locker)
+    (&state, key, PSI_FILE_CREATE, filename, &locker);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_open_wait)(locker, src_file, src_line);
+    PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
     file= my_create_with_symlink(linkname, filename, create_flags, access_flags,
                                  flags);
-    PSI_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
+    PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(locker, file);
     return file;
   }
 #endif
@@ -1346,13 +1348,13 @@ inline_mysql_file_delete_with_symlink(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_DELETE,
-                                                name, &locker);
+  locker= PSI_FILE_CALL(get_thread_file_name_locker)
+    (&state, key, PSI_FILE_DELETE, name, &locker);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
     result= my_delete_with_symlink(name, flags);
-    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
     return result;
   }
 #endif
@@ -1372,13 +1374,13 @@ inline_mysql_file_rename_with_symlink(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_RENAME,
-                                                to, &locker);
+  locker= PSI_FILE_CALL(get_thread_file_name_locker)
+    (&state, key, PSI_FILE_RENAME, to, &locker);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
     result= my_rename_with_symlink(from, to, flags);
-    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
     return result;
   }
 #endif
@@ -1398,12 +1400,13 @@ inline_mysql_file_sync(
 #ifdef HAVE_PSI_FILE_INTERFACE
   struct PSI_file_locker *locker;
   PSI_file_locker_state state;
-  locker= PSI_CALL(get_thread_file_descriptor_locker)(&state, fd, PSI_FILE_SYNC);
+  locker= PSI_FILE_CALL(get_thread_file_descriptor_locker)
+    (&state, fd, PSI_FILE_SYNC);
   if (likely(locker != NULL))
   {
-    PSI_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
+    PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
     result= my_sync(fd, flags);
-    PSI_CALL(end_file_wait)(locker, (size_t) 0);
+    PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
     return result;
   }
 #endif

=== modified file 'include/mysql/psi/mysql_idle.h'
--- a/include/mysql/psi/mysql_idle.h	2011-11-01 16:33:58 +0000
+++ b/include/mysql/psi/mysql_idle.h	2012-05-14 14:05:47 +0000
@@ -70,7 +70,7 @@ inline_mysql_start_idle_wait(PSI_idle_lo
                              const char *src_file, int src_line)
 {
   struct PSI_idle_locker *locker;
-  locker= PSI_CALL(start_idle_wait)(state, src_file, src_line);
+  locker= PSI_IDLE_CALL(start_idle_wait)(state, src_file, src_line);
   return locker;
 }
 
@@ -82,7 +82,7 @@ static inline void
 inline_mysql_end_idle_wait(struct PSI_idle_locker *locker)
 {
   if (likely(locker != NULL))
-    PSI_CALL(end_idle_wait)(locker);
+    PSI_IDLE_CALL(end_idle_wait)(locker);
 }
 #endif
 

=== modified file 'include/mysql/psi/mysql_socket.h'
--- a/include/mysql/psi/mysql_socket.h	2012-05-11 13:26:38 +0000
+++ b/include/mysql/psi/mysql_socket.h	2012-05-14 14:05:47 +0000
@@ -122,7 +122,7 @@ mysql_socket_set_address(
 {
 #ifdef HAVE_PSI_SOCKET_INTERFACE
   if (socket.m_psi != NULL)
-    PSI_CALL(set_socket_info)(socket.m_psi, NULL, addr, addr_len);
+    PSI_SOCKET_CALL(set_socket_info)(socket.m_psi, NULL, addr, addr_len);
 #endif
 }
 
@@ -142,7 +142,7 @@ MYSQL_SOCKET socket __attribute__ ((unus
 {
 #ifdef HAVE_PSI_SOCKET_INTERFACE
   if (socket.m_psi != NULL)
-    PSI_CALL(set_socket_thread_owner)(socket.m_psi);
+    PSI_SOCKET_CALL(set_socket_thread_owner)(socket.m_psi);
 #endif
 }
 
@@ -248,8 +248,8 @@ inline_mysql_start_socket_wait(PSI_socke
   struct PSI_socket_locker *locker;
   if (mysql_socket.m_psi != NULL)
   {
-    locker= PSI_CALL(start_socket_wait)(state, mysql_socket.m_psi, op,
-                                        byte_count, src_file, src_line);
+    locker= PSI_SOCKET_CALL(start_socket_wait)
+      (state, mysql_socket.m_psi, op, byte_count, src_file, src_line);
   }
   else
     locker= NULL;
@@ -264,7 +264,7 @@ static inline void
 inline_mysql_end_socket_wait(struct PSI_socket_locker *locker, size_t byte_count)
 {
   if (locker != NULL)
-    PSI_CALL(end_socket_wait)(locker, byte_count);
+    PSI_SOCKET_CALL(end_socket_wait)(locker, byte_count);
 }
 
 /**
@@ -277,7 +277,7 @@ static inline void
 inline_mysql_socket_set_state(MYSQL_SOCKET socket, enum PSI_socket_state state)
 {
   if (socket.m_psi != NULL)
-    PSI_CALL(set_socket_state)(socket.m_psi, state);
+    PSI_SOCKET_CALL(set_socket_state)(socket.m_psi, state);
 }
 #endif /* HAVE_PSI_SOCKET_INTERFACE */
 
@@ -538,7 +538,7 @@ static inline void inline_mysql_socket_r
   PSI_socket_info *info,
   int count)
 {
-  PSI_CALL(register_socket)(category, info, count);
+  PSI_SOCKET_CALL(register_socket)(category, info, count);
 }
 #endif
 
@@ -556,10 +556,12 @@ inline_mysql_socket_socket
   mysql_socket.fd= socket(domain, type, protocol);
 
 #ifdef HAVE_PSI_SOCKET_INTERFACE
-  mysql_socket.m_psi= PSI_CALL(init_socket)(key, (const my_socket*)&mysql_socket.fd);
+  mysql_socket.m_psi= PSI_SOCKET_CALL(init_socket)
+    (key, (const my_socket*)&mysql_socket.fd);
 
   if (likely(mysql_socket.fd != INVALID_SOCKET && mysql_socket.m_psi != NULL))
-    PSI_CALL(set_socket_info)(mysql_socket.m_psi, &mysql_socket.fd, NULL, 0);
+    PSI_SOCKET_CALL(set_socket_info)
+      (mysql_socket.m_psi, &mysql_socket.fd, NULL, 0);
 #else
   mysql_socket.m_psi= NULL;
 #endif
@@ -584,17 +586,17 @@ inline_mysql_socket_bind
     /* Instrumentation start */
     PSI_socket_locker_state state;
     PSI_socket_locker *locker;
-    locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
-                                        PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
+    locker= PSI_SOCKET_CALL(start_socket_wait)
+      (&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
 
     /* Instrumented code */
     result= bind(mysql_socket.fd, addr, len);
 
     /* Instrumentation end */
-    PSI_CALL(set_socket_info)(mysql_socket.m_psi, NULL, addr, len);
+    PSI_SOCKET_CALL(set_socket_info)(mysql_socket.m_psi, NULL, addr, len);
 
     if (locker != NULL)
-      PSI_CALL(end_socket_wait)(locker, (size_t)0);
+      PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
 
     return result;
   }
@@ -623,15 +625,15 @@ inline_mysql_socket_getsockname
     /* Instrumentation start */
     PSI_socket_locker *locker;
     PSI_socket_locker_state state;
-    locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
-                                        PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
+    locker= PSI_SOCKET_CALL(start_socket_wait)
+      (&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
 
     /* Instrumented code */
     result= getsockname(mysql_socket.fd, addr, len);
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_socket_wait)(locker, (size_t)0);
+      PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
 
     return result;
   }
@@ -661,15 +663,15 @@ inline_mysql_socket_connect
     /* Instrumentation start */
     PSI_socket_locker *locker;
     PSI_socket_locker_state state;
-    locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
-                                        PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
+    locker= PSI_SOCKET_CALL(start_socket_wait)
+      (&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
 
     /* Instrumented code */
     result= connect(mysql_socket.fd, addr, len);
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_socket_wait)(locker, (size_t)0);
+      PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
 
     return result;
   }
@@ -699,15 +701,15 @@ inline_mysql_socket_getpeername
     /* Instrumentation start */
     PSI_socket_locker *locker;
     PSI_socket_locker_state state;
-    locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
-                                        PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
+    locker= PSI_SOCKET_CALL(start_socket_wait)
+      (&state, mysql_socket.m_psi, PSI_SOCKET_BIND, (size_t)0, src_file, src_line);
 
     /* Instrumented code */
     result= getpeername(mysql_socket.fd, addr, len);
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_socket_wait)(locker, (size_t)0);
+      PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
 
     return result;
   }
@@ -737,8 +739,8 @@ inline_mysql_socket_send
     /* Instrumentation start */
     PSI_socket_locker *locker;
     PSI_socket_locker_state state;
-    locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
-                                        PSI_SOCKET_SEND, n, src_file, src_line);
+    locker= PSI_SOCKET_CALL(start_socket_wait)
+      (&state, mysql_socket.m_psi, PSI_SOCKET_SEND, n, src_file, src_line);
 
     /* Instrumented code */
     result= send(mysql_socket.fd, buf, IF_WIN((int),) n, flags);
@@ -748,7 +750,7 @@ inline_mysql_socket_send
     {
       size_t bytes_written;
       bytes_written= (result > -1) ? result : 0;
-      PSI_CALL(end_socket_wait)(locker, bytes_written);
+      PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written);
     }
 
     return result;
@@ -779,8 +781,8 @@ inline_mysql_socket_recv
     /* Instrumentation start */
     PSI_socket_locker *locker;
     PSI_socket_locker_state state;
-    locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
-                                        PSI_SOCKET_RECV, (size_t)0, src_file, src_line);
+    locker= PSI_SOCKET_CALL(start_socket_wait)
+      (&state, mysql_socket.m_psi, PSI_SOCKET_RECV, (size_t)0, src_file, src_line);
 
     /* Instrumented code */
     result= recv(mysql_socket.fd, buf, IF_WIN((int),) n, flags);
@@ -790,7 +792,7 @@ inline_mysql_socket_recv
     {
       size_t bytes_read;
       bytes_read= (result > -1) ? result : 0;
-      PSI_CALL(end_socket_wait)(locker, bytes_read);
+      PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read);
     }
 
     return result;
@@ -821,8 +823,8 @@ inline_mysql_socket_sendto
     /* Instrumentation start */
     PSI_socket_locker *locker;
     PSI_socket_locker_state state;
-    locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
-                                        PSI_SOCKET_SEND, n, src_file, src_line);
+    locker= PSI_SOCKET_CALL(start_socket_wait)
+      (&state, mysql_socket.m_psi, PSI_SOCKET_SEND, n, src_file, src_line);
 
     /* Instrumented code */
     result= sendto(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len);
@@ -832,7 +834,7 @@ inline_mysql_socket_sendto
     {
       size_t bytes_written;
       bytes_written = (result > -1) ? result : 0;
-      PSI_CALL(end_socket_wait)(locker, bytes_written);
+      PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written);
     }
 
     return result;
@@ -864,8 +866,8 @@ inline_mysql_socket_recvfrom
     /* Instrumentation start */
     PSI_socket_locker *locker;
     PSI_socket_locker_state state;
-    locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
-                                        PSI_SOCKET_RECV, (size_t)0, src_file, src_line);
+    locker= PSI_SOCKET_CALL(start_socket_wait)
+      (&state, mysql_socket.m_psi, PSI_SOCKET_RECV, (size_t)0, src_file, src_line);
 
     /* Instrumented code */
     result= recvfrom(mysql_socket.fd, buf, IF_WIN((int),) n, flags, addr, addr_len);
@@ -875,7 +877,7 @@ inline_mysql_socket_recvfrom
     {
       size_t bytes_read;
       bytes_read = (result > -1) ? result : 0;
-      PSI_CALL(end_socket_wait)(locker, bytes_read);
+      PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read);
     }
 
     return result;
@@ -906,15 +908,15 @@ inline_mysql_socket_getsockopt
     /* Instrumentation start */
     PSI_socket_locker *locker;
     PSI_socket_locker_state state;
-    locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
-                                        PSI_SOCKET_OPT, (size_t)0, src_file, src_line);
+    locker= PSI_SOCKET_CALL(start_socket_wait)
+      (&state, mysql_socket.m_psi, PSI_SOCKET_OPT, (size_t)0, src_file, src_line);
 
     /* Instrumented code */
     result= getsockopt(mysql_socket.fd, level, optname, optval, optlen);
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_socket_wait)(locker, (size_t)0);
+      PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
 
     return result;
   }
@@ -945,15 +947,15 @@ inline_mysql_socket_setsockopt
     /* Instrumentation start */
     PSI_socket_locker *locker;
     PSI_socket_locker_state state;
-    locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
-                                        PSI_SOCKET_OPT, (size_t)0, src_file, src_line);
+    locker= PSI_SOCKET_CALL(start_socket_wait)
+      (&state, mysql_socket.m_psi, PSI_SOCKET_OPT, (size_t)0, src_file, src_line);
 
     /* Instrumented code */
     result= setsockopt(mysql_socket.fd, level, optname, optval, optlen);
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_socket_wait)(locker, (size_t)0);
+      PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
 
     return result;
   }
@@ -983,15 +985,15 @@ inline_mysql_socket_listen
     /* Instrumentation start */
     PSI_socket_locker *locker;
     PSI_socket_locker_state state;
-    locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
-                                        PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
+    locker= PSI_SOCKET_CALL(start_socket_wait)
+      (&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
 
     /* Instrumented code */
     result= listen(mysql_socket.fd, backlog);
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_socket_wait)(locker, (size_t)0);
+      PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
 
     return result;
   }
@@ -1022,15 +1024,15 @@ inline_mysql_socket_accept
     /* Instrumentation start */
     PSI_socket_locker *locker;
     PSI_socket_locker_state state;
-    locker= PSI_CALL(start_socket_wait)(&state, socket_listen.m_psi,
-                                        PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
+    locker= PSI_SOCKET_CALL(start_socket_wait)
+      (&state, socket_listen.m_psi, PSI_SOCKET_CONNECT, (size_t)0, src_file, src_line);
 
     /* Instrumented code */
     socket_accept.fd= accept(socket_listen.fd, addr, &addr_length);
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_socket_wait)(locker, (size_t)0);
+      PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
   }
   else
 #endif
@@ -1041,13 +1043,13 @@ inline_mysql_socket_accept
 
 #ifdef HAVE_PSI_SOCKET_INTERFACE
   /* Initialize the instrument with the new socket descriptor and address */
-  socket_accept.m_psi=
-            PSI_CALL(init_socket)(key, (const my_socket*)&socket_accept.fd);
+  socket_accept.m_psi= PSI_SOCKET_CALL(init_socket)
+    (key, (const my_socket*)&socket_accept.fd);
 
   /* FIXME: simplify this with just 1 call to init_socket(). */
   if (socket_accept.m_psi != NULL)
-    PSI_CALL(set_socket_info)(socket_accept.m_psi, &socket_accept.fd, addr,
-                              addr_length);
+    PSI_SOCKET_CALL(set_socket_info)
+      (socket_accept.m_psi, &socket_accept.fd, addr, addr_length);
 #endif
 
   return socket_accept;
@@ -1071,18 +1073,18 @@ inline_mysql_socket_close
     /* Instrumentation start */
     PSI_socket_locker *locker;
     PSI_socket_locker_state state;
-    locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
-                                        PSI_SOCKET_CLOSE, (size_t)0, src_file, src_line);
+    locker= PSI_SOCKET_CALL(start_socket_wait)
+      (&state, mysql_socket.m_psi, PSI_SOCKET_CLOSE, (size_t)0, src_file, src_line);
 
     /* Instrumented code */
     result= closesocket(mysql_socket.fd);
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_socket_wait)(locker, (size_t)0);
+      PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
     /* Remove the instrumentation for this socket. */
     if (mysql_socket.m_psi != NULL)
-      PSI_CALL(destroy_socket)(mysql_socket.m_psi);
+      PSI_SOCKET_CALL(destroy_socket)(mysql_socket.m_psi);
 
     return result;
   }
@@ -1125,8 +1127,8 @@ inline_mysql_socket_shutdown
   {
     PSI_socket_locker *locker;
     PSI_socket_locker_state state;
-    locker= PSI_CALL(start_socket_wait)(&state, mysql_socket.m_psi,
-                                        PSI_SOCKET_SHUTDOWN, (size_t)0, src_file, src_line);
+    locker= PSI_SOCKET_CALL(start_socket_wait)
+      (&state, mysql_socket.m_psi, PSI_SOCKET_SHUTDOWN, (size_t)0, src_file, src_line);
 
     /* Instrumented code */
 #ifdef __WIN__
@@ -1139,7 +1141,7 @@ inline_mysql_socket_shutdown
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_socket_wait)(locker, (size_t)0);
+      PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
 
     return result;
   }

=== modified file 'include/mysql/psi/mysql_stage.h'
--- a/include/mysql/psi/mysql_stage.h	2011-07-05 08:15:52 +0000
+++ b/include/mysql/psi/mysql_stage.h	2012-05-14 14:05:47 +0000
@@ -53,7 +53,7 @@
 static inline void inline_mysql_stage_register(
   const char *category, PSI_stage_info **info, int count)
 {
-  PSI_CALL(register_stage)(category, info, count);
+  PSI_STAGE_CALL(register_stage)(category, info, count);
 }
 #endif
 
@@ -62,7 +62,7 @@ static inline void
 inline_mysql_set_stage(PSI_stage_key key,
                        const char *src_file, int src_line)
 {
-  PSI_CALL(start_stage)(key, src_file, src_line);
+  PSI_STAGE_CALL(start_stage)(key, src_file, src_line);
 }
 #endif
 

=== modified file 'include/mysql/psi/mysql_statement.h'
--- a/include/mysql/psi/mysql_statement.h	2012-04-03 21:19:04 +0000
+++ b/include/mysql/psi/mysql_statement.h	2012-05-14 14:05:47 +0000
@@ -122,7 +122,7 @@
 static inline void inline_mysql_statement_register(
   const char *category, PSI_statement_info *info, int count)
 {
-  PSI_CALL(register_statement)(category, info, count);
+  PSI_STATEMENT_CALL(register_statement)(category, info, count);
 }
 
 #ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
@@ -132,7 +132,7 @@ inline_mysql_digest_start(PSI_statement_
   PSI_digest_locker* digest_locker= NULL;
 
   if (likely(locker != NULL))
-    digest_locker= PSI_CALL(digest_start)(locker);
+    digest_locker= PSI_STATEMENT_CALL(digest_start)(locker);
   return digest_locker;
 }
 #endif
@@ -143,7 +143,7 @@ inline_mysql_add_token(PSI_digest_locker
                        void *yylval)
 {
   if (likely(locker != NULL))
-    locker= PSI_CALL(digest_add_token)(locker, token,
+    locker= PSI_STATEMENT_CALL(digest_add_token)(locker, token,
                                       (OPAQUE_LEX_YYSTYPE*)yylval);
   return locker;
 }
@@ -157,9 +157,9 @@ inline_mysql_start_statement(PSI_stateme
                              const char *src_file, int src_line)
 {
   PSI_statement_locker *locker;
-  locker= PSI_CALL(get_thread_statement_locker)(state, key, charset);
+  locker= PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset);
   if (likely(locker != NULL))
-    PSI_CALL(start_statement)(locker, db, db_len, src_file, src_line);
+    PSI_STATEMENT_CALL(start_statement)(locker, db, db_len, src_file, src_line);
   return locker;
 }
 
@@ -169,7 +169,7 @@ inline_mysql_refine_statement(PSI_statem
 {
   if (likely(locker != NULL))
   {
-    locker= PSI_CALL(refine_statement)(locker, key);
+    locker= PSI_STATEMENT_CALL(refine_statement)(locker, key);
   }
   return locker;
 }
@@ -180,7 +180,7 @@ inline_mysql_set_statement_text(PSI_stat
 {
   if (likely(locker != NULL))
   {
-    PSI_CALL(set_statement_text)(locker, text, text_len);
+    PSI_STATEMENT_CALL(set_statement_text)(locker, text, text_len);
   }
 }
 
@@ -190,7 +190,7 @@ inline_mysql_set_statement_lock_time(PSI
 {
   if (likely(locker != NULL))
   {
-    PSI_CALL(set_statement_lock_time)(locker, count);
+    PSI_STATEMENT_CALL(set_statement_lock_time)(locker, count);
   }
 }
 
@@ -200,7 +200,7 @@ inline_mysql_set_statement_rows_sent(PSI
 {
   if (likely(locker != NULL))
   {
-    PSI_CALL(set_statement_rows_sent)(locker, count);
+    PSI_STATEMENT_CALL(set_statement_rows_sent)(locker, count);
   }
 }
 
@@ -210,7 +210,7 @@ inline_mysql_set_statement_rows_examined
 {
   if (likely(locker != NULL))
   {
-    PSI_CALL(set_statement_rows_examined)(locker, count);
+    PSI_STATEMENT_CALL(set_statement_rows_examined)(locker, count);
   }
 }
 
@@ -218,9 +218,9 @@ static inline void
 inline_mysql_end_statement(struct PSI_statement_locker *locker,
                            Diagnostics_area *stmt_da)
 {
-  PSI_CALL(end_stage)();
+  PSI_STAGE_CALL(end_stage)();
   if (likely(locker != NULL))
-    PSI_CALL(end_statement)(locker, stmt_da);
+    PSI_STATEMENT_CALL(end_statement)(locker, stmt_da);
 }
 #endif
 

=== modified file 'include/mysql/psi/mysql_table.h'
--- a/include/mysql/psi/mysql_table.h	2012-03-02 10:00:10 +0000
+++ b/include/mysql/psi/mysql_table.h	2012-05-14 14:05:47 +0000
@@ -60,22 +60,22 @@
   @sa MYSQL_END_TABLE_WAIT.
 */
 #ifdef HAVE_PSI_TABLE_INTERFACE
-  #define MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD)          \
-    {                                                                  \
-      if (PSI != NULL)                                                 \
-      {                                                                \
-        PSI_table_locker *locker;                                      \
-        PSI_table_locker_state state;                                  \
-        locker= PSI_CALL(start_table_io_wait)(& state, PSI, OP, INDEX, \
-                                              __FILE__, __LINE__);     \
-        PAYLOAD                                                        \
-        if (locker != NULL)                                            \
-          PSI_CALL(end_table_io_wait)(locker);                         \
-      }                                                                \
-      else                                                             \
-      {                                                                \
-        PAYLOAD                                                        \
-      }                                                                \
+  #define MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD) \
+    {                                                         \
+      if (PSI != NULL)                                        \
+      {                                                       \
+        PSI_table_locker *locker;                             \
+        PSI_table_locker_state state;                         \
+        locker= PSI_TABLE_CALL(start_table_io_wait)           \
+          (& state, PSI, OP, INDEX, __FILE__, __LINE__);      \
+        PAYLOAD                                               \
+        if (locker != NULL)                                   \
+          PSI_TABLE_CALL(end_table_io_wait)(locker);          \
+      }                                                       \
+      else                                                    \
+      {                                                       \
+        PAYLOAD                                               \
+      }                                                       \
     }
 #else
   #define MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD) \
@@ -93,22 +93,22 @@
   @sa MYSQL_END_TABLE_WAIT.
 */
 #ifdef HAVE_PSI_TABLE_INTERFACE
-  #define MYSQL_TABLE_LOCK_WAIT(PSI, OP, FLAGS, PAYLOAD)                 \
-    {                                                                    \
-      if (PSI != NULL)                                                   \
-      {                                                                  \
-        PSI_table_locker *locker;                                        \
-        PSI_table_locker_state state;                                    \
-        locker= PSI_CALL(start_table_lock_wait)(& state, PSI, OP, FLAGS, \
-                                                __FILE__, __LINE__);     \
-        PAYLOAD                                                          \
-        if (locker != NULL)                                              \
-          PSI_CALL(end_table_lock_wait)(locker);                         \
-      }                                                                  \
-      else                                                               \
-      {                                                                  \
-        PAYLOAD                                                          \
-      }                                                                  \
+  #define MYSQL_TABLE_LOCK_WAIT(PSI, OP, FLAGS, PAYLOAD) \
+    {                                                    \
+      if (PSI != NULL)                                   \
+      {                                                  \
+        PSI_table_locker *locker;                        \
+        PSI_table_locker_state state;                    \
+        locker= PSI_TABLE_CALL(start_table_lock_wait)    \
+          (& state, PSI, OP, FLAGS, __FILE__, __LINE__); \
+        PAYLOAD                                          \
+        if (locker != NULL)                              \
+          PSI_TABLE_CALL(end_table_lock_wait)(locker);   \
+      }                                                  \
+      else                                               \
+      {                                                  \
+        PAYLOAD                                          \
+      }                                                  \
     }
 #else
   #define MYSQL_TABLE_LOCK_WAIT(PSI, OP, FLAGS, PAYLOAD) \
@@ -164,7 +164,8 @@ inline_mysql_start_table_lock_wait(PSI_t
   if (psi != NULL)
   {
     struct PSI_table_locker *locker;
-    locker= PSI_CALL(start_table_lock_wait)(state, psi, op, flags, src_file, src_line);
+    locker= PSI_TABLE_CALL(start_table_lock_wait)
+      (state, psi, op, flags, src_file, src_line);
     return locker;
   }
   return NULL;
@@ -178,7 +179,7 @@ static inline void
 inline_mysql_end_table_lock_wait(struct PSI_table_locker *locker)
 {
   if (locker != NULL)
-    PSI_CALL(end_table_lock_wait)(locker);
+    PSI_TABLE_CALL(end_table_lock_wait)(locker);
 }
 #endif
 

=== modified file 'include/mysql/psi/mysql_thread.h'
--- a/include/mysql/psi/mysql_thread.h	2012-03-02 10:00:10 +0000
+++ b/include/mysql/psi/mysql_thread.h	2012-05-14 14:05:47 +0000
@@ -594,7 +594,7 @@ static inline void inline_mysql_mutex_re
 )
 {
 #ifdef HAVE_PSI_MUTEX_INTERFACE
-  PSI_CALL(register_mutex)(category, info, count);
+  PSI_MUTEX_CALL(register_mutex)(category, info, count);
 #endif
 }
 
@@ -610,7 +610,7 @@ static inline int inline_mysql_mutex_ini
   )
 {
 #ifdef HAVE_PSI_MUTEX_INTERFACE
-  that->m_psi= PSI_CALL(init_mutex)(key, &that->m_mutex);
+  that->m_psi= PSI_MUTEX_CALL(init_mutex)(key, &that->m_mutex);
 #else
   that->m_psi= NULL;
 #endif
@@ -633,7 +633,7 @@ static inline int inline_mysql_mutex_des
 #ifdef HAVE_PSI_MUTEX_INTERFACE
   if (that->m_psi != NULL)
   {
-    PSI_CALL(destroy_mutex)(that->m_psi);
+    PSI_MUTEX_CALL(destroy_mutex)(that->m_psi);
     that->m_psi= NULL;
   }
 #endif
@@ -661,7 +661,7 @@ static inline int inline_mysql_mutex_loc
     /* Instrumentation start */
     PSI_mutex_locker *locker;
     PSI_mutex_locker_state state;
-    locker= PSI_CALL(start_mutex_wait)(&state, that->m_psi,
+    locker= PSI_MUTEX_CALL(start_mutex_wait)(&state, that->m_psi,
                                        PSI_MUTEX_LOCK, src_file, src_line);
 
     /* Instrumented code */
@@ -675,7 +675,7 @@ static inline int inline_mysql_mutex_loc
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_mutex_wait)(locker, result);
+      PSI_MUTEX_CALL(end_mutex_wait)(locker, result);
 
     return result;
   }
@@ -708,7 +708,7 @@ static inline int inline_mysql_mutex_try
     /* Instrumentation start */
     PSI_mutex_locker *locker;
     PSI_mutex_locker_state state;
-    locker= PSI_CALL(start_mutex_wait)(&state, that->m_psi,
+    locker= PSI_MUTEX_CALL(start_mutex_wait)(&state, that->m_psi,
                                        PSI_MUTEX_TRYLOCK, src_file, src_line);
 
     /* Instrumented code */
@@ -722,7 +722,7 @@ static inline int inline_mysql_mutex_try
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_mutex_wait)(locker, result);
+      PSI_MUTEX_CALL(end_mutex_wait)(locker, result);
 
     return result;
   }
@@ -751,7 +751,7 @@ static inline int inline_mysql_mutex_unl
 
 #ifdef HAVE_PSI_MUTEX_INTERFACE
   if (that->m_psi != NULL)
-    PSI_CALL(unlock_mutex)(that->m_psi);
+    PSI_MUTEX_CALL(unlock_mutex)(that->m_psi);
 #endif
 
 #ifdef SAFE_MUTEX
@@ -778,7 +778,7 @@ static inline void inline_mysql_rwlock_r
 )
 {
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  PSI_CALL(register_rwlock)(category, info, count);
+  PSI_RWLOCK_CALL(register_rwlock)(category, info, count);
 #endif
 }
 
@@ -789,7 +789,7 @@ static inline int inline_mysql_rwlock_in
   mysql_rwlock_t *that)
 {
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  that->m_psi= PSI_CALL(init_rwlock)(key, &that->m_rwlock);
+  that->m_psi= PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_rwlock);
 #else
   that->m_psi= NULL;
 #endif
@@ -807,7 +807,7 @@ static inline int inline_mysql_prlock_in
   mysql_prlock_t *that)
 {
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
-  that->m_psi= PSI_CALL(init_rwlock)(key, &that->m_prlock);
+  that->m_psi= PSI_RWLOCK_CALL(init_rwlock)(key, &that->m_prlock);
 #else
   that->m_psi= NULL;
 #endif
@@ -821,7 +821,7 @@ static inline int inline_mysql_rwlock_de
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
   if (that->m_psi != NULL)
   {
-    PSI_CALL(destroy_rwlock)(that->m_psi);
+    PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi);
     that->m_psi= NULL;
   }
 #endif
@@ -835,7 +835,7 @@ static inline int inline_mysql_prlock_de
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
   if (that->m_psi != NULL)
   {
-    PSI_CALL(destroy_rwlock)(that->m_psi);
+    PSI_RWLOCK_CALL(destroy_rwlock)(that->m_psi);
     that->m_psi= NULL;
   }
 #endif
@@ -858,7 +858,7 @@ static inline int inline_mysql_rwlock_rd
     /* Instrumentation start */
     PSI_rwlock_locker *locker;
     PSI_rwlock_locker_state state;
-    locker= PSI_CALL(start_rwlock_rdwait)(&state, that->m_psi,
+    locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi,
                                           PSI_RWLOCK_READLOCK, src_file, src_line);
 
     /* Instrumented code */
@@ -866,7 +866,7 @@ static inline int inline_mysql_rwlock_rd
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_rwlock_rdwait)(locker, result);
+      PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result);
 
     return result;
   }
@@ -894,7 +894,7 @@ static inline int inline_mysql_prlock_rd
     /* Instrumentation start */
     PSI_rwlock_locker *locker;
     PSI_rwlock_locker_state state;
-    locker= PSI_CALL(start_rwlock_rdwait)(&state, that->m_psi,
+    locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi,
                                           PSI_RWLOCK_READLOCK, src_file, src_line);
 
     /* Instrumented code */
@@ -902,7 +902,7 @@ static inline int inline_mysql_prlock_rd
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_rwlock_rdwait)(locker, result);
+      PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result);
 
     return result;
   }
@@ -930,7 +930,7 @@ static inline int inline_mysql_rwlock_wr
     /* Instrumentation start */
     PSI_rwlock_locker *locker;
     PSI_rwlock_locker_state state;
-    locker= PSI_CALL(start_rwlock_wrwait)(&state, that->m_psi,
+    locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi,
                                           PSI_RWLOCK_WRITELOCK, src_file, src_line);
 
     /* Instrumented code */
@@ -938,7 +938,7 @@ static inline int inline_mysql_rwlock_wr
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_rwlock_wrwait)(locker, result);
+      PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result);
 
     return result;
   }
@@ -966,7 +966,7 @@ static inline int inline_mysql_prlock_wr
     /* Instrumentation start */
     PSI_rwlock_locker *locker;
     PSI_rwlock_locker_state state;
-    locker= PSI_CALL(start_rwlock_wrwait)(&state, that->m_psi,
+    locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi,
                                           PSI_RWLOCK_WRITELOCK, src_file, src_line);
 
     /* Instrumented code */
@@ -974,7 +974,7 @@ static inline int inline_mysql_prlock_wr
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_rwlock_wrwait)(locker, result);
+      PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result);
 
     return result;
   }
@@ -1002,7 +1002,7 @@ static inline int inline_mysql_rwlock_tr
     /* Instrumentation start */
     PSI_rwlock_locker *locker;
     PSI_rwlock_locker_state state;
-    locker= PSI_CALL(start_rwlock_rdwait)(&state, that->m_psi,
+    locker= PSI_RWLOCK_CALL(start_rwlock_rdwait)(&state, that->m_psi,
                                           PSI_RWLOCK_TRYREADLOCK, src_file, src_line);
 
     /* Instrumented code */
@@ -1010,7 +1010,7 @@ static inline int inline_mysql_rwlock_tr
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_rwlock_rdwait)(locker, result);
+      PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, result);
 
     return result;
   }
@@ -1037,7 +1037,7 @@ static inline int inline_mysql_rwlock_tr
     /* Instrumentation start */
     PSI_rwlock_locker *locker;
     PSI_rwlock_locker_state state;
-    locker= PSI_CALL(start_rwlock_wrwait)(&state, that->m_psi,
+    locker= PSI_RWLOCK_CALL(start_rwlock_wrwait)(&state, that->m_psi,
                                           PSI_RWLOCK_TRYWRITELOCK, src_file, src_line);
 
     /* Instrumented code */
@@ -1045,7 +1045,7 @@ static inline int inline_mysql_rwlock_tr
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_rwlock_wrwait)(locker, result);
+      PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, result);
 
     return result;
   }
@@ -1063,7 +1063,7 @@ static inline int inline_mysql_rwlock_un
   int result;
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
   if (that->m_psi != NULL)
-    PSI_CALL(unlock_rwlock)(that->m_psi);
+    PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi);
 #endif
   result= rw_unlock(&that->m_rwlock);
   return result;
@@ -1076,7 +1076,7 @@ static inline int inline_mysql_prlock_un
   int result;
 #ifdef HAVE_PSI_RWLOCK_INTERFACE
   if (that->m_psi != NULL)
-    PSI_CALL(unlock_rwlock)(that->m_psi);
+    PSI_RWLOCK_CALL(unlock_rwlock)(that->m_psi);
 #endif
   result= rw_pr_unlock(&that->m_prlock);
   return result;
@@ -1096,7 +1096,7 @@ static inline void inline_mysql_cond_reg
 )
 {
 #ifdef HAVE_PSI_COND_INTERFACE
-  PSI_CALL(register_cond)(category, info, count);
+  PSI_COND_CALL(register_cond)(category, info, count);
 #endif
 }
 
@@ -1108,7 +1108,7 @@ static inline int inline_mysql_cond_init
   const pthread_condattr_t *attr)
 {
 #ifdef HAVE_PSI_COND_INTERFACE
-  that->m_psi= PSI_CALL(init_cond)(key, &that->m_cond);
+  that->m_psi= PSI_COND_CALL(init_cond)(key, &that->m_cond);
 #else
   that->m_psi= NULL;
 #endif
@@ -1121,7 +1121,7 @@ static inline int inline_mysql_cond_dest
 #ifdef HAVE_PSI_COND_INTERFACE
   if (that->m_psi != NULL)
   {
-    PSI_CALL(destroy_cond)(that->m_psi);
+    PSI_COND_CALL(destroy_cond)(that->m_psi);
     that->m_psi= NULL;
   }
 #endif
@@ -1144,7 +1144,7 @@ static inline int inline_mysql_cond_wait
     /* Instrumentation start */
     PSI_cond_locker *locker;
     PSI_cond_locker_state state;
-    locker= PSI_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
+    locker= PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
                                       PSI_COND_WAIT, src_file, src_line);
 
     /* Instrumented code */
@@ -1152,7 +1152,7 @@ static inline int inline_mysql_cond_wait
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_cond_wait)(locker, result);
+      PSI_COND_CALL(end_cond_wait)(locker, result);
 
     return result;
   }
@@ -1181,7 +1181,7 @@ static inline int inline_mysql_cond_time
     /* Instrumentation start */
     PSI_cond_locker *locker;
     PSI_cond_locker_state state;
-    locker= PSI_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
+    locker= PSI_COND_CALL(start_cond_wait)(&state, that->m_psi, mutex->m_psi,
                                       PSI_COND_TIMEDWAIT, src_file, src_line);
 
     /* Instrumented code */
@@ -1189,7 +1189,7 @@ static inline int inline_mysql_cond_time
 
     /* Instrumentation end */
     if (locker != NULL)
-      PSI_CALL(end_cond_wait)(locker, result);
+      PSI_COND_CALL(end_cond_wait)(locker, result);
 
     return result;
   }
@@ -1207,7 +1207,7 @@ static inline int inline_mysql_cond_sign
   int result;
 #ifdef HAVE_PSI_COND_INTERFACE
   if (that->m_psi != NULL)
-    PSI_CALL(signal_cond)(that->m_psi);
+    PSI_COND_CALL(signal_cond)(that->m_psi);
 #endif
   result= pthread_cond_signal(&that->m_cond);
   return result;
@@ -1219,7 +1219,7 @@ static inline int inline_mysql_cond_broa
   int result;
 #ifdef HAVE_PSI_COND_INTERFACE
   if (that->m_psi != NULL)
-    PSI_CALL(broadcast_cond)(that->m_psi);
+    PSI_COND_CALL(broadcast_cond)(that->m_psi);
 #endif
   result= pthread_cond_broadcast(&that->m_cond);
   return result;
@@ -1238,7 +1238,7 @@ static inline void inline_mysql_thread_r
 )
 {
 #ifdef HAVE_PSI_THREAD_INTERFACE
-  PSI_CALL(register_thread)(category, info, count);
+  PSI_THREAD_CALL(register_thread)(category, info, count);
 #endif
 }
 
@@ -1249,14 +1249,14 @@ static inline int inline_mysql_thread_cr
   void *(*start_routine)(void*), void *arg)
 {
   int result;
-  result= PSI_CALL(spawn_thread)(key, thread, attr, start_routine, arg);
+  result= PSI_THREAD_CALL(spawn_thread)(key, thread, attr, start_routine, arg);
   return result;
 }
 
 static inline void inline_mysql_thread_set_psi_id(ulong id)
 {
-  struct PSI_thread *psi= PSI_CALL(get_thread)();
-  PSI_CALL(set_thread_id)(psi, id);
+  struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)();
+  PSI_THREAD_CALL(set_thread_id)(psi, id);
 }
 #endif
 

=== modified file 'include/mysql/psi/psi.h'
--- a/include/mysql/psi/psi.h	2012-05-02 08:36:41 +0000
+++ b/include/mysql/psi/psi.h	2012-05-14 14:05:47 +0000
@@ -2321,7 +2321,54 @@ typedef struct PSI_stage_info_none PSI_s
 
 extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
 
-#define PSI_CALL(M) PSI_server->M
+/*
+  Allow to override PSI_XXX_CALL at compile time
+  with more efficient implementations, if available.
+  If nothing better is available,
+  make a dynamic call using the PSI_server function pointer.
+*/
+
+#ifndef PSI_MUTEX_CALL
+#define PSI_MUTEX_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_RWLOCK_CALL
+#define PSI_RWLOCK_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_COND_CALL
+#define PSI_COND_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_THREAD_CALL
+#define PSI_THREAD_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_FILE_CALL
+#define PSI_FILE_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_SOCKET_CALL
+#define PSI_SOCKET_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_STAGE_CALL
+#define PSI_STAGE_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_STATEMENT_CALL
+#define PSI_STATEMENT_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_TABLE_CALL
+#define PSI_TABLE_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#ifndef PSI_IDLE_CALL
+#define PSI_IDLE_CALL(M) PSI_DYNAMIC_CALL(M)
+#endif
+
+#define PSI_DYNAMIC_CALL(M) PSI_server->M
 
 /** @} */
 

=== modified file 'mysys/my_thr_init.c'
--- a/mysys/my_thr_init.c	2011-09-07 10:08:09 +0000
+++ b/mysys/my_thr_init.c	2012-05-14 14:05:47 +0000
@@ -382,7 +382,7 @@ void my_thread_end(void)
     This must be done before trashing st_my_thread_var,
     because the LF_HASH depends on it.
   */
-  PSI_CALL(delete_current_thread)();
+  PSI_THREAD_CALL(delete_current_thread)();
 #endif
 
   if (tmp && tmp->init)

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2012-05-11 13:26:38 +0000
+++ b/sql/handler.cc	2012-05-14 14:05:47 +0000
@@ -2221,8 +2221,8 @@ int ha_delete_table(THD *thd, handlerton
   if (likely(error == 0))
   {
     my_bool temp_table= (my_bool)is_prefix(alias, tmp_file_prefix);
-    PSI_CALL(drop_table_share)(temp_table, db, strlen(db),
-                               alias, strlen(alias));
+    PSI_TABLE_CALL(drop_table_share)
+      (temp_table, db, strlen(db), alias, strlen(alias));
   }
 #endif
 
@@ -2289,7 +2289,7 @@ void handler::unbind_psi()
     Notify the instrumentation that this table is not owned
     by this thread any more.
   */
-  PSI_CALL(unbind_table)(m_psi);
+  PSI_TABLE_CALL(unbind_table)(m_psi);
 #endif
 }
 
@@ -2301,7 +2301,7 @@ void handler::rebind_psi()
     by this thread.
   */
   PSI_table_share *share_psi= ha_table_share_psi(table_share);
-  m_psi= PSI_CALL(rebind_table)(share_psi, this, m_psi);
+  m_psi= PSI_TABLE_CALL(rebind_table)(share_psi, this, m_psi);
 #endif
 }
 
@@ -2353,7 +2353,7 @@ int handler::ha_open(TABLE *table_arg, c
     DBUG_ASSERT(table_share != NULL);
 #ifdef HAVE_PSI_TABLE_INTERFACE
     PSI_table_share *share_psi= ha_table_share_psi(table_share);
-    m_psi= PSI_CALL(open_table)(share_psi, this);
+    m_psi= PSI_TABLE_CALL(open_table)(share_psi, this);
 #endif
 
     if (table->s->db_options_in_use & HA_OPTION_READ_ONLY_DATA)
@@ -2383,7 +2383,7 @@ int handler::ha_close(void)
 {
   DBUG_ENTER("handler::ha_close");
 #ifdef HAVE_PSI_TABLE_INTERFACE
-  PSI_CALL(close_table)(m_psi);
+  PSI_TABLE_CALL(close_table)(m_psi);
   m_psi= NULL; /* instrumentation handle, invalid after close_table() */
 #endif
   DBUG_ASSERT(m_psi == NULL);
@@ -4481,7 +4481,7 @@ int ha_create_table(THD *thd, const char
     goto err;
 
 #ifdef HAVE_PSI_TABLE_INTERFACE
-  share.m_psi= PSI_CALL(get_table_share)(temp_table, &share);
+  share.m_psi= PSI_TABLE_CALL(get_table_share)(temp_table, &share);
 #endif
 
   if (open_table_from_share(thd, &share, "", 0, (uint) READ_ALL, 0, &table,
@@ -4500,8 +4500,8 @@ int ha_create_table(THD *thd, const char
     strxmov(name_buff, db, ".", table_name, NullS);
     my_error(ER_CANT_CREATE_TABLE, MYF(ME_BELL+ME_WAITTANG), name_buff, error);
 #ifdef HAVE_PSI_TABLE_INTERFACE
-    PSI_CALL(drop_table_share)(temp_table, db, strlen(db), table_name,
-                               strlen(table_name));
+    PSI_TABLE_CALL(drop_table_share)
+      (temp_table, db, strlen(db), table_name, strlen(table_name));
 #endif
   }
 err:

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2012-05-09 16:53:03 +0000
+++ b/sql/mysqld.cc	2012-05-14 14:05:47 +0000
@@ -2412,7 +2412,7 @@ static bool block_until_new_connection()
       Delete the instrumentation for the job that just completed,
       before blocking this pthread (blocked on COND_thread_cache).
     */
-    PSI_CALL(delete_current_thread)();
+    PSI_THREAD_CALL(delete_current_thread)();
 #endif
 
     // Block pthread
@@ -2439,9 +2439,9 @@ static bool block_until_new_connection()
         Create new instrumentation for the new THD job,
         and attach it to this running pthread.
       */
-      PSI_thread *psi= PSI_CALL(new_thread)(key_thread_one_connection,
-                                            thd, thd->thread_id);
-      PSI_CALL(set_thread)(psi);
+      PSI_thread *psi= PSI_THREAD_CALL(new_thread)
+        (key_thread_one_connection, thd, thd->thread_id);
+      PSI_THREAD_CALL(set_thread)(psi);
 #endif
 
       /*
@@ -2932,7 +2932,7 @@ pthread_handler_t signal_hand(void *arg
         abort_loop=1;       // mark abort for threads
 #ifdef HAVE_PSI_THREAD_INTERFACE
         /* Delete the instrumentation for the signal thread */
-        PSI_CALL(delete_current_thread)();
+        PSI_THREAD_CALL(delete_current_thread)();
 #endif
 #ifdef USE_ONE_SIGNAL_HAND
         pthread_t tmp;
@@ -4927,8 +4927,8 @@ int mysqld_main(int argc, char **argv)
       */
       init_server_psi_keys();
       /* Instrument the main thread */
-      PSI_thread *psi= PSI_CALL(new_thread)(key_thread_main, NULL, 0);
-      PSI_CALL(set_thread)(psi);
+      PSI_thread *psi= PSI_THREAD_CALL(new_thread)(key_thread_main, NULL, 0);
+      PSI_THREAD_CALL(set_thread)(psi);
 
       /*
         Now that some instrumentation is in place,
@@ -5316,7 +5316,7 @@ int mysqld_main(int argc, char **argv)
     Disable the main thread instrumentation,
     to avoid recording events during the shutdown.
   */
-  PSI_CALL(delete_current_thread)();
+  PSI_THREAD_CALL(delete_current_thread)();
 #endif
 
   /* Wait until cleanup is done */

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	2012-04-26 10:33:24 +0000
+++ b/sql/sql_acl.cc	2012-05-14 14:05:47 +0000
@@ -9719,10 +9719,9 @@ acl_authenticate(THD *thd, uint com_chan
     my_ok(thd);
 
 #ifdef HAVE_PSI_THREAD_INTERFACE
-  PSI_CALL(set_thread_user_host)(thd->main_security_ctx.user,
-                                 strlen(thd->main_security_ctx.user),
-                                 thd->main_security_ctx.host_or_ip,
-                                 strlen(thd->main_security_ctx.host_or_ip));
+  PSI_THREAD_CALL(set_thread_user_host)
+    (thd->main_security_ctx.user, strlen(thd->main_security_ctx.user),
+    thd->main_security_ctx.host_or_ip, strlen(thd->main_security_ctx.host_or_ip));
 #endif
 
   /* Ready to handle queries */

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2012-05-11 13:26:38 +0000
+++ b/sql/sql_base.cc	2012-05-14 14:05:47 +0000
@@ -663,7 +663,7 @@ TABLE_SHARE *get_table_share(THD *thd, T
   share->ref_count++;				// Mark in use
 
 #ifdef HAVE_PSI_TABLE_INTERFACE
-  share->m_psi= PSI_CALL(get_table_share)(false, share);
+  share->m_psi= PSI_TABLE_CALL(get_table_share)(false, share);
 #else
   share->m_psi= NULL;
 #endif
@@ -6163,7 +6163,7 @@ TABLE *open_table_uncached(THD *thd, con
   }
 
 #ifdef HAVE_PSI_TABLE_INTERFACE
-  share->m_psi= PSI_CALL(get_table_share)(true, share);
+  share->m_psi= PSI_TABLE_CALL(get_table_share)(true, share);
 #else
   share->m_psi= NULL;
 #endif

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2012-05-09 16:53:03 +0000
+++ b/sql/sql_class.cc	2012-05-14 14:05:47 +0000
@@ -347,9 +347,8 @@ void thd_new_connection_setup(THD *thd,
   mysql_mutex_assert_owner(&LOCK_thread_count);
 #ifdef HAVE_PSI_INTERFACE
   thd_set_psi(thd,
-              PSI_CALL(new_thread)(key_thread_one_connection,
-                                   thd,
-                                   thd->thread_id));
+              PSI_THREAD_CALL(new_thread)
+                (key_thread_one_connection, thd, thd->thread_id));
 #endif
   thd->set_time();
   thd->prior_thr_create_utime= thd->thr_create_utime= thd->start_utime=
@@ -563,7 +562,7 @@ void THD::enter_stage(const PSI_stage_in
     proc_info= msg;
 
 #ifdef HAVE_PSI_THREAD_INTERFACE
-    PSI_CALL(set_thread_state)(msg);
+    PSI_THREAD_CALL(set_thread_state)(msg);
     MYSQL_SET_STAGE(m_current_stage_key, calling_file, calling_line);
 #endif
   }
@@ -4160,7 +4159,7 @@ void THD::inc_status_created_tmp_disk_ta
 {
   status_var_increment(status_var.created_tmp_disk_tables);
 #ifdef HAVE_PSI_STATEMENT_INTERFACE
-  PSI_CALL(inc_statement_created_tmp_disk_tables)(m_statement_psi, 1);
+  PSI_STATEMENT_CALL(inc_statement_created_tmp_disk_tables)(m_statement_psi, 1);
 #endif
 }
 
@@ -4168,7 +4167,7 @@ void THD::inc_status_created_tmp_tables(
 {
   status_var_increment(status_var.created_tmp_tables);
 #ifdef HAVE_PSI_STATEMENT_INTERFACE
-  PSI_CALL(inc_statement_created_tmp_tables)(m_statement_psi, 1);
+  PSI_STATEMENT_CALL(inc_statement_created_tmp_tables)(m_statement_psi, 1);
 #endif
 }
 
@@ -4176,7 +4175,7 @@ void THD::inc_status_select_full_join()
 {
   status_var_increment(status_var.select_full_join_count);
 #ifdef HAVE_PSI_STATEMENT_INTERFACE
-  PSI_CALL(inc_statement_select_full_join)(m_statement_psi, 1);
+  PSI_STATEMENT_CALL(inc_statement_select_full_join)(m_statement_psi, 1);
 #endif
 }
 
@@ -4184,7 +4183,7 @@ void THD::inc_status_select_full_range_j
 {
   status_var_increment(status_var.select_full_range_join_count);
 #ifdef HAVE_PSI_STATEMENT_INTERFACE
-  PSI_CALL(inc_statement_select_full_range_join)(m_statement_psi, 1);
+  PSI_STATEMENT_CALL(inc_statement_select_full_range_join)(m_statement_psi, 1);
 #endif
 }
 
@@ -4192,7 +4191,7 @@ void THD::inc_status_select_range()
 {
   status_var_increment(status_var.select_range_count);
 #ifdef HAVE_PSI_STATEMENT_INTERFACE
-  PSI_CALL(inc_statement_select_range)(m_statement_psi, 1);
+  PSI_STATEMENT_CALL(inc_statement_select_range)(m_statement_psi, 1);
 #endif
 }
 
@@ -4200,7 +4199,7 @@ void THD::inc_status_select_range_check(
 {
   status_var_increment(status_var.select_range_check_count);
 #ifdef HAVE_PSI_STATEMENT_INTERFACE
-  PSI_CALL(inc_statement_select_range_check)(m_statement_psi, 1);
+  PSI_STATEMENT_CALL(inc_statement_select_range_check)(m_statement_psi, 1);
 #endif
 }
 
@@ -4208,7 +4207,7 @@ void THD::inc_status_select_scan()
 {
   status_var_increment(status_var.select_scan_count);
 #ifdef HAVE_PSI_STATEMENT_INTERFACE
-  PSI_CALL(inc_statement_select_scan)(m_statement_psi, 1);
+  PSI_STATEMENT_CALL(inc_statement_select_scan)(m_statement_psi, 1);
 #endif
 }
 
@@ -4216,7 +4215,7 @@ void THD::inc_status_sort_merge_passes()
 {
   status_var_increment(status_var.filesort_merge_passes);
 #ifdef HAVE_PSI_STATEMENT_INTERFACE
-  PSI_CALL(inc_statement_sort_merge_passes)(m_statement_psi, 1);
+  PSI_STATEMENT_CALL(inc_statement_sort_merge_passes)(m_statement_psi, 1);
 #endif
 }
 
@@ -4224,7 +4223,7 @@ void THD::inc_status_sort_range()
 {
   status_var_increment(status_var.filesort_range_count);
 #ifdef HAVE_PSI_STATEMENT_INTERFACE
-  PSI_CALL(inc_statement_sort_range)(m_statement_psi, 1);
+  PSI_STATEMENT_CALL(inc_statement_sort_range)(m_statement_psi, 1);
 #endif
 }
 
@@ -4232,7 +4231,7 @@ void THD::inc_status_sort_rows(ha_rows c
 {
   statistic_add(status_var.filesort_rows, count, &LOCK_status);
 #ifdef HAVE_PSI_STATEMENT_INTERFACE
-  PSI_CALL(inc_statement_sort_rows)(m_statement_psi, count);
+  PSI_STATEMENT_CALL(inc_statement_sort_rows)(m_statement_psi, count);
 #endif
 }
 
@@ -4240,7 +4239,7 @@ void THD::inc_status_sort_scan()
 {
   status_var_increment(status_var.filesort_scan_count);
 #ifdef HAVE_PSI_STATEMENT_INTERFACE
-  PSI_CALL(inc_statement_sort_scan)(m_statement_psi, 1);
+  PSI_STATEMENT_CALL(inc_statement_sort_scan)(m_statement_psi, 1);
 #endif
 }
 
@@ -4248,7 +4247,7 @@ void THD::set_status_no_index_used()
 {
   server_status|= SERVER_QUERY_NO_INDEX_USED;
 #ifdef HAVE_PSI_STATEMENT_INTERFACE
-  PSI_CALL(set_statement_no_index_used)(m_statement_psi);
+  PSI_STATEMENT_CALL(set_statement_no_index_used)(m_statement_psi);
 #endif
 }
 
@@ -4256,7 +4255,7 @@ void THD::set_status_no_good_index_used(
 {
   server_status|= SERVER_QUERY_NO_GOOD_INDEX_USED;
 #ifdef HAVE_PSI_STATEMENT_INTERFACE
-  PSI_CALL(set_statement_no_good_index_used)(m_statement_psi);
+  PSI_STATEMENT_CALL(set_statement_no_good_index_used)(m_statement_psi);
 #endif
 }
 
@@ -4264,7 +4263,7 @@ void THD::set_command(enum enum_server_c
 {
   m_command= command;
 #ifdef HAVE_PSI_THREAD_INTERFACE
-  PSI_CALL(set_thread_command)(m_command);
+  PSI_STATEMENT_CALL(set_thread_command)(m_command);
 #endif
 }
 
@@ -4278,7 +4277,7 @@ void THD::set_query(const CSET_STRING &s
   mysql_mutex_unlock(&LOCK_thd_data);
 
 #ifdef HAVE_PSI_THREAD_INTERFACE
-  PSI_CALL(set_thread_info)(query(), query_length());
+  PSI_THREAD_CALL(set_thread_info)(query(), query_length());
 #endif
 }
 

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2012-05-11 13:26:38 +0000
+++ b/sql/sql_class.h	2012-05-14 14:05:47 +0000
@@ -3226,14 +3226,14 @@ public:
       my_micro_time_to_timeval(start_utime, &start_time);
 
 #ifdef HAVE_PSI_THREAD_INTERFACE
-    PSI_CALL(set_thread_start_time)(start_time.tv_sec);
+    PSI_THREAD_CALL(set_thread_start_time)(start_time.tv_sec);
 #endif
   }
   inline void set_current_time()
   {
     my_micro_time_to_timeval(my_micro_time(), &start_time);
 #ifdef HAVE_PSI_THREAD_INTERFACE
-    PSI_CALL(set_thread_start_time)(start_time.tv_sec);
+    PSI_THREAD_CALL(set_thread_start_time)(start_time.tv_sec);
 #endif
   }
   inline void set_time(const struct timeval *t)
@@ -3241,7 +3241,7 @@ public:
     start_time= user_time= *t;
     start_utime= utime_after_lock= my_micro_time();
 #ifdef HAVE_PSI_THREAD_INTERFACE
-    PSI_CALL(set_thread_start_time)(start_time.tv_sec);
+    PSI_THREAD_CALL(set_thread_start_time)(start_time.tv_sec);
 #endif
   }
   /*TODO: this will be obsolete when we have support for 64 bit my_time_t */
@@ -3688,7 +3688,7 @@ public:
     result= new_db && !db;
 #ifdef HAVE_PSI_THREAD_INTERFACE
     if (result)
-      PSI_CALL(set_thread_db)(new_db, static_cast<int>(new_db_len));
+      PSI_THREAD_CALL(set_thread_db)(new_db, static_cast<int>(new_db_len));
 #endif
     return result;
   }
@@ -3709,7 +3709,7 @@ public:
     db= new_db;
     db_length= new_db_len;
 #ifdef HAVE_PSI_THREAD_INTERFACE
-    PSI_CALL(set_thread_db)(new_db, static_cast<int>(new_db_len));
+    PSI_THREAD_CALL(set_thread_db)(new_db, static_cast<int>(new_db_len));
 #endif
   }
   /*

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2012-05-09 16:47:39 +0000
+++ b/sql/sql_table.cc	2012-05-14 14:05:47 +0000
@@ -2477,8 +2477,8 @@ int mysql_rm_table_no_locks(THD *thd, TA
                                     table->table_name););
 #ifdef HAVE_PSI_TABLE_INTERFACE
     if (drop_temporary && likely(error == 0))
-      PSI_CALL(drop_table_share)(true, table->db, table->db_length,
-                                 table->table_name, table->table_name_length);
+      PSI_TABLE_CALL(drop_table_share)
+        (true, table->db, table->db_length, table->table_name, table->table_name_length);
 #endif
   }
   DEBUG_SYNC(thd, "rm_table_no_locks_before_binlog");
@@ -4849,8 +4849,8 @@ mysql_rename_table(handlerton *base, con
   if (likely(error == 0))
   {
     my_bool temp_table= (my_bool)is_prefix(old_name, tmp_file_prefix);
-    PSI_CALL(drop_table_share)(temp_table, old_db, strlen(old_db),
-                               old_name, strlen(old_name));
+    PSI_TABLE_CALL(drop_table_share)
+      (temp_table, old_db, strlen(old_db), old_name, strlen(old_name));
   }
 #endif
 

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2012-05-11 12:05:39 +0000
+++ b/sql/table.cc	2012-05-14 14:05:47 +0000
@@ -469,7 +469,7 @@ void TABLE_SHARE::destroy()
   }
 
 #ifdef HAVE_PSI_TABLE_INTERFACE
-  PSI_CALL(release_table_share)(m_psi);
+  PSI_TABLE_CALL(release_table_share)(m_psi);
 #endif
 
   /*

=== modified file 'storage/innobase/include/os0file.h'
--- a/storage/innobase/include/os0file.h	2012-02-17 14:51:29 +0000
+++ b/storage/innobase/include/os0file.h	2012-05-14 14:05:47 +0000
@@ -217,10 +217,10 @@ used to register actual file read, write
 # define register_pfs_file_open_begin(state, locker, key, op, name,	\
 				      src_file, src_line)		\
 do {									\
-	locker = PSI_CALL(get_thread_file_name_locker)(			\
+	locker = PSI_FILE_CALL(get_thread_file_name_locker)(		\
 		state, key, op, name, &locker);				\
 	if (UNIV_LIKELY(locker != NULL)) {				\
-		PSI_CALL(start_file_open_wait)(				\
+		PSI_FILE_CALL(start_file_open_wait)(			\
 			locker, src_file, src_line);			\
 	}								\
 } while (0)
@@ -228,7 +228,7 @@ do {									\
 # define register_pfs_file_open_end(locker, file)			\
 do {									\
 	if (UNIV_LIKELY(locker != NULL)) {				\
-		PSI_CALL(end_file_open_wait_and_bind_to_descriptor)(	\
+		PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(\
 			locker, file);					\
 	}								\
 } while (0)
@@ -236,10 +236,10 @@ do {									\
 # define register_pfs_file_io_begin(state, locker, file, count, op,	\
 				    src_file, src_line)			\
 do {									\
-	locker = PSI_CALL(get_thread_file_descriptor_locker)(		\
+	locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(	\
 		state, file, op);					\
 	if (UNIV_LIKELY(locker != NULL)) {				\
-		PSI_CALL(start_file_wait)(				\
+		PSI_FILE_CALL(start_file_wait)(				\
 			locker, count, src_file, src_line);		\
 	}								\
 } while (0)
@@ -247,7 +247,7 @@ do {									\
 # define register_pfs_file_io_end(locker, count)			\
 do {									\
 	if (UNIV_LIKELY(locker != NULL)) {				\
-		PSI_CALL(end_file_wait)(locker, count);			\
+		PSI_FILE_CALL(end_file_wait)(locker, count);		\
 	}								\
 } while (0)
 #endif /* UNIV_PFS_IO  */

=== modified file 'storage/innobase/include/os0sync.ic'
--- a/storage/innobase/include/os0sync.ic	2012-01-09 08:24:27 +0000
+++ b/storage/innobase/include/os0sync.ic	2012-05-14 14:05:47 +0000
@@ -66,7 +66,7 @@ pfs_os_fast_mutex_init(
 	os_fast_mutex_t*	fast_mutex)	/*!< out: fast mutex */
 {
 #ifdef HAVE_PSI_MUTEX_INTERFACE
-	fast_mutex->pfs_psi = PSI_CALL(init_mutex)(key, &fast_mutex->mutex);
+	fast_mutex->pfs_psi = PSI_MUTEX_CALL(init_mutex)(key, &fast_mutex->mutex);
 #else
 	fast_mutex->pfs_psi = NULL;
 #endif
@@ -86,7 +86,7 @@ pfs_os_fast_mutex_free(
 {
 #ifdef HAVE_PSI_MUTEX_INTERFACE
 	if (fast_mutex->pfs_psi != NULL)
-		PSI_CALL(destroy_mutex)(fast_mutex->pfs_psi);
+		PSI_MUTEX_CALL(destroy_mutex)(fast_mutex->pfs_psi);
 #endif
 	fast_mutex->pfs_psi = NULL;
 
@@ -112,13 +112,13 @@ pfs_os_fast_mutex_lock(
 		PSI_mutex_locker* 	locker;
 		PSI_mutex_locker_state	state;
 
-		locker = PSI_CALL(start_mutex_wait)(&state, fast_mutex->pfs_psi,
+		locker = PSI_MUTEX_CALL(start_mutex_wait)(&state, fast_mutex->pfs_psi,
 			PSI_MUTEX_LOCK, file_name, line);
 
 		os_fast_mutex_lock_func(&fast_mutex->mutex);
 
 		if (locker != NULL)
-			PSI_CALL(end_mutex_wait)(locker, 0);
+			PSI_MUTEX_CALL(end_mutex_wait)(locker, 0);
 	}
 	else
 #endif
@@ -141,7 +141,7 @@ pfs_os_fast_mutex_unlock(
 {
 #ifdef HAVE_PSI_MUTEX_INTERFACE
 	if (fast_mutex->pfs_psi != NULL)
-		PSI_CALL(unlock_mutex)(fast_mutex->pfs_psi);
+		PSI_MUTEX_CALL(unlock_mutex)(fast_mutex->pfs_psi);
 #endif
 
 	os_fast_mutex_unlock_func(&fast_mutex->mutex);

=== modified file 'storage/innobase/include/srv0srv.h'
--- a/storage/innobase/include/srv0srv.h	2012-05-04 00:07:22 +0000
+++ b/storage/innobase/include/srv0srv.h	2012-05-14 14:05:47 +0000
@@ -431,14 +431,14 @@ extern mysql_pfs_key_t	srv_purge_thread_
 schema */
 #  define pfs_register_thread(key)			\
 do {								\
-	struct PSI_thread* psi = PSI_CALL(new_thread)(key, NULL, 0);\
-	PSI_CALL(set_thread)(psi);				\
+	struct PSI_thread* psi = PSI_THREAD_CALL(new_thread)(key, NULL, 0);\
+	PSI_THREAD_CALL(set_thread)(psi);			\
 } while (0)
 
 /* This macro delist the current thread from performance schema */
 #  define pfs_delete_thread()				\
 do {								\
-	PSI_CALL(delete_current_thread)();			\
+	PSI_THREAD_CALL(delete_current_thread)();		\
 } while (0)
 # endif /* UNIV_PFS_THREAD */
 

=== modified file 'storage/innobase/include/sync0rw.ic'
--- a/storage/innobase/include/sync0rw.ic	2012-03-16 10:01:17 +0000
+++ b/storage/innobase/include/sync0rw.ic	2012-05-14 14:05:47 +0000
@@ -588,7 +588,7 @@ pfs_rw_lock_create_func(
 	ulint		cline)		/*!< in: file line where created */
 {
 	/* Initialize the rwlock for performance schema */
-	lock->pfs_psi = PSI_CALL(init_rwlock)(key, lock);
+	lock->pfs_psi = PSI_RWLOCK_CALL(init_rwlock)(key, lock);
 
 	/* The actual function to initialize an rwlock */
 	rw_lock_create_func(lock,
@@ -621,13 +621,13 @@ pfs_rw_lock_x_lock_func(
 		PSI_rwlock_locker_state	state;
 
 		/* Record the entry of rw x lock request in performance schema */
-		locker = PSI_CALL(start_rwlock_wrwait)(
+		locker = PSI_RWLOCK_CALL(start_rwlock_wrwait)(
 			&state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK, file_name, line);
 
 		rw_lock_x_lock_func(lock, pass, file_name, line);
 
 		if (locker != NULL)
-			PSI_CALL(end_rwlock_wrwait)(locker, 0);
+			PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, 0);
 	}
 	else
 	{
@@ -657,13 +657,13 @@ pfs_rw_lock_x_lock_func_nowait(
 		PSI_rwlock_locker_state		state;
 
 		/* Record the entry of rw x lock request in performance schema */
-		locker = PSI_CALL(start_rwlock_wrwait)(
+		locker = PSI_RWLOCK_CALL(start_rwlock_wrwait)(
 			&state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK, file_name, line);
 
 		ret = rw_lock_x_lock_func_nowait(lock, file_name, line);
 
 		if (locker != NULL)
-			PSI_CALL(end_rwlock_wrwait)(locker, ret);
+			PSI_RWLOCK_CALL(end_rwlock_wrwait)(locker, ret);
 	}
 	else
 	{
@@ -684,7 +684,7 @@ pfs_rw_lock_free_func(
 {
 	if (lock->pfs_psi != NULL)
 	{
-		PSI_CALL(destroy_rwlock)(lock->pfs_psi);
+		PSI_RWLOCK_CALL(destroy_rwlock)(lock->pfs_psi);
 		lock->pfs_psi = NULL;
 	}
 
@@ -712,13 +712,13 @@ pfs_rw_lock_s_lock_func(
 		PSI_rwlock_locker_state	state;
 
 		/* Instrumented to inform we are aquiring a shared rwlock */
-		locker = PSI_CALL(start_rwlock_rdwait)(
+		locker = PSI_RWLOCK_CALL(start_rwlock_rdwait)(
 			&state, lock->pfs_psi, PSI_RWLOCK_READLOCK, file_name, line);
 
 		rw_lock_s_lock_func(lock, pass, file_name, line);
 
 		if (locker != NULL)
-			PSI_CALL(end_rwlock_rdwait)(locker, 0);
+			PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, 0);
 	}
 	else
 	{
@@ -751,13 +751,13 @@ pfs_rw_lock_s_lock_low(
 		PSI_rwlock_locker_state	state;
 
 		/* Instrumented to inform we are aquiring a shared rwlock */
-		locker = PSI_CALL(start_rwlock_rdwait)(
+		locker = PSI_RWLOCK_CALL(start_rwlock_rdwait)(
 			&state, lock->pfs_psi, PSI_RWLOCK_READLOCK, file_name, line);
 
 		ret = rw_lock_s_lock_low(lock, pass, file_name, line);
 
 		if (locker != NULL)
-			PSI_CALL(end_rwlock_rdwait)(locker, ret);
+			PSI_RWLOCK_CALL(end_rwlock_rdwait)(locker, ret);
 	}
 	else
 	{
@@ -784,7 +784,7 @@ pfs_rw_lock_x_unlock_func(
 {
 	/* Inform performance schema we are unlocking the lock */
 	if (lock->pfs_psi != NULL)
-		PSI_CALL(unlock_rwlock)(lock->pfs_psi);
+		PSI_RWLOCK_CALL(unlock_rwlock)(lock->pfs_psi);
 
 	rw_lock_x_unlock_func(
 #ifdef UNIV_SYNC_DEBUG
@@ -810,7 +810,7 @@ pfs_rw_lock_s_unlock_func(
 {
 	/* Inform performance schema we are unlocking the lock */
 	if (lock->pfs_psi != NULL)
-		PSI_CALL(unlock_rwlock)(lock->pfs_psi);
+		PSI_RWLOCK_CALL(unlock_rwlock)(lock->pfs_psi);
 
 	rw_lock_s_unlock_func(
 #ifdef UNIV_SYNC_DEBUG

=== modified file 'storage/innobase/include/sync0sync.ic'
--- a/storage/innobase/include/sync0sync.ic	2012-05-04 09:42:14 +0000
+++ b/storage/innobase/include/sync0sync.ic	2012-05-14 14:05:47 +0000
@@ -238,14 +238,14 @@ pfs_mutex_enter_func(
 		PSI_mutex_locker*	locker;
 		PSI_mutex_locker_state	state;
 
-		locker = PSI_CALL(start_mutex_wait)(
+		locker = PSI_MUTEX_CALL(start_mutex_wait)(
 			&state, mutex->pfs_psi,
 			PSI_MUTEX_LOCK, file_name, line);
 
 		mutex_enter_func(mutex, file_name, line);
 
 		if (locker != NULL) {
-			PSI_CALL(end_mutex_wait)(locker, 0);
+			PSI_MUTEX_CALL(end_mutex_wait)(locker, 0);
 		}
 	} else {
 		mutex_enter_func(mutex, file_name, line);
@@ -273,14 +273,14 @@ pfs_mutex_enter_nowait_func(
 		PSI_mutex_locker*	locker;
 		PSI_mutex_locker_state		state;
 
-		locker = PSI_CALL(start_mutex_wait)(
+		locker = PSI_MUTEX_CALL(start_mutex_wait)(
 			&state, mutex->pfs_psi,
 			PSI_MUTEX_TRYLOCK, file_name, line);
 
 		ret = mutex_enter_nowait_func(mutex, file_name, line);
 
 		if (locker != NULL) {
-			PSI_CALL(end_mutex_wait)(locker, (int) ret);
+			PSI_MUTEX_CALL(end_mutex_wait)(locker, (int) ret);
 		}
 	} else {
 		ret = mutex_enter_nowait_func(mutex, file_name, line);
@@ -301,7 +301,7 @@ pfs_mutex_exit_func(
 	mutex_t*	mutex)	/*!< in: pointer to mutex */
 {
 	if (mutex->pfs_psi != NULL) {
-		PSI_CALL(unlock_mutex)(mutex->pfs_psi);
+		PSI_MUTEX_CALL(unlock_mutex)(mutex->pfs_psi);
 	}
 
 	mutex_exit_func(mutex);
@@ -328,7 +328,7 @@ pfs_mutex_create_func(
 	const char*	cfile_name,	/*!< in: file name where created */
 	ulint		cline)		/*!< in: file line where created */
 {
-	mutex->pfs_psi = PSI_CALL(init_mutex)(key, mutex);
+	mutex->pfs_psi = PSI_MUTEX_CALL(init_mutex)(key, mutex);
 
 	mutex_create_func(mutex,
 # ifdef UNIV_DEBUG
@@ -353,7 +353,7 @@ pfs_mutex_free_func(
 	mutex_t*	mutex)	/*!< in: mutex */
 {
 	if (mutex->pfs_psi != NULL) {
-		PSI_CALL(destroy_mutex)(mutex->pfs_psi);
+		PSI_MUTEX_CALL(destroy_mutex)(mutex->pfs_psi);
 		mutex->pfs_psi = NULL;
 	}
 

=== modified file 'storage/perfschema/unittest/pfs_benchmark-t.cc'
--- a/storage/perfschema/unittest/pfs_benchmark-t.cc	2012-03-02 10:48:32 +0000
+++ b/storage/perfschema/unittest/pfs_benchmark-t.cc	2012-05-14 14:05:47 +0000
@@ -450,9 +450,9 @@ void benchmark_create_table_share(uint c
     start_some_work();
     for (i= 0 ; i<count; i++)
     {
-      that= PSI_CALL(get_table_share)(false, &table_share);
+      that= PSI_TABLE_CALL(get_table_share)(false, &table_share);
       do_some_work();
-      PSI_CALL(drop_table_share)(false,
+      PSI_TABLE_CALL(drop_table_share)(false,
                                  table_share.db.str, table_share.db.length,
                                  table_share.table_name.str, table_share.table_name.length);
     }
@@ -488,14 +488,14 @@ void benchmark_find_table_share(uint cou
 
     uint i;
     start_some_work();
-    that_1= PSI_CALL(get_table_share)(false, &table_share);
+    that_1= PSI_TABLE_CALL(get_table_share)(false, &table_share);
     for (i= 0 ; i<count; i++)
     {
-      that_2= PSI_CALL(get_table_share)(false, &table_share);
+      that_2= PSI_TABLE_CALL(get_table_share)(false, &table_share);
       do_some_work();
-      PSI_CALL(release_table_share)(that_2);
+      PSI_TABLE_CALL(release_table_share)(that_2);
     }
-    PSI_CALL(drop_table_share)(false,
+    PSI_TABLE_CALL(drop_table_share)(false,
                                table_share.db.str, table_share.db.length,
                                table_share.table_name.str, table_share.table_name.length);
 
@@ -524,7 +524,7 @@ void benchmark_open_table(uint count, co
     fake_TABLE_SHARE(& table_share, alive);
 
     PSI_table_share *that_share;
-    that_share= PSI_CALL(get_table_share)(false, &table_share);
+    that_share= PSI_TABLE_CALL(get_table_share)(false, &table_share);
 
     PSI_table *that;
     timer_start= my_timer_cycles();
@@ -533,15 +533,15 @@ void benchmark_open_table(uint count, co
     start_some_work();
     for (i= 0 ; i<count; i++)
     {
-      that= PSI_CALL(open_table)(that_share, NULL);
+      that= PSI_TABLE_CALL(open_table)(that_share, NULL);
       do_some_work();
-      PSI_CALL(close_table)(that);
+      PSI_TABLE_CALL(close_table)(that);
     }
 
     timer_end= my_timer_cycles();
     timer_cycles= timer_end-timer_start;
 
-    PSI_CALL(drop_table_share)(false,
+    PSI_TABLE_CALL(drop_table_share)(false,
                                table_share.db.str, table_share.db.length,
                                table_share.table_name.str, table_share.table_name.length);
 
@@ -568,10 +568,10 @@ void benchmark_table_io(uint count, cons
     fake_TABLE_SHARE(& table_share, alive);
 
     PSI_table_share *that_share;
-    that_share= PSI_CALL(get_table_share)(false, &table_share);
+    that_share= PSI_TABLE_CALL(get_table_share)(false, &table_share);
 
     PSI_table *that;
-    that= PSI_CALL(open_table)(that_share, NULL);
+    that= PSI_TABLE_CALL(open_table)(that_share, NULL);
 
     timer_start= my_timer_cycles();
 
@@ -587,8 +587,8 @@ void benchmark_table_io(uint count, cons
     timer_cycles= timer_end-timer_start;
     // ok(get_work_done() == count, "work done");
 
-    PSI_CALL(close_table)(that);
-    PSI_CALL(drop_table_share)(false,
+    PSI_TABLE_CALL(close_table)(that);
+    PSI_TABLE_CALL(drop_table_share)(false,
                                table_share.db.str, table_share.db.length,
                                table_share.table_name.str, table_share.table_name.length);
 
@@ -613,10 +613,10 @@ void benchmark_table_lock(uint count, co
     fake_TABLE_SHARE(& table_share, alive);
 
     PSI_table_share *that_share;
-    that_share= PSI_CALL(get_table_share)(false, &table_share);
+    that_share= PSI_TABLE_CALL(get_table_share)(false, &table_share);
 
     PSI_table *that;
-    that= PSI_CALL(open_table)(that_share, NULL);
+    that= PSI_TABLE_CALL(open_table)(that_share, NULL);
 
     timer_start= my_timer_cycles();
 
@@ -632,8 +632,8 @@ void benchmark_table_lock(uint count, co
     timer_cycles= timer_end-timer_start;
     // ok(get_work_done() == count, "work done");
 
-    PSI_CALL(close_table)(that);
-    PSI_CALL(drop_table_share)(false,
+    PSI_TABLE_CALL(close_table)(that);
+    PSI_TABLE_CALL(drop_table_share)(false,
                                table_share.db.str, table_share.db.length,
                                table_share.table_name.str, table_share.table_name.length);
 
@@ -658,7 +658,7 @@ void benchmark_table_pk_fetch(uint count
     fake_TABLE_SHARE(& table_share, alive);
 
     PSI_table_share *that_share;
-    that_share= PSI_CALL(get_table_share)(false, &table_share);
+    that_share= PSI_TABLE_CALL(get_table_share)(false, &table_share);
 
     uint i;
 
@@ -670,7 +670,7 @@ void benchmark_table_pk_fetch(uint count
       start_some_work();
 
       PSI_table *that;
-      that= PSI_CALL(open_table)(that_share, NULL);
+      that= PSI_TABLE_CALL(open_table)(that_share, NULL);
 
       MYSQL_TABLE_LOCK_WAIT(that, PSI_TABLE_EXTERNAL_LOCK, F_RDLCK,
         { do_some_work(); })
@@ -681,14 +681,14 @@ void benchmark_table_pk_fetch(uint count
       MYSQL_TABLE_IO_WAIT(that, PSI_TABLE_FETCH_ROW, MAX_KEY, 0,
         { do_some_work(); })
 
-      PSI_CALL(close_table)(that);
+      PSI_TABLE_CALL(close_table)(that);
     }
 
     // STOP TEST
     timer_end= my_timer_cycles();
     timer_cycles= timer_end-timer_start;
 
-    PSI_CALL(drop_table_share)(false,
+    PSI_TABLE_CALL(drop_table_share)(false,
                                table_share.db.str, table_share.db.length,
                                table_share.table_name.str, table_share.table_name.length);
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-pfs-tuning branch (marc.alff:3509 to 3510) Marc Alff16 May