3836 Marc Alff 2012-05-15
Bug#12346211 - PERF IMPACT OF PERFORMANCE-SCHEMA WITH DISABLED INSTRUMENTS/CONSUMERS
This changeset implement various performance improvements implemented to
date.
Major change:
The instrumentation of table io and table lock has been re factored,
to avoid performing excessive CPU computation when a table is reused in the
table open cache.
The statistics (1) by calling thread and (2) by object are collected in a
more disjoint way, avoiding the need to aggregate stats per table share in
(2) every time the thread using the table changes in (1).
See the updated doxygen documentation for table_locker.
Minor changes:
Performance schema memory structures and critical global variables are not
aligned on 128 bytes boundaries, to avoid false sharing between CPU cache
lines, and to avoid using more cache lines than necessary.
Every LF_HASH table is sized to the maximum when the hash is created,
to avoid having to resize dynamically the LF_HASH when new elements are
inserted.
The size and load count of every LF_HASH table is now displayed in the
output of SHOW ENGINE PERFORMANCE_SCHEMA STATUS, to help diagnostics.
The macro PSI_CALL has been replaced by PSI_XXX_CALL for each type of
instrumentation. This change is a preliminary cleanup, to make implementing
further optimizations possible.
Event name indexes for hard coded events (table io, table lock, idle) are
now compile time constants, instead of being dynamically allocated.
Using constants makes the code simpler and helps the compiler to perform
better optimizations.
modified:
config.h.cmake
configure.cmake
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
mysql-test/valgrind.supp
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/pfs.cc
storage/perfschema/pfs_account.cc
storage/perfschema/pfs_account.h
storage/perfschema/pfs_digest.cc
storage/perfschema/pfs_digest.h
storage/perfschema/pfs_engine_table.cc
storage/perfschema/pfs_events_waits.cc
storage/perfschema/pfs_global.cc
storage/perfschema/pfs_global.h
storage/perfschema/pfs_host.cc
storage/perfschema/pfs_host.h
storage/perfschema/pfs_instr.cc
storage/perfschema/pfs_instr.h
storage/perfschema/pfs_instr_class.cc
storage/perfschema/pfs_instr_class.h
storage/perfschema/pfs_server.cc
storage/perfschema/pfs_setup_actor.cc
storage/perfschema/pfs_setup_actor.h
storage/perfschema/pfs_setup_object.cc
storage/perfschema/pfs_setup_object.h
storage/perfschema/pfs_user.cc
storage/perfschema/pfs_user.h
storage/perfschema/pfs_visitor.cc
storage/perfschema/table_esgs_global_by_event_name.cc
storage/perfschema/table_esms_global_by_event_name.cc
3835 Jorgen Loland 2012-05-15
BUG#11754168 followup: trying to stabilize index_merge_innodb.test
modified:
mysql-test/include/index_merge1.inc
mysql-test/r/index_merge_innodb.result
mysql-test/r/index_merge_myisam.result
=== modified file 'config.h.cmake'
--- a/config.h.cmake 2012-04-17 14:20:00 +0000
+++ b/config.h.cmake 2012-05-15 09:39:47 +0000
@@ -128,6 +128,8 @@
#cmakedefine FIONREAD_IN_SYS_FILIO 1
/* Functions we may want to use. */
+#cmakedefine HAVE_ALIGNED_MALLOC 1
+#cmakedefine HAVE_ALIGNED_FREE 1
#cmakedefine HAVE_AIOWAIT 1
#cmakedefine HAVE_ALARM 1
#cmakedefine HAVE_ALLOCA 1
@@ -203,6 +205,7 @@
#cmakedefine HAVE_POLL 1
#cmakedefine HAVE_PORT_CREATE 1
#cmakedefine HAVE_POSIX_FALLOCATE 1
+#cmakedefine HAVE_POSIX_MEMALIGN 1
#cmakedefine HAVE_PREAD 1
#cmakedefine HAVE_PAUSE_INSTRUCTION 1
#cmakedefine HAVE_FAKE_PAUSE_INSTRUCTION 1
=== modified file 'configure.cmake'
--- a/configure.cmake 2012-04-23 14:21:05 +0000
+++ b/configure.cmake 2012-05-15 09:39:47 +0000
@@ -372,6 +372,8 @@ ENDIF()
#
# Tests for functions
#
+CHECK_FUNCTION_EXISTS (_aligned_malloc HAVE_ALIGNED_MALLOC)
+CHECK_FUNCTION_EXISTS (_aligned_free HAVE_ALIGNED_FREE)
#CHECK_FUNCTION_EXISTS (aiowait HAVE_AIOWAIT)
CHECK_FUNCTION_EXISTS (aio_read HAVE_AIO_READ)
CHECK_FUNCTION_EXISTS (alarm HAVE_ALARM)
@@ -438,6 +440,7 @@ CHECK_FUNCTION_EXISTS (perror HAVE_PERRO
CHECK_FUNCTION_EXISTS (poll HAVE_POLL)
CHECK_FUNCTION_EXISTS (port_create HAVE_PORT_CREATE)
CHECK_FUNCTION_EXISTS (posix_fallocate HAVE_POSIX_FALLOCATE)
+CHECK_FUNCTION_EXISTS (posix_memalign HAVE_POSIX_MEMALIGN)
CHECK_FUNCTION_EXISTS (pread HAVE_PREAD)
CHECK_FUNCTION_EXISTS (pthread_attr_create HAVE_PTHREAD_ATTR_CREATE)
CHECK_FUNCTION_EXISTS (pthread_attr_getstacksize HAVE_PTHREAD_ATTR_GETSTACKSIZE)
=== 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-15 09:39: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-15 09:39: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-03-08 15:34:34 +0000
+++ b/include/mysql/psi/mysql_socket.h 2012-05-15 09:39: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-15 09:39: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-15 09:39: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-02-16 09:51:14 +0000
+++ b/include/mysql/psi/mysql_table.h 2012-05-15 09:39: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-02-16 09:51:14 +0000
+++ b/include/mysql/psi/mysql_thread.h 2012-05-15 09:39: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-04-11 11:54:50 +0000
+++ b/include/mysql/psi/psi.h 2012-05-15 09:39: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 'mysql-test/valgrind.supp'
--- a/mysql-test/valgrind.supp 2012-03-21 15:59:46 +0000
+++ b/mysql-test/valgrind.supp 2012-05-15 09:39:47 +0000
@@ -718,13 +718,21 @@
#
{
- missing shutdown_performance_schema 1
+ missing shutdown_performance_schema 1a
Memcheck:Leak
fun:malloc
fun:_Z10pfs_mallocmi
}
{
+ missing shutdown_performance_schema 1b
+ Memcheck:Leak
+ fun:memalign
+ fun:posix_memalign
+ fun:_Z10pfs_mallocmi
+}
+
+{
missing shutdown_performance_schema 2
Memcheck:Leak
fun:malloc
@@ -738,10 +746,19 @@
# can't provide more stack context.
#
{
- missing shutdown_performance_schema 3
+ missing shutdown_performance_schema 3a
+ Memcheck:Leak
+ fun:malloc
+ fun:my_malloc
+ fun:initialize_bucket
+}
+
+{
+ missing shutdown_performance_schema 3b
Memcheck:Leak
fun:malloc
fun:my_malloc
+ fun:_lf_dynarray_lvalue
fun:initialize_bucket
}
=== 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-15 09:39: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-09 16:47:39 +0000
+++ b/sql/handler.cc 2012-05-15 09:39: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-15 09:39: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-15 09:39: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 08:59:53 +0000
+++ b/sql/sql_base.cc 2012-05-15 09:39: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-15 09:39: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-09 16:53:03 +0000
+++ b/sql/sql_class.h 2012-05-15 09:39: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-15 09:39: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-15 09:39: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-15 09:39: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-06 09:03:53 +0000
+++ b/storage/innobase/include/os0sync.ic 2012-05-15 09:39: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-15 09:39: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-15 16:08:00 +0000
+++ b/storage/innobase/include/sync0rw.ic 2012-05-15 09:39: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 00:07:22 +0000
+++ b/storage/innobase/include/sync0sync.ic 2012-05-15 09:39: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/pfs.cc'
--- a/storage/perfschema/pfs.cc 2012-04-03 21:19:04 +0000
+++ b/storage/perfschema/pfs.cc 2012-05-15 09:39:47 +0000
@@ -688,6 +688,7 @@ static inline int mysql_mutex_lock(...)
- socket io (MYSQL_SOCKET)
- table io
- table lock
+ - idle
The flow of data between aggregates tables varies for each instrumentation.
@@ -889,33 +890,68 @@ static inline int mysql_mutex_lock(...)
@subsection IMPL_WAIT_TABLE Table waits
@verbatim
- table_locker(T, Tb)
+ table_locker(Thread Th, Table Tb, Event = io or lock)
|
| [1]
|
- |-> pfs_table(Tb) =====>> [B], [C], [D]
- |
- | [2]
- |
- |-> pfs_table_share(Tb.share) =====>> [C], [D]
- |
- |-> pfs_thread(T).event_name(Tb) =====>> [A]
- |
- ...
+1a |-> pfs_table(Tb) =====>> [A], [B], [C]
+ | |
+ | | [2]
+ | |
+ | |-> pfs_table_share(Tb.share) =====>> [B], [C]
+ | |
+ | | [3]
+ | |
+ | |-> global_table_io_stat =====>> [C]
+ | |
+ | |-> global_table_lock_stat =====>> [C]
+ |
+1b |-> pfs_thread(Th).event_name(E) =====>> [D], [E], [F], [G]
+ | |
+ | | [ 4-RESET]
+ | |
+ | |-> pfs_account(U, H).event_name(E) =====>> [E], [F], [G]
+ | . |
+ | . | [5-RESET]
+ | . |
+ | .....+-> pfs_user(U).event_name(E) =====>> [F]
+ | . |
+ | .....+-> pfs_host(H).event_name(E) =====>> [G]
+ |
+1c |-> pfs_thread(Th).waits_current(W) =====>> [H]
+ |
+1d |-> pfs_thread(Th).waits_history(W) =====>> [I]
+ |
+1e |-> waits_history_long(W) =====>> [J]
@endverbatim
Implemented as:
- [1] @c start_table_io_wait_v1(), @c end_table_io_wait_v1()
- [2] @c close_table_v1()
- - [A] EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME,
- @c table_ews_by_thread_by_event_name::make_row()
- - [B] EVENTS_WAITS_SUMMARY_BY_INSTANCE,
+ - [3] @c drop_table_share_v1()
+ - [4] @c TRUNCATE TABLE EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+ - [5] @c TRUNCATE TABLE EVENTS_WAITS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME
+ - [A] EVENTS_WAITS_SUMMARY_BY_INSTANCE,
@c table_events_waits_summary_by_instance::make_table_row()
+ - [B] OBJECTS_SUMMARY_GLOBAL_BY_TYPE,
+ @c table_os_global_by_type::make_row()
- [C] EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME,
@c table_ews_global_by_event_name::make_table_io_row(),
@c table_ews_global_by_event_name::make_table_lock_row()
- - [D] OBJECTS_SUMMARY_GLOBAL_BY_TYPE,
- @c table_os_global_by_type::make_row()
+ - [D] EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME,
+ @c table_ews_by_thread_by_event_name::make_row()
+ - [E] EVENTS_WAITS_SUMMARY_BY_ACCOUNT_BY_EVENT_NAME,
+ @c table_ews_by_user_by_account_name::make_row()
+ - [F] EVENTS_WAITS_SUMMARY_BY_USER_BY_EVENT_NAME,
+ @c table_ews_by_user_by_event_name::make_row()
+ - [G] EVENTS_WAITS_SUMMARY_BY_HOST_BY_EVENT_NAME,
+ @c table_ews_by_host_by_event_name::make_row()
+ - [H] EVENTS_WAITS_CURRENT,
+ @c table_events_waits_common::make_row()
+ - [I] EVENTS_WAITS_HISTORY,
+ @c table_events_waits_common::make_row()
+ - [J] EVENTS_WAITS_HISTORY_LONG,
+ @c table_events_waits_common::make_row()
@section IMPL_STAGE Implementation for stages aggregates
@@ -1594,7 +1630,6 @@ static void unbind_table_v1(PSI_table *t
PFS_table *pfs= reinterpret_cast<PFS_table*> (table);
if (likely(pfs != NULL))
{
- pfs->aggregate();
pfs->m_thread_owner= NULL;
}
}
@@ -1615,12 +1650,6 @@ rebind_table_v1(PSI_table_share *share,
/* The table handle was already instrumented, reuse it for this thread. */
thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
- if (unlikely(thread == NULL))
- {
- destroy_table(pfs);
- return NULL;
- }
-
if (unlikely(! pfs->m_share->m_enabled))
{
destroy_table(pfs);
@@ -1660,8 +1689,6 @@ rebind_table_v1(PSI_table_share *share,
return NULL;
PFS_thread *thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
- if (unlikely(thread == NULL))
- return NULL;
PFS_table *pfs_table= create_table(pfs_table_share, thread, identity);
return reinterpret_cast<PSI_table *> (pfs_table);
@@ -2478,8 +2505,6 @@ start_table_io_wait_v1(PSI_table_locker_
return NULL;
PFS_thread *pfs_thread= pfs_table->m_thread_owner;
- if (unlikely(pfs_thread == NULL))
- return NULL;
DBUG_ASSERT(pfs_thread ==
my_pthread_getspecific_ptr(PFS_thread*, THR_PFS));
@@ -2489,6 +2514,8 @@ start_table_io_wait_v1(PSI_table_locker_
if (flag_thread_instrumentation)
{
+ if (pfs_thread == NULL)
+ return NULL;
if (! pfs_thread->m_enabled)
return NULL;
state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
@@ -2538,7 +2565,6 @@ start_table_io_wait_v1(PSI_table_locker_
pfs_thread->m_events_waits_current++;
}
- /* TODO: consider a shortcut here */
}
else
{
@@ -2585,8 +2611,6 @@ start_table_lock_wait_v1(PSI_table_locke
return NULL;
PFS_thread *pfs_thread= pfs_table->m_thread_owner;
- if (unlikely(pfs_thread == NULL))
- return NULL;
DBUG_ASSERT(pfs_thread ==
my_pthread_getspecific_ptr(PFS_thread*, THR_PFS));
@@ -2619,6 +2643,8 @@ start_table_lock_wait_v1(PSI_table_locke
if (flag_thread_instrumentation)
{
+ if (pfs_thread == NULL)
+ return NULL;
if (! pfs_thread->m_enabled)
return NULL;
state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
@@ -2668,7 +2694,6 @@ start_table_lock_wait_v1(PSI_table_locke
pfs_thread->m_events_waits_current++;
}
- /* TODO: consider a shortcut here */
}
else
{
@@ -3352,17 +3377,16 @@ static void end_idle_wait_v1(PSI_idle_lo
PFS_thread *thread= reinterpret_cast<PFS_thread *> (state->m_thread);
PFS_single_stat *event_name_array;
event_name_array= thread->m_instr_class_waits_stats;
- uint index= global_idle_class.m_event_name_index;
if (flags & STATE_FLAG_TIMED)
{
/* Aggregate to EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME (timed) */
- event_name_array[index].aggregate_value(wait_time);
+ event_name_array[GLOBAL_IDLE_EVENT_INDEX].aggregate_value(wait_time);
}
else
{
/* Aggregate to EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME (counted) */
- event_name_array[index].aggregate_counted();
+ event_name_array[GLOBAL_IDLE_EVENT_INDEX].aggregate_counted();
}
if (flags & STATE_FLAG_EVENT)
@@ -3723,22 +3747,40 @@ static void end_table_io_wait_v1(PSI_tab
stat->aggregate_counted();
}
- if (flags & STATE_FLAG_EVENT)
+ if (flags & STATE_FLAG_THREAD)
{
- DBUG_ASSERT(flags & STATE_FLAG_THREAD);
PFS_thread *thread= reinterpret_cast<PFS_thread *> (state->m_thread);
DBUG_ASSERT(thread != NULL);
- PFS_events_waits *wait= reinterpret_cast<PFS_events_waits*> (state->m_wait);
- DBUG_ASSERT(wait != NULL);
+ PFS_single_stat *event_name_array;
+ event_name_array= thread->m_instr_class_waits_stats;
- wait->m_timer_end= timer_end;
- wait->m_end_event_id= thread->m_event_id;
- if (flag_events_waits_history)
- insert_events_waits_history(thread, wait);
- if (flag_events_waits_history_long)
- insert_events_waits_history_long(wait);
- thread->m_events_waits_current--;
+ /*
+ Aggregate to EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+ (for wait/io/table/sql/handler)
+ */
+ if (flags & STATE_FLAG_TIMED)
+ {
+ event_name_array[GLOBAL_TABLE_IO_EVENT_INDEX].aggregate_value(wait_time);
+ }
+ else
+ {
+ event_name_array[GLOBAL_TABLE_IO_EVENT_INDEX].aggregate_counted();
+ }
+
+ if (flags & STATE_FLAG_EVENT)
+ {
+ PFS_events_waits *wait= reinterpret_cast<PFS_events_waits*> (state->m_wait);
+ DBUG_ASSERT(wait != NULL);
+
+ wait->m_timer_end= timer_end;
+ wait->m_end_event_id= thread->m_event_id;
+ if (flag_events_waits_history)
+ insert_events_waits_history(thread, wait);
+ if (flag_events_waits_history_long)
+ insert_events_waits_history_long(wait);
+ thread->m_events_waits_current--;
+ }
}
table->m_has_io_stats= true;
@@ -3774,22 +3816,40 @@ static void end_table_lock_wait_v1(PSI_t
stat->aggregate_counted();
}
- if (flags & STATE_FLAG_EVENT)
+ if (flags & STATE_FLAG_THREAD)
{
- DBUG_ASSERT(flags & STATE_FLAG_THREAD);
PFS_thread *thread= reinterpret_cast<PFS_thread *> (state->m_thread);
DBUG_ASSERT(thread != NULL);
- PFS_events_waits *wait= reinterpret_cast<PFS_events_waits*> (state->m_wait);
- DBUG_ASSERT(wait != NULL);
+ PFS_single_stat *event_name_array;
+ event_name_array= thread->m_instr_class_waits_stats;
+
+ /*
+ Aggregate to EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
+ (for wait/lock/table/sql/handler)
+ */
+ if (flags & STATE_FLAG_TIMED)
+ {
+ event_name_array[GLOBAL_TABLE_LOCK_EVENT_INDEX].aggregate_value(wait_time);
+ }
+ else
+ {
+ event_name_array[GLOBAL_TABLE_LOCK_EVENT_INDEX].aggregate_counted();
+ }
+
+ if (flags & STATE_FLAG_EVENT)
+ {
+ PFS_events_waits *wait= reinterpret_cast<PFS_events_waits*> (state->m_wait);
+ DBUG_ASSERT(wait != NULL);
- wait->m_timer_end= timer_end;
- wait->m_end_event_id= thread->m_event_id;
- if (flag_events_waits_history)
- insert_events_waits_history(thread, wait);
- if (flag_events_waits_history_long)
- insert_events_waits_history_long(wait);
- thread->m_events_waits_current--;
+ wait->m_timer_end= timer_end;
+ wait->m_end_event_id= thread->m_event_id;
+ if (flag_events_waits_history)
+ insert_events_waits_history(thread, wait);
+ if (flag_events_waits_history_long)
+ insert_events_waits_history_long(wait);
+ thread->m_events_waits_current--;
+ }
}
table->m_has_lock_stats= true;
=== modified file 'storage/perfschema/pfs_account.cc'
--- a/storage/perfschema/pfs_account.cc 2011-08-25 07:53:21 +0000
+++ b/storage/perfschema/pfs_account.cc 2012-05-15 09:39:47 +0000
@@ -45,7 +45,7 @@ static PFS_single_stat *account_instr_cl
static PFS_stage_stat *account_instr_class_stages_array= NULL;
static PFS_statement_stat *account_instr_class_statements_array= NULL;
-static LF_HASH account_hash;
+LF_HASH account_hash;
static bool account_hash_inited= false;
/**
@@ -145,10 +145,11 @@ C_MODE_END
*/
int init_account_hash(void)
{
- if (! account_hash_inited)
+ if ((! account_hash_inited) && (account_max > 0))
{
lf_hash_init(&account_hash, sizeof(PFS_account*), LF_HASH_UNIQUE,
0, 0, account_hash_get_key, &my_charset_bin);
+ account_hash.size= account_max;
account_hash_inited= true;
}
return 0;
=== modified file 'storage/perfschema/pfs_account.h'
--- a/storage/perfschema/pfs_account.h 2011-05-18 23:29:02 +0000
+++ b/storage/perfschema/pfs_account.h 2012-05-15 09:39:47 +0000
@@ -46,7 +46,7 @@ struct PFS_account_key
uint m_key_length;
};
-struct PFS_account : PFS_connection_slice
+struct PFS_ALIGNED PFS_account : PFS_connection_slice
{
public:
inline void init_refcount(void)
@@ -115,6 +115,8 @@ extern ulong account_lost;
extern PFS_account *account_array;
+extern LF_HASH account_hash;
+
/** @} */
#endif
=== modified file 'storage/perfschema/pfs_digest.cc'
--- a/storage/perfschema/pfs_digest.cc 2012-04-06 10:12:40 +0000
+++ b/storage/perfschema/pfs_digest.cc 2012-05-15 09:39:47 +0000
@@ -70,7 +70,7 @@ bool flag_statements_digest= true;
*/
volatile uint32 digest_index= 1;
-static LF_HASH digest_hash;
+LF_HASH digest_hash;
static bool digest_hash_inited= false;
/**
@@ -137,11 +137,12 @@ C_MODE_END
*/
int init_digest_hash(void)
{
- if (! digest_hash_inited)
+ if ((! digest_hash_inited) && (digest_max > 0))
{
lf_hash_init(&digest_hash, sizeof(PFS_statements_digest_stat*),
LF_HASH_UNIQUE, 0, 0, digest_hash_get_key,
&my_charset_bin);
+ digest_hash.size= digest_max;
digest_hash_inited= true;
}
return 0;
=== modified file 'storage/perfschema/pfs_digest.h'
--- a/storage/perfschema/pfs_digest.h 2012-04-03 21:19:04 +0000
+++ b/storage/perfschema/pfs_digest.h 2012-05-15 09:39:47 +0000
@@ -44,7 +44,7 @@ struct PFS_digest_hash
};
/** A statement digest stat record. */
-struct PFS_statements_digest_stat
+struct PFS_ALIGNED PFS_statements_digest_stat
{
/** Digest MD5 Hash. */
PFS_digest_hash m_digest_hash;
@@ -211,4 +211,6 @@ inline void store_token_identifier(PSI_d
}
}
+extern LF_HASH digest_hash;
+
#endif
=== modified file 'storage/perfschema/pfs_engine_table.cc'
--- a/storage/perfschema/pfs_engine_table.cc 2012-02-28 14:40:36 +0000
+++ b/storage/perfschema/pfs_engine_table.cc 2012-05-15 09:39:47 +0000
@@ -1330,12 +1330,78 @@ bool pfs_show_status(handlerton *hton, T
name= "events_statements_summary_by_digest.memory";
size= digest_max * sizeof(PFS_statements_digest_stat);
total_memory+= size;
- break;
+ break;
+
+ case 137:
+ name= "(account_hash).count";
+ size= account_hash.count;
+ break;
+ case 138:
+ name= "(account_hash).size";
+ size= account_hash.size;
+ break;
+ case 139:
+ name= "(digest_hash).count";
+ size= digest_hash.count;
+ break;
+ case 140:
+ name= "(digest_hash).size";
+ size= digest_hash.size;
+ break;
+ case 141:
+ name= "(filename_hash).count";
+ size= filename_hash.count;
+ break;
+ case 142:
+ name= "(filename_hash).size";
+ size= filename_hash.size;
+ break;
+ case 143:
+ name= "(host_hash).count";
+ size= host_hash.count;
+ break;
+ case 144:
+ name= "(host_hash).size";
+ size= host_hash.size;
+ break;
+ case 145:
+ name= "(setup_actor_hash).count";
+ size= setup_actor_hash.count;
+ break;
+ case 146:
+ name= "(setup_actor_hash).size";
+ size= setup_actor_hash.size;
+ break;
+ case 147:
+ name= "(setup_object_hash).count";
+ size= setup_object_hash.count;
+ break;
+ case 148:
+ name= "(setup_object_hash).size";
+ size= setup_object_hash.size;
+ break;
+ case 149:
+ name= "(table_share_hash).count";
+ size= table_share_hash.count;
+ break;
+ case 150:
+ name= "(table_share_hash).size";
+ size= table_share_hash.size;
+ break;
+ case 151:
+ name= "(user_hash).count";
+ size= user_hash.count;
+ break;
+ case 152:
+ name= "(user_hash).size";
+ size= user_hash.size;
+ break;
+
/*
This case must be last,
for aggregation in total_memory.
*/
- case 137:
+ case 153:
name= "performance_schema.memory";
size= total_memory;
/* This will fail if something is not advertised here */
=== modified file 'storage/perfschema/pfs_events_waits.cc'
--- a/storage/perfschema/pfs_events_waits.cc 2011-11-18 16:49:29 +0000
+++ b/storage/perfschema/pfs_events_waits.cc 2012-05-15 09:39:47 +0000
@@ -238,6 +238,9 @@ void reset_events_waits_global()
for ( ; stat < stat_last; stat++)
stat->reset();
+
+ global_table_io_stat.reset();
+ global_table_lock_stat.reset();
}
void reset_table_waits_by_table()
=== modified file 'storage/perfschema/pfs_global.cc'
--- a/storage/perfschema/pfs_global.cc 2011-08-19 15:20:56 +0000
+++ b/storage/perfschema/pfs_global.cc 2012-05-15 09:39:47 +0000
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#ifdef __WIN__
#include <winsock2.h>
@@ -45,18 +46,61 @@ void *pfs_malloc(size_t size, myf flags)
DBUG_ASSERT(! pfs_initialized);
DBUG_ASSERT(size > 0);
- void *ptr= malloc(size);
- if (likely(ptr != NULL))
- pfs_allocated_memory+= size;
- if (likely((ptr != NULL) && (flags & MY_ZEROFILL)))
+ void *ptr;
+
+#ifdef HAVE_POSIX_MEMALIGN
+ /* Linux */
+ if (unlikely(posix_memalign(& ptr, PFS_ALIGNEMENT, size)))
+ return NULL;
+#else
+#ifdef HAVE_MEMALIGN
+ /* Solaris */
+ ptr= memalign(PFS_ALIGNEMENT, size);
+ if (unlikely(ptr == NULL))
+ return NULL;
+#else
+#ifdef HAVE_ALIGNED_MALLOC
+ /* Windows */
+ ptr= _aligned_malloc(PFS_ALIGNEMENT, size);
+ if (unlikely(ptr == NULL))
+ return NULL;
+#else
+ /* Everything else */
+ ptr= malloc(size);
+ if (unlikely(ptr == NULL))
+ return NULL;
+#endif /* HAVE_ALIGNED_MALLOC */
+#endif /* HAVE_MEMALIGN */
+#endif /* HAVE_POSIX_MEMALIGN */
+
+ pfs_allocated_memory+= size;
+ if (flags & MY_ZEROFILL)
memset(ptr, 0, size);
return ptr;
}
void pfs_free(void *ptr)
{
- if (ptr != NULL)
- free(ptr);
+ if (ptr == NULL)
+ return;
+
+#ifdef HAVE_POSIX_MEMALIGN
+ /* Allocated with posix_memalign() */
+ free(ptr);
+#else
+#ifdef HAVE_MEMALIGN
+ /* Allocated with memalign() */
+ free(ptr);
+#else
+#ifdef HAVE_ALIGNED_MALLOC
+ /* Allocated with _aligned_malloc() */
+ _aligned_free(ptr);
+#else
+ /* Allocated with malloc() */
+ free(ptr);
+#endif /* HAVE_ALIGNED_MALLOC */
+#endif /* HAVE_MEMALIGN */
+#endif /* HAVE_POSIX_MEMALIGN */
}
void pfs_print_error(const char *format, ...)
=== modified file 'storage/perfschema/pfs_global.h'
--- a/storage/perfschema/pfs_global.h 2011-07-26 00:39:25 +0000
+++ b/storage/perfschema/pfs_global.h 2012-05-15 09:39:47 +0000
@@ -16,6 +16,9 @@
#ifndef PFS_GLOBAL_H
#define PFS_GLOBAL_H
+#include "my_global.h"
+#include "my_compiler.h"
+
/**
@file storage/perfschema/pfs_global.h
Miscellaneous global dependencies (declarations).
@@ -26,6 +29,14 @@ extern bool pfs_initialized;
/** Total memory allocated by the performance schema, in bytes. */
extern ulonglong pfs_allocated_memory;
+#if defined(HAVE_POSIX_MEMALIGN) || defined(HAVE_MEMALIGN) || defined(HAVE_ALIGNED_MALLOC)
+#define PFS_ALIGNEMENT 128
+#define PFS_ALIGNED MY_ALIGNED(PFS_ALIGNEMENT)
+#else
+#error "Really ? What platform is this ?"
+#define PFS_ALIGNED
+#endif /* HAVE_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_ALIGNED_MALLOC */
+
void *pfs_malloc(size_t size, myf flags);
/**
=== modified file 'storage/perfschema/pfs_host.cc'
--- a/storage/perfschema/pfs_host.cc 2011-08-25 07:53:21 +0000
+++ b/storage/perfschema/pfs_host.cc 2012-05-15 09:39:47 +0000
@@ -42,7 +42,7 @@ static PFS_single_stat *host_instr_class
static PFS_stage_stat *host_instr_class_stages_array= NULL;
static PFS_statement_stat *host_instr_class_statements_array= NULL;
-static LF_HASH host_hash;
+LF_HASH host_hash;
static bool host_hash_inited= false;
/**
@@ -146,10 +146,11 @@ C_MODE_END
*/
int init_host_hash(void)
{
- if (! host_hash_inited)
+ if ((! host_hash_inited) && (host_max > 0))
{
lf_hash_init(&host_hash, sizeof(PFS_host*), LF_HASH_UNIQUE,
0, 0, host_hash_get_key, &my_charset_bin);
+ host_hash.size= host_max;
host_hash_inited= true;
}
return 0;
=== modified file 'storage/perfschema/pfs_host.h'
--- a/storage/perfschema/pfs_host.h 2011-05-18 23:29:02 +0000
+++ b/storage/perfschema/pfs_host.h 2012-05-15 09:39:47 +0000
@@ -44,7 +44,7 @@ struct PFS_host_key
uint m_key_length;
};
-struct PFS_host : PFS_connection_slice
+struct PFS_ALIGNED PFS_host : PFS_connection_slice
{
public:
inline void init_refcount(void)
@@ -105,6 +105,8 @@ extern ulong host_lost;
extern PFS_host *host_array;
+extern LF_HASH host_hash;
+
/** @} */
#endif
=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc 2012-03-28 17:06:13 +0000
+++ b/storage/perfschema/pfs_instr.cc 2012-05-15 09:39:47 +0000
@@ -159,7 +159,7 @@ static PFS_events_statements *thread_sta
static PFS_events_statements *thread_statements_stack_array= NULL;
/** Hash table for instrumented files. */
-static LF_HASH filename_hash;
+LF_HASH filename_hash;
/** True if filename_hash is initialized. */
static bool filename_hash_inited= false;
@@ -491,10 +491,11 @@ C_MODE_END
*/
int init_file_hash(void)
{
- if (! filename_hash_inited)
+ if ((! filename_hash_inited) && (file_max > 0))
{
lf_hash_init(&filename_hash, sizeof(PFS_file*), LF_HASH_UNIQUE,
0, 0, filename_hash_get_key, &my_charset_bin);
+ filename_hash.size= file_max;
filename_hash_inited= true;
}
return 0;
@@ -587,7 +588,7 @@ void PFS_scan::init(uint random, uint ma
*/
PFS_mutex* create_mutex(PFS_mutex_class *klass, const void *identity)
{
- static uint mutex_monotonic_index= 0;
+ static uint PFS_ALIGNED mutex_monotonic_index= 0;
uint index;
uint attempts= 0;
PFS_mutex *pfs;
@@ -665,7 +666,7 @@ void destroy_mutex(PFS_mutex *pfs)
*/
PFS_rwlock* create_rwlock(PFS_rwlock_class *klass, const void *identity)
{
- static uint rwlock_monotonic_index= 0;
+ static uint PFS_ALIGNED rwlock_monotonic_index= 0;
uint index;
uint attempts= 0;
PFS_rwlock *pfs;
@@ -728,7 +729,7 @@ void destroy_rwlock(PFS_rwlock *pfs)
*/
PFS_cond* create_cond(PFS_cond_class *klass, const void *identity)
{
- static uint cond_monotonic_index= 0;
+ static uint PFS_ALIGNED cond_monotonic_index= 0;
uint index;
uint attempts= 0;
PFS_cond *pfs;
@@ -797,7 +798,7 @@ PFS_thread* PFS_thread::get_current_thre
PFS_thread* create_thread(PFS_thread_class *klass, const void *identity,
ulong thread_id)
{
- static uint thread_monotonic_index= 0;
+ static uint PFS_ALIGNED thread_monotonic_index= 0;
uint index;
uint attempts= 0;
PFS_thread *pfs;
@@ -1154,7 +1155,7 @@ find_or_create_file(PFS_thread *thread,
PFS_file **entry;
uint retry_count= 0;
const uint retry_max= 3;
- static uint file_monotonic_index= 0;
+ static uint PFS_ALIGNED file_monotonic_index= 0;
uint index;
uint attempts= 0;
@@ -1283,7 +1284,7 @@ void destroy_file(PFS_thread *thread, PF
PFS_table* create_table(PFS_table_share *share, PFS_thread *opening_thread,
const void *identity)
{
- static uint table_monotonic_index= 0;
+ static uint PFS_ALIGNED table_monotonic_index= 0;
uint index;
uint attempts= 0;
PFS_table *pfs;
@@ -1328,23 +1329,22 @@ void PFS_table::sanitized_aggregate(void
and not own the table handle.
*/
PFS_table_share *safe_share= sanitize_table_share(m_share);
- PFS_thread *safe_thread= sanitize_thread(m_thread_owner);
- if ((safe_share != NULL && safe_thread != NULL))
+ if (safe_share != NULL)
{
if (m_has_io_stats && m_has_lock_stats)
{
- safe_aggregate(& m_table_stat, safe_share, safe_thread);
+ safe_aggregate(& m_table_stat, safe_share);
m_has_io_stats= false;
m_has_lock_stats= false;
}
else if (m_has_io_stats)
{
- safe_aggregate_io(& m_table_stat, safe_share, safe_thread);
+ safe_aggregate_io(& m_table_stat, safe_share);
m_has_io_stats= false;
}
else if (m_has_lock_stats)
{
- safe_aggregate_lock(& m_table_stat, safe_share, safe_thread);
+ safe_aggregate_lock(& m_table_stat, safe_share);
m_has_lock_stats= false;
}
}
@@ -1353,10 +1353,9 @@ void PFS_table::sanitized_aggregate(void
void PFS_table::sanitized_aggregate_io(void)
{
PFS_table_share *safe_share= sanitize_table_share(m_share);
- PFS_thread *safe_thread= sanitize_thread(m_thread_owner);
- if (safe_share != NULL && safe_thread != NULL && m_has_io_stats)
+ if (safe_share != NULL && m_has_io_stats)
{
- safe_aggregate_io(& m_table_stat, safe_share, safe_thread);
+ safe_aggregate_io(& m_table_stat, safe_share);
m_has_io_stats= false;
}
}
@@ -1364,100 +1363,44 @@ void PFS_table::sanitized_aggregate_io(v
void PFS_table::sanitized_aggregate_lock(void)
{
PFS_table_share *safe_share= sanitize_table_share(m_share);
- PFS_thread *safe_thread= sanitize_thread(m_thread_owner);
- if (safe_share != NULL && safe_thread != NULL && m_has_lock_stats)
+ if (safe_share != NULL && m_has_lock_stats)
{
- safe_aggregate_lock(& m_table_stat, safe_share, safe_thread);
+ safe_aggregate_lock(& m_table_stat, safe_share);
m_has_lock_stats= false;
}
}
void PFS_table::safe_aggregate(PFS_table_stat *table_stat,
- PFS_table_share *table_share,
- PFS_thread *thread)
+ PFS_table_share *table_share)
{
DBUG_ASSERT(table_stat != NULL);
DBUG_ASSERT(table_share != NULL);
- DBUG_ASSERT(thread != NULL);
uint key_count= sanitize_index_count(table_share->m_key_count);
- if (flag_thread_instrumentation && thread->m_enabled)
- {
- PFS_single_stat *event_name_array;
- uint index;
- event_name_array= thread->m_instr_class_waits_stats;
-
- /*
- Aggregate to EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
- (for wait/io/table/sql/handler)
- */
- index= global_table_io_class.m_event_name_index;
- table_stat->sum_io(& event_name_array[index], key_count);
-
- /*
- Aggregate to EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
- (for wait/lock/table/sql/handler)
- */
- index= global_table_lock_class.m_event_name_index;
- table_stat->sum_lock(& event_name_array[index]);
- }
-
/* Aggregate to TABLE_IO_SUMMARY, TABLE_LOCK_SUMMARY */
table_share->m_table_stat.aggregate(table_stat, key_count);
table_stat->fast_reset();
}
void PFS_table::safe_aggregate_io(PFS_table_stat *table_stat,
- PFS_table_share *table_share,
- PFS_thread *thread)
+ PFS_table_share *table_share)
{
DBUG_ASSERT(table_stat != NULL);
DBUG_ASSERT(table_share != NULL);
- DBUG_ASSERT(thread != NULL);
uint key_count= sanitize_index_count(table_share->m_key_count);
- if (flag_thread_instrumentation && thread->m_enabled)
- {
- PFS_single_stat *event_name_array;
- uint index;
- event_name_array= thread->m_instr_class_waits_stats;
-
- /*
- Aggregate to EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
- (for wait/io/table/sql/handler)
- */
- index= global_table_io_class.m_event_name_index;
- table_stat->sum_io(& event_name_array[index], key_count);
- }
-
/* Aggregate to TABLE_IO_SUMMARY */
table_share->m_table_stat.aggregate_io(table_stat, key_count);
table_stat->fast_reset_io();
}
void PFS_table::safe_aggregate_lock(PFS_table_stat *table_stat,
- PFS_table_share *table_share,
- PFS_thread *thread)
+ PFS_table_share *table_share)
{
DBUG_ASSERT(table_stat != NULL);
DBUG_ASSERT(table_share != NULL);
- DBUG_ASSERT(thread != NULL);
-
- if (flag_thread_instrumentation && thread->m_enabled)
- {
- PFS_single_stat *event_name_array;
- uint index;
- event_name_array= thread->m_instr_class_waits_stats;
-
- /*
- Aggregate to EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME
- (for wait/lock/table/sql/handler)
- */
- index= global_table_lock_class.m_event_name_index;
- table_stat->sum_lock(& event_name_array[index]);
- }
/* Aggregate to TABLE_LOCK_SUMMARY */
table_share->m_table_stat.aggregate_lock(table_stat);
=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h 2012-03-19 19:29:28 +0000
+++ b/storage/perfschema/pfs_instr.h 2012-05-15 09:39:47 +0000
@@ -34,6 +34,8 @@ struct PFS_socket_class;
#else
#include <arpa/inet.h>
#endif
+#include "my_global.h"
+#include "my_compiler.h"
#include "pfs_lock.h"
#include "pfs_stat.h"
#include "pfs_instr_class.h"
@@ -68,7 +70,7 @@ struct PFS_instr
};
/** Instrumented mutex implementation. @see PSI_mutex. */
-struct PFS_mutex : public PFS_instr
+struct PFS_ALIGNED PFS_mutex : public PFS_instr
{
/** Mutex identity, typically a pthread_mutex_t. */
const void *m_identity;
@@ -91,7 +93,7 @@ struct PFS_mutex : public PFS_instr
};
/** Instrumented rwlock implementation. @see PSI_rwlock. */
-struct PFS_rwlock : public PFS_instr
+struct PFS_ALIGNED PFS_rwlock : public PFS_instr
{
/** RWLock identity, typically a pthread_rwlock_t. */
const void *m_identity;
@@ -126,7 +128,7 @@ struct PFS_rwlock : public PFS_instr
};
/** Instrumented cond implementation. @see PSI_cond. */
-struct PFS_cond : public PFS_instr
+struct PFS_ALIGNED PFS_cond : public PFS_instr
{
/** Condition identity, typically a pthread_cond_t. */
const void *m_identity;
@@ -139,7 +141,7 @@ struct PFS_cond : public PFS_instr
};
/** Instrumented File and FILE implementation. @see PSI_file. */
-struct PFS_file : public PFS_instr
+struct PFS_ALIGNED PFS_file : public PFS_instr
{
uint32 get_version()
{ return m_lock.get_version(); }
@@ -159,7 +161,7 @@ struct PFS_file : public PFS_instr
};
/** Instrumented table implementation. @see PSI_table. */
-struct PFS_table
+struct PFS_ALIGNED PFS_table
{
/**
True if table io instrumentation is enabled.
@@ -196,24 +198,21 @@ public:
*/
void aggregate(void)
{
- if (likely(m_thread_owner != NULL))
+ if (m_has_io_stats && m_has_lock_stats)
{
- if (m_has_io_stats && m_has_lock_stats)
- {
- safe_aggregate(& m_table_stat, m_share, m_thread_owner);
- m_has_io_stats= false;
- m_has_lock_stats= false;
- }
- else if (m_has_io_stats)
- {
- safe_aggregate_io(& m_table_stat, m_share, m_thread_owner);
- m_has_io_stats= false;
- }
- else if (m_has_lock_stats)
- {
- safe_aggregate_lock(& m_table_stat, m_share, m_thread_owner);
- m_has_lock_stats= false;
- }
+ safe_aggregate(& m_table_stat, m_share);
+ m_has_io_stats= false;
+ m_has_lock_stats= false;
+ }
+ else if (m_has_io_stats)
+ {
+ safe_aggregate_io(& m_table_stat, m_share);
+ m_has_io_stats= false;
+ }
+ else if (m_has_lock_stats)
+ {
+ safe_aggregate_lock(& m_table_stat, m_share);
+ m_has_lock_stats= false;
}
}
@@ -251,18 +250,15 @@ public:
private:
static void safe_aggregate(PFS_table_stat *stat,
- PFS_table_share *safe_share,
- PFS_thread *safe_thread);
+ PFS_table_share *safe_share);
static void safe_aggregate_io(PFS_table_stat *stat,
- PFS_table_share *safe_share,
- PFS_thread *safe_thread);
+ PFS_table_share *safe_share);
static void safe_aggregate_lock(PFS_table_stat *stat,
- PFS_table_share *safe_share,
- PFS_thread *safe_thread);
+ PFS_table_share *safe_share);
};
/** Instrumented socket implementation. @see PSI_socket. */
-struct PFS_socket : public PFS_instr
+struct PFS_ALIGNED PFS_socket : public PFS_instr
{
uint32 get_version()
{ return m_lock.get_version(); }
@@ -384,7 +380,7 @@ private:
/** Instrumented thread implementation. @see PSI_thread. */
-struct PFS_thread : PFS_connection_slice
+struct PFS_ALIGNED PFS_thread : PFS_connection_slice
{
static PFS_thread* get_current_thread(void);
@@ -637,6 +633,8 @@ void update_socket_derived_flags();
/** Update derived flags for all instruments. */
void update_instruments_derived_flags();
+extern LF_HASH filename_hash;
+
/** @} */
#endif
=== modified file 'storage/perfschema/pfs_instr_class.cc'
--- a/storage/perfschema/pfs_instr_class.cc 2012-03-19 19:29:28 +0000
+++ b/storage/perfschema/pfs_instr_class.cc 2012-05-15 09:39:47 +0000
@@ -135,9 +135,11 @@ static PFS_thread_class *thread_class_ar
*/
PFS_table_share *table_share_array= NULL;
-PFS_instr_class global_table_io_class;
-PFS_instr_class global_table_lock_class;
-PFS_instr_class global_idle_class;
+PFS_ALIGNED PFS_table_io_stat global_table_io_stat;
+PFS_ALIGNED PFS_table_lock_stat global_table_lock_stat;
+PFS_ALIGNED PFS_instr_class global_table_io_class;
+PFS_ALIGNED PFS_instr_class global_table_lock_class;
+PFS_ALIGNED PFS_instr_class global_idle_class;
/** Class-timer map */
enum_timer_name *class_timers[] =
@@ -165,7 +167,7 @@ enum_timer_name *class_timers[] =
@sa table_share_hash_get_key
@sa get_table_share_hash_pins
*/
-static LF_HASH table_share_hash;
+LF_HASH table_share_hash;
/** True if table_share_hash is initialized. */
static bool table_share_hash_inited= false;
@@ -193,19 +195,17 @@ uint mutex_class_start= 0;
uint rwlock_class_start= 0;
uint cond_class_start= 0;
uint file_class_start= 0;
-uint table_class_start= 0;
uint wait_class_max= 0;
uint socket_class_start= 0;
void init_event_name_sizing(const PFS_global_param *param)
{
- mutex_class_start= 0;
+ mutex_class_start= 3; /* global table io, table lock, idle */
rwlock_class_start= mutex_class_start + param->m_mutex_class_sizing;
cond_class_start= rwlock_class_start + param->m_rwlock_class_sizing;
file_class_start= cond_class_start + param->m_cond_class_sizing;
socket_class_start= file_class_start + param->m_file_class_sizing;
- table_class_start= socket_class_start + param->m_socket_class_sizing;
- wait_class_max= table_class_start + 3; /* global table io, lock, idle */
+ wait_class_max= socket_class_start + param->m_socket_class_sizing;
}
void register_global_classes()
@@ -213,19 +213,19 @@ void register_global_classes()
/* Table IO class */
init_instr_class(&global_table_io_class, "wait/io/table/sql/handler", 25,
0, PFS_CLASS_TABLE_IO);
- global_table_io_class.m_event_name_index= table_class_start;
+ global_table_io_class.m_event_name_index= GLOBAL_TABLE_IO_EVENT_INDEX;
configure_instr_class(&global_table_io_class);
/* Table lock class */
init_instr_class(&global_table_lock_class, "wait/lock/table/sql/handler", 27,
0, PFS_CLASS_TABLE_LOCK);
- global_table_lock_class.m_event_name_index= table_class_start + 1;
+ global_table_lock_class.m_event_name_index= GLOBAL_TABLE_LOCK_EVENT_INDEX;
configure_instr_class(&global_table_lock_class);
/* Idle class */
init_instr_class(&global_idle_class, "idle", 4,
0, PFS_CLASS_IDLE);
- global_idle_class.m_event_name_index= table_class_start + 2;
+ global_idle_class.m_event_name_index= GLOBAL_IDLE_EVENT_INDEX;
configure_instr_class(&global_idle_class);
}
@@ -384,6 +384,7 @@ int init_table_share_hash(void)
{
lf_hash_init(&table_share_hash, sizeof(PFS_table_share*), LF_HASH_UNIQUE,
0, 0, table_share_hash_get_key, &my_charset_bin);
+ table_share_hash.size= table_share_max;
table_share_hash_inited= true;
}
return 0;
@@ -1256,7 +1257,7 @@ PFS_table_share* find_or_create_table_sh
const uint retry_max= 3;
bool enabled= true;
bool timed= true;
- static uint table_share_monotonic_index= 0;
+ static uint PFS_ALIGNED table_share_monotonic_index= 0;
uint index;
uint attempts= 0;
PFS_table_share *pfs;
@@ -1299,8 +1300,7 @@ search:
while (++attempts <= table_share_max)
{
/* See create_mutex() */
- PFS_atomic::add_u32(& table_share_monotonic_index, 1);
- index= table_share_monotonic_index % table_share_max;
+ index= PFS_atomic::add_u32(& table_share_monotonic_index, 1) % table_share_max;
pfs= table_share_array + index;
if (pfs->m_lock.is_free())
@@ -1354,17 +1354,27 @@ search:
void PFS_table_share::aggregate_io(void)
{
uint safe_key_count= sanitize_index_count(m_key_count);
- uint index= global_table_io_class.m_event_name_index;
- PFS_single_stat *table_io_total= & global_instr_class_waits_array[index];
- m_table_stat.sum_io(table_io_total, safe_key_count);
+ PFS_table_io_stat *from_stat;
+ PFS_table_io_stat *from_stat_last;
+ PFS_table_io_stat sum_io;
+
+ /* Aggregate stats for each index, if any */
+ from_stat= & m_table_stat.m_index_stat[0];
+ from_stat_last= from_stat + safe_key_count;
+ for ( ; from_stat < from_stat_last ; from_stat++)
+ sum_io.aggregate(from_stat);
+
+ /* Aggregate stats for the table */
+ sum_io.aggregate(& m_table_stat.m_index_stat[MAX_INDEXES]);
+
+ /* Add this table stats to the global sink. */
+ global_table_io_stat.aggregate(& sum_io);
m_table_stat.fast_reset_io();
}
void PFS_table_share::aggregate_lock(void)
{
- uint index= global_table_lock_class.m_event_name_index;
- PFS_single_stat *table_lock_total= & global_instr_class_waits_array[index];
- m_table_stat.sum_lock(table_lock_total);
+ global_table_lock_stat.aggregate(& m_table_stat.m_lock_stat);
m_table_stat.fast_reset_lock();
}
=== modified file 'storage/perfschema/pfs_instr_class.h'
--- a/storage/perfschema/pfs_instr_class.h 2012-03-19 19:29:28 +0000
+++ b/storage/perfschema/pfs_instr_class.h 2012-05-15 09:39:47 +0000
@@ -16,7 +16,10 @@
#ifndef PFS_INSTR_CLASS_H
#define PFS_INSTR_CLASS_H
+#include "my_global.h"
#include "mysql_com.h" /* NAME_LEN */
+#include "lf.h"
+#include "pfs_global.h"
/**
@file storage/perfschema/pfs_instr_class.h
@@ -112,7 +115,6 @@ extern uint mutex_class_start;
extern uint rwlock_class_start;
extern uint cond_class_start;
extern uint file_class_start;
-extern uint table_class_start;
extern uint socket_class_start;
extern uint wait_class_max;
@@ -166,7 +168,7 @@ struct PFS_instr_class
struct PFS_mutex;
/** Instrumentation metadata for a MUTEX. */
-struct PFS_mutex_class : public PFS_instr_class
+struct PFS_ALIGNED PFS_mutex_class : public PFS_instr_class
{
/**
Lock statistics.
@@ -180,7 +182,7 @@ struct PFS_mutex_class : public PFS_inst
struct PFS_rwlock;
/** Instrumentation metadata for a RWLOCK. */
-struct PFS_rwlock_class : public PFS_instr_class
+struct PFS_ALIGNED PFS_rwlock_class : public PFS_instr_class
{
/**
Read lock statistics.
@@ -199,7 +201,7 @@ struct PFS_rwlock_class : public PFS_ins
struct PFS_cond;
/** Instrumentation metadata for a COND. */
-struct PFS_cond_class : public PFS_instr_class
+struct PFS_ALIGNED PFS_cond_class : public PFS_instr_class
{
/**
Condition usage statistics.
@@ -211,7 +213,7 @@ struct PFS_cond_class : public PFS_instr
};
/** Instrumentation metadata of a thread. */
-struct PFS_thread_class
+struct PFS_ALIGNED PFS_thread_class
{
/** True if this thread instrument is enabled. */
bool m_enabled;
@@ -247,7 +249,7 @@ struct PFS_table_key
};
/** Instrumentation metadata for a table share. */
-struct PFS_table_share
+struct PFS_ALIGNED PFS_table_share
{
public:
uint32 get_version()
@@ -323,6 +325,11 @@ private:
int m_refcount;
};
+/** Statistics for dropped table io. */
+extern PFS_table_io_stat global_table_io_stat;
+/** Statistics for dropped table lock. */
+extern PFS_table_lock_stat global_table_lock_stat;
+
inline uint sanitize_index_count(uint count)
{
if (likely(count <= MAX_INDEXES))
@@ -330,6 +337,10 @@ inline uint sanitize_index_count(uint co
return 0;
}
+#define GLOBAL_TABLE_IO_EVENT_INDEX 0
+#define GLOBAL_TABLE_LOCK_EVENT_INDEX 1
+#define GLOBAL_IDLE_EVENT_INDEX 2
+
/**
Instrument controlling all table io.
This instrument is used with table SETUP_OBJECTS.
@@ -350,7 +361,7 @@ extern PFS_instr_class global_idle_class
struct PFS_file;
/** Instrumentation metadata for a file. */
-struct PFS_file_class : public PFS_instr_class
+struct PFS_ALIGNED PFS_file_class : public PFS_instr_class
{
/** File usage statistics. */
PFS_file_stat m_file_stat;
@@ -359,21 +370,21 @@ struct PFS_file_class : public PFS_instr
};
/** Instrumentation metadata for a stage. */
-struct PFS_stage_class : public PFS_instr_class
+struct PFS_ALIGNED PFS_stage_class : public PFS_instr_class
{
/** Stage usage statistics. */
PFS_stage_stat m_stage_stat;
};
/** Instrumentation metadata for a statement. */
-struct PFS_statement_class : public PFS_instr_class
+struct PFS_ALIGNED PFS_statement_class : public PFS_instr_class
{
};
struct PFS_socket;
/** Instrumentation metadata for a socket. */
-struct PFS_socket_class : public PFS_instr_class
+struct PFS_ALIGNED PFS_socket_class : public PFS_instr_class
{
/** Socket usage statistics. */
PFS_socket_stat m_socket_stat;
@@ -494,6 +505,8 @@ void reset_socket_class_io();
/** Update derived flags for all table shares. */
void update_table_share_derived_flags(PFS_thread *thread);
+extern LF_HASH table_share_hash;
+
/** @} */
#endif
=== modified file 'storage/perfschema/pfs_server.cc'
--- a/storage/perfschema/pfs_server.cc 2012-02-11 20:33:44 +0000
+++ b/storage/perfschema/pfs_server.cc 2012-05-15 09:39:47 +0000
@@ -55,6 +55,8 @@ initialize_performance_schema(const PFS_
pfs_initialized= false;
PFS_table_stat::g_reset_template.reset();
+ global_table_io_stat.reset();
+ global_table_lock_stat.reset();
if (! param->m_enabled)
{
=== modified file 'storage/perfschema/pfs_setup_actor.cc'
--- a/storage/perfschema/pfs_setup_actor.cc 2011-08-25 07:53:21 +0000
+++ b/storage/perfschema/pfs_setup_actor.cc 2012-05-15 09:39:47 +0000
@@ -43,7 +43,7 @@ ulong setup_actor_max;
PFS_setup_actor *setup_actor_array= NULL;
/** Hash table for setup_actor records. */
-static LF_HASH setup_actor_hash;
+LF_HASH setup_actor_hash;
/** True if @c setup_actor_hash is initialized. */
static bool setup_actor_hash_inited= false;
@@ -100,10 +100,11 @@ C_MODE_END
*/
int init_setup_actor_hash(void)
{
- if (! setup_actor_hash_inited)
+ if ((! setup_actor_hash_inited) && (setup_actor_max > 0))
{
lf_hash_init(&setup_actor_hash, sizeof(PFS_setup_actor*), LF_HASH_UNIQUE,
0, 0, setup_actor_hash_get_key, &my_charset_bin);
+ setup_actor_hash.size= setup_actor_max;
setup_actor_hash_inited= true;
}
return 0;
@@ -167,7 +168,7 @@ int insert_setup_actor(const String *use
if (unlikely(pins == NULL))
return HA_ERR_OUT_OF_MEM;
- static uint setup_actor_monotonic_index= 0;
+ static uint PFS_ALIGNED setup_actor_monotonic_index= 0;
uint index;
uint attempts= 0;
PFS_setup_actor *pfs;
@@ -175,8 +176,7 @@ int insert_setup_actor(const String *use
while (++attempts <= setup_actor_max)
{
/* See create_mutex() */
- PFS_atomic::add_u32(& setup_actor_monotonic_index, 1);
- index= setup_actor_monotonic_index % setup_actor_max;
+ index= PFS_atomic::add_u32(& setup_actor_monotonic_index, 1) % setup_actor_max;
pfs= setup_actor_array + index;
if (pfs->m_lock.is_free())
=== modified file 'storage/perfschema/pfs_setup_actor.h'
--- a/storage/perfschema/pfs_setup_actor.h 2011-06-30 15:50:45 +0000
+++ b/storage/perfschema/pfs_setup_actor.h 2012-05-15 09:39:47 +0000
@@ -49,7 +49,7 @@ struct PFS_setup_actor_key
};
/** A setup_actor record. */
-struct PFS_setup_actor
+struct PFS_ALIGNED PFS_setup_actor
{
/** Internal lock. */
pfs_lock m_lock;
@@ -92,6 +92,8 @@ extern ulong setup_actor_max;
extern PFS_setup_actor *setup_actor_array;
+extern LF_HASH setup_actor_hash;
+
/** @} */
#endif
=== modified file 'storage/perfschema/pfs_setup_object.cc'
--- a/storage/perfschema/pfs_setup_object.cc 2011-08-25 07:53:21 +0000
+++ b/storage/perfschema/pfs_setup_object.cc 2012-05-15 09:39:47 +0000
@@ -39,7 +39,7 @@ ulong setup_object_max;
PFS_setup_object *setup_object_array= NULL;
-static LF_HASH setup_object_hash;
+LF_HASH setup_object_hash;
static bool setup_object_hash_inited= false;
/**
@@ -95,10 +95,11 @@ C_MODE_END
*/
int init_setup_object_hash(void)
{
- if (! setup_object_hash_inited)
+ if ((! setup_object_hash_inited) && (setup_object_max > 0))
{
lf_hash_init(&setup_object_hash, sizeof(PFS_setup_object*), LF_HASH_UNIQUE,
0, 0, setup_object_hash_get_key, &my_charset_bin);
+ setup_object_hash.size= setup_object_max;
setup_object_hash_inited= true;
}
return 0;
@@ -161,7 +162,7 @@ int insert_setup_object(enum_object_type
if (unlikely(pins == NULL))
return HA_ERR_OUT_OF_MEM;
- static uint setup_object_monotonic_index= 0;
+ static uint PFS_ALIGNED setup_object_monotonic_index= 0;
uint index;
uint attempts= 0;
PFS_setup_object *pfs;
@@ -169,8 +170,7 @@ int insert_setup_object(enum_object_type
while (++attempts <= setup_object_max)
{
/* See create_mutex() */
- PFS_atomic::add_u32(& setup_object_monotonic_index, 1);
- index= setup_object_monotonic_index % setup_object_max;
+ index= PFS_atomic::add_u32(& setup_object_monotonic_index, 1) % setup_object_max;
pfs= setup_object_array + index;
if (pfs->m_lock.is_free())
=== modified file 'storage/perfschema/pfs_setup_object.h'
--- a/storage/perfschema/pfs_setup_object.h 2011-07-06 18:58:53 +0000
+++ b/storage/perfschema/pfs_setup_object.h 2012-05-15 09:39:47 +0000
@@ -45,7 +45,7 @@ struct PFS_setup_object_key
};
/** A setup_object record. */
-struct PFS_setup_object
+struct PFS_ALIGNED PFS_setup_object
{
enum_object_type get_object_type()
{
@@ -96,6 +96,8 @@ extern ulong setup_object_max;
extern PFS_setup_object *setup_object_array;
+extern LF_HASH setup_object_hash;
+
/** @} */
#endif
=== modified file 'storage/perfschema/pfs_user.cc'
--- a/storage/perfschema/pfs_user.cc 2011-08-25 07:53:21 +0000
+++ b/storage/perfschema/pfs_user.cc 2012-05-15 09:39:47 +0000
@@ -42,7 +42,7 @@ static PFS_single_stat *user_instr_class
static PFS_stage_stat *user_instr_class_stages_array= NULL;
static PFS_statement_stat *user_instr_class_statements_array= NULL;
-static LF_HASH user_hash;
+LF_HASH user_hash;
static bool user_hash_inited= false;
/**
@@ -146,10 +146,11 @@ C_MODE_END
*/
int init_user_hash(void)
{
- if (! user_hash_inited)
+ if ((! user_hash_inited) && (user_max > 0))
{
lf_hash_init(&user_hash, sizeof(PFS_user*), LF_HASH_UNIQUE,
0, 0, user_hash_get_key, &my_charset_bin);
+ user_hash.size= user_max;
user_hash_inited= true;
}
return 0;
=== modified file 'storage/perfschema/pfs_user.h'
--- a/storage/perfschema/pfs_user.h 2011-05-18 23:29:02 +0000
+++ b/storage/perfschema/pfs_user.h 2012-05-15 09:39:47 +0000
@@ -44,7 +44,7 @@ struct PFS_user_key
uint m_key_length;
};
-struct PFS_user : public PFS_connection_slice
+struct PFS_ALIGNED PFS_user : public PFS_connection_slice
{
public:
inline void init_refcount(void)
@@ -108,6 +108,8 @@ extern ulong user_lost;
extern PFS_user *user_array;
+extern LF_HASH user_hash;
+
/** @} */
#endif
=== modified file 'storage/perfschema/pfs_visitor.cc'
--- a/storage/perfschema/pfs_visitor.cc 2012-03-19 19:29:28 +0000
+++ b/storage/perfschema/pfs_visitor.cc 2012-05-15 09:39:47 +0000
@@ -959,13 +959,8 @@ PFS_object_wait_visitor::~PFS_object_wai
void PFS_object_wait_visitor::visit_global()
{
- uint index;
-
- index= global_table_io_class.m_event_name_index;
- m_stat.aggregate(& global_instr_class_waits_array[index]);
-
- index= global_table_lock_class.m_event_name_index;
- m_stat.aggregate(& global_instr_class_waits_array[index]);
+ global_table_io_stat.sum(& m_stat);
+ global_table_lock_stat.sum(& m_stat);
}
void PFS_object_wait_visitor::visit_table_share(PFS_table_share *pfs)
@@ -992,8 +987,7 @@ PFS_table_io_wait_visitor::~PFS_table_io
void PFS_table_io_wait_visitor::visit_global()
{
- uint index= global_table_io_class.m_event_name_index;
- m_stat.aggregate(& global_instr_class_waits_array[index]);
+ global_table_io_stat.sum(& m_stat);
}
void PFS_table_io_wait_visitor::visit_table_share(PFS_table_share *pfs)
@@ -1100,8 +1094,7 @@ PFS_table_lock_wait_visitor::~PFS_table_
void PFS_table_lock_wait_visitor::visit_global()
{
- uint index= global_table_lock_class.m_event_name_index;
- m_stat.aggregate(& global_instr_class_waits_array[index]);
+ global_table_lock_stat.sum(& m_stat);
}
void PFS_table_lock_wait_visitor::visit_table_share(PFS_table_share *pfs)
=== modified file 'storage/perfschema/table_esgs_global_by_event_name.cc'
--- a/storage/perfschema/table_esgs_global_by_event_name.cc 2012-01-24 23:42:36 +0000
+++ b/storage/perfschema/table_esgs_global_by_event_name.cc 2012-05-15 09:39:47 +0000
@@ -95,6 +95,9 @@ int
table_esgs_global_by_event_name::delete_all_rows(void)
{
reset_events_stages_by_thread();
+ reset_events_stages_by_account();
+ reset_events_stages_by_user();
+ reset_events_stages_by_host();
reset_events_stages_global();
return 0;
}
=== modified file 'storage/perfschema/table_esms_global_by_event_name.cc'
--- a/storage/perfschema/table_esms_global_by_event_name.cc 2012-01-24 23:42:36 +0000
+++ b/storage/perfschema/table_esms_global_by_event_name.cc 2012-05-15 09:39:47 +0000
@@ -190,6 +190,9 @@ int
table_esms_global_by_event_name::delete_all_rows(void)
{
reset_events_statements_by_thread();
+ reset_events_statements_by_account();
+ reset_events_statements_by_user();
+ reset_events_statements_by_host();
reset_events_statements_global();
return 0;
}
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (marc.alff:3835 to 3836) Bug#12346211 | Marc Alff | 15 May |