Commit ec412876 authored by Marc Alff's avatar Marc Alff

Bug#55087 Performance schema: optimization of the instrumentation interface

This change is for performance optimization.

Fixed the performance schema instrumentation interface as follows:
- simplified mysql_unlock_mutex()
- simplified mysql_unlock_rwlock()
- simplified mysql_cond_signal()
- simplified mysql_cond_broadcast()

Changed the get_thread_XXX_locker apis to have one extra parameter,
to provide memory to the instrumentation implementation.
This API change allows to use memory provided by the caller,
to avoid having to use thread local storage.
Using this extra parameter will be done in a separate fix,
this change is for the interface only.

Adjusted all the code and unit tests accordingly.
parent f56dd32b
......@@ -506,9 +506,10 @@ inline_mysql_file_fgets(
char *result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_READ);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) size, src_file, src_line);
......@@ -532,9 +533,10 @@ inline_mysql_file_fgetc(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_READ);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line);
......@@ -558,10 +560,11 @@ inline_mysql_file_fputs(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
size_t bytes= 0;
if (likely(PSI_server && file->m_psi))
{
locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_WRITE);
if (likely(locker != NULL))
{
......@@ -588,9 +591,10 @@ inline_mysql_file_fputc(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_WRITE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 1, src_file, src_line);
......@@ -614,9 +618,10 @@ inline_mysql_file_fprintf(MYSQL_FILE *file, const char *format, ...)
va_list args;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_WRITE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, __FILE__, __LINE__);
......@@ -642,9 +647,10 @@ inline_mysql_file_vfprintf(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_WRITE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
......@@ -668,9 +674,10 @@ inline_mysql_file_fflush(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_FLUSH);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
......@@ -700,9 +707,10 @@ inline_mysql_file_fstat(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_descriptor_locker(filenr,
locker= PSI_server->get_thread_file_descriptor_locker(&state, filenr,
PSI_FILE_FSTAT);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
......@@ -726,9 +734,11 @@ inline_mysql_file_stat(
MY_STAT *result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_STAT,
locker= PSI_server->get_thread_file_name_locker(&state,
key, PSI_FILE_STAT,
path, &locker);
if (likely(locker != NULL))
PSI_server->start_file_open_wait(locker, src_file, src_line);
......@@ -752,9 +762,10 @@ inline_mysql_file_chsize(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_descriptor_locker(file,
locker= PSI_server->get_thread_file_descriptor_locker(&state, file,
PSI_FILE_CHSIZE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) newlength, src_file,
......@@ -784,10 +795,11 @@ inline_mysql_file_fopen(
{
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_name_locker
(key, PSI_FILE_STREAM_OPEN, filename, that);
(&state, key, PSI_FILE_STREAM_OPEN, filename, that);
if (likely(locker != NULL))
that->m_psi= PSI_server->start_file_open_wait(locker, src_file,
src_line);
......@@ -820,10 +832,11 @@ inline_mysql_file_fclose(
{
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
DBUG_ASSERT(file != NULL);
if (likely(PSI_server && file->m_psi))
{
locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_STREAM_CLOSE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
......@@ -849,9 +862,10 @@ inline_mysql_file_fread(
size_t result= 0;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_READ);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, count, src_file, src_line);
......@@ -882,9 +896,10 @@ inline_mysql_file_fwrite(
size_t result= 0;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_WRITE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, count, src_file, src_line);
......@@ -915,9 +930,10 @@ inline_mysql_file_fseek(
my_off_t result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_SEEK);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
......@@ -941,9 +957,10 @@ inline_mysql_file_ftell(
my_off_t result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server && file->m_psi))
{
locker= PSI_server->get_thread_file_stream_locker(file->m_psi,
locker= PSI_server->get_thread_file_stream_locker(&state, file->m_psi,
PSI_FILE_TELL);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
......@@ -967,9 +984,10 @@ inline_mysql_file_create(
File file;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_CREATE,
locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_CREATE,
filename, &locker);
if (likely(locker != NULL))
PSI_server->start_file_open_wait(locker, src_file, src_line);
......@@ -1014,9 +1032,10 @@ inline_mysql_file_open(
File file;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_OPEN,
locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_OPEN,
filename, &locker);
if (likely(locker != NULL))
PSI_server->start_file_open_wait(locker, src_file, src_line);
......@@ -1040,9 +1059,10 @@ inline_mysql_file_close(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_descriptor_locker(file,
locker= PSI_server->get_thread_file_descriptor_locker(&state, file,
PSI_FILE_CLOSE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
......@@ -1066,9 +1086,10 @@ inline_mysql_file_read(
size_t result= 0;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_descriptor_locker(file,
locker= PSI_server->get_thread_file_descriptor_locker(&state, file,
PSI_FILE_READ);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, count, src_file, src_line);
......@@ -1099,9 +1120,10 @@ inline_mysql_file_write(
size_t result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_descriptor_locker(file,
locker= PSI_server->get_thread_file_descriptor_locker(&state, file,
PSI_FILE_WRITE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, count, src_file, src_line);
......@@ -1132,9 +1154,10 @@ inline_mysql_file_pread(
size_t result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_descriptor_locker(file, PSI_FILE_READ);
locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_READ);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, count, src_file, src_line);
}
......@@ -1164,9 +1187,10 @@ inline_mysql_file_pwrite(
size_t result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_descriptor_locker(file,
locker= PSI_server->get_thread_file_descriptor_locker(&state, file,
PSI_FILE_WRITE);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, count, src_file, src_line);
......@@ -1197,9 +1221,10 @@ inline_mysql_file_seek(
my_off_t result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_descriptor_locker(file, PSI_FILE_SEEK);
locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_SEEK);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
}
......@@ -1222,9 +1247,10 @@ inline_mysql_file_tell(
my_off_t result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_descriptor_locker(file, PSI_FILE_TELL);
locker= PSI_server->get_thread_file_descriptor_locker(&state, file, PSI_FILE_TELL);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
}
......@@ -1247,9 +1273,10 @@ inline_mysql_file_delete(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_DELETE,
locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_DELETE,
name, &locker);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
......@@ -1273,9 +1300,10 @@ inline_mysql_file_rename(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_RENAME,
locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_RENAME,
to, &locker);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
......@@ -1300,9 +1328,10 @@ inline_mysql_file_create_with_symlink(
File file;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_CREATE,
locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_CREATE,
filename, &locker);
if (likely(locker != NULL))
PSI_server->start_file_open_wait(locker, src_file, src_line);
......@@ -1327,9 +1356,10 @@ inline_mysql_file_delete_with_symlink(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_DELETE,
locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_DELETE,
name, &locker);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
......@@ -1353,9 +1383,10 @@ inline_mysql_file_rename_with_symlink(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_name_locker(key, PSI_FILE_RENAME,
locker= PSI_server->get_thread_file_name_locker(&state, key, PSI_FILE_RENAME,
to, &locker);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
......@@ -1379,9 +1410,10 @@ inline_mysql_file_sync(
int result= 0;
#ifdef HAVE_PSI_INTERFACE
struct PSI_file_locker *locker= NULL;
PSI_file_locker_state state;
if (likely(PSI_server != NULL))
{
locker= PSI_server->get_thread_file_descriptor_locker(fd, PSI_FILE_SYNC);
locker= PSI_server->get_thread_file_descriptor_locker(&state, fd, PSI_FILE_SYNC);
if (likely(locker != NULL))
PSI_server->start_file_wait(locker, (size_t) 0, src_file, src_line);
}
......
......@@ -625,9 +625,10 @@ static inline int inline_mysql_mutex_lock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_mutex_locker *locker= NULL;
PSI_mutex_locker_state state;
if (likely(PSI_server && that->m_psi))
{
locker= PSI_server->get_thread_mutex_locker(that->m_psi, PSI_MUTEX_LOCK);
locker= PSI_server->get_thread_mutex_locker(&state, that->m_psi, PSI_MUTEX_LOCK);
if (likely(locker != NULL))
PSI_server->start_mutex_wait(locker, src_file, src_line);
}
......@@ -654,9 +655,10 @@ static inline int inline_mysql_mutex_trylock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_mutex_locker *locker= NULL;
PSI_mutex_locker_state state;
if (likely(PSI_server && that->m_psi))
{
locker= PSI_server->get_thread_mutex_locker(that->m_psi, PSI_MUTEX_TRYLOCK);
locker= PSI_server->get_thread_mutex_locker(&state, that->m_psi, PSI_MUTEX_TRYLOCK);
if (likely(locker != NULL))
PSI_server->start_mutex_wait(locker, src_file, src_line);
}
......@@ -682,13 +684,8 @@ static inline int inline_mysql_mutex_unlock(
{
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_thread *thread;
if (likely(PSI_server && that->m_psi))
{
thread= PSI_server->get_thread();
if (likely(thread != NULL))
PSI_server->unlock_mutex(thread, that->m_psi);
}
PSI_server->unlock_mutex(that->m_psi);
#endif
#ifdef SAFE_MUTEX
result= safe_mutex_unlock(&that->m_mutex, src_file, src_line);
......@@ -771,9 +768,10 @@ static inline int inline_mysql_rwlock_rdlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_READLOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_rdwait(locker, src_file, src_line);
......@@ -798,9 +796,10 @@ static inline int inline_mysql_prlock_rdlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_READLOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_rdwait(locker, src_file, src_line);
......@@ -825,9 +824,10 @@ static inline int inline_mysql_rwlock_wrlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_WRITELOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_wrwait(locker, src_file, src_line);
......@@ -852,9 +852,10 @@ static inline int inline_mysql_prlock_wrlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_WRITELOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_wrwait(locker, src_file, src_line);
......@@ -879,9 +880,10 @@ static inline int inline_mysql_rwlock_tryrdlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_TRYREADLOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_rdwait(locker, src_file, src_line);
......@@ -906,9 +908,10 @@ static inline int inline_mysql_prlock_tryrdlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_TRYREADLOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_rdwait(locker, src_file, src_line);
......@@ -933,9 +936,10 @@ static inline int inline_mysql_rwlock_trywrlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_TRYWRITELOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_wrwait(locker, src_file, src_line);
......@@ -960,9 +964,10 @@ static inline int inline_mysql_prlock_trywrlock(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_rwlock_locker *locker= NULL;
PSI_rwlock_locker_state state;
if (likely(PSI_server && that->m_psi))
{
locker= PSI_server->get_thread_rwlock_locker(that->m_psi,
locker= PSI_server->get_thread_rwlock_locker(&state, that->m_psi,
PSI_RWLOCK_TRYWRITELOCK);
if (likely(locker != NULL))
PSI_server->start_rwlock_wrwait(locker, src_file, src_line);
......@@ -982,13 +987,8 @@ static inline int inline_mysql_rwlock_unlock(
{
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_thread *thread;
if (likely(PSI_server && that->m_psi))
{
thread= PSI_server->get_thread();
if (likely(thread != NULL))
PSI_server->unlock_rwlock(thread, that->m_psi);
}
PSI_server->unlock_rwlock(that->m_psi);
#endif
result= rw_unlock(&that->m_rwlock);
return result;
......@@ -1000,13 +1000,8 @@ static inline int inline_mysql_prlock_unlock(
{
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_thread *thread;
if (likely(PSI_server && that->m_psi))
{
thread= PSI_server->get_thread();
if (likely(thread != NULL))
PSI_server->unlock_rwlock(thread, that->m_psi);
}
PSI_server->unlock_rwlock(that->m_psi);
#endif
result= rw_pr_unlock(&that->m_prlock);
return result;
......@@ -1053,9 +1048,10 @@ static inline int inline_mysql_cond_wait(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_cond_locker *locker= NULL;
PSI_cond_locker_state state;
if (likely(PSI_server && that->m_psi))
{
locker= PSI_server->get_thread_cond_locker(that->m_psi, mutex->m_psi,
locker= PSI_server->get_thread_cond_locker(&state, that->m_psi, mutex->m_psi,
PSI_COND_WAIT);
if (likely(locker != NULL))
PSI_server->start_cond_wait(locker, src_file, src_line);
......@@ -1081,9 +1077,10 @@ static inline int inline_mysql_cond_timedwait(
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_cond_locker *locker= NULL;
PSI_cond_locker_state state;
if (likely(PSI_server && that->m_psi))
{
locker= PSI_server->get_thread_cond_locker(that->m_psi, mutex->m_psi,
locker= PSI_server->get_thread_cond_locker(&state, that->m_psi, mutex->m_psi,
PSI_COND_TIMEDWAIT);
if (likely(locker != NULL))
PSI_server->start_cond_wait(locker, src_file, src_line);
......@@ -1102,13 +1099,8 @@ static inline int inline_mysql_cond_signal(
{
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_thread *thread;
if (likely(PSI_server && that->m_psi))
{
thread= PSI_server->get_thread();
if (likely(thread != NULL))
PSI_server->signal_cond(thread, that->m_psi);
}
PSI_server->signal_cond(that->m_psi);
#endif
result= pthread_cond_signal(&that->m_cond);
return result;
......@@ -1119,13 +1111,8 @@ static inline int inline_mysql_cond_broadcast(
{
int result;
#ifdef HAVE_PSI_INTERFACE
struct PSI_thread *thread;
if (likely(PSI_server && that->m_psi))
{
thread= PSI_server->get_thread();
if (likely(thread != NULL))
PSI_server->broadcast_cond(thread, that->m_psi);
}
PSI_server->broadcast_cond(that->m_psi);
#endif
result= pthread_cond_broadcast(&that->m_cond);
return result;
......
......@@ -422,6 +422,175 @@ struct PSI_file_info_v1
int m_flags;
};
/**
State data storage for @c get_thread_mutex_locker_v1_t.
This structure provide temporary storage to a mutex locker.
The content of this structure is considered opaque,
the fields are only hints of what an implementation
of the psi interface can use.
This memory is provided by the instrumented code for performance reasons.
@sa get_thread_mutex_locker_v1_t
*/
struct PSI_mutex_locker_state_v1
{
/** Internal state. */
uint m_flags;
/** Current mutex. */
struct PSI_mutex *m_mutex;
/** Current thread. */
struct PSI_thread *m_thread;
/** Timer start. */
ulonglong m_timer_start;
/** Timer function. */
ulonglong (*m_timer)(void);
/** Current operation. */
enum PSI_mutex_operation m_operation;
/** Source file. */
const char* m_src_file;
/** Source line number. */
int m_src_line;
/** Internal data. */
void *m_wait;
};
/**
State data storage for @c get_thread_rwlock_locker_v1_t.
This structure provide temporary storage to a rwlock locker.
The content of this structure is considered opaque,
the fields are only hints of what an implementation
of the psi interface can use.
This memory is provided by the instrumented code for performance reasons.
@sa get_thread_rwlock_locker_v1_t
*/
struct PSI_rwlock_locker_state_v1
{
/** Internal state. */
uint m_flags;
/** Current rwlock. */
struct PSI_rwlock *m_rwlock;
/** Current thread. */
struct PSI_thread *m_thread;
/** Timer start. */
ulonglong m_timer_start;
/** Timer function. */
ulonglong (*m_timer)(void);
/** Current operation. */
enum PSI_rwlock_operation m_operation;
/** Source file. */
const char* m_src_file;
/** Source line number. */
int m_src_line;
/** Internal data. */
void *m_wait;
};
/**
State data storage for @c get_thread_cond_locker_v1_t.
This structure provide temporary storage to a condition locker.
The content of this structure is considered opaque,
the fields are only hints of what an implementation
of the psi interface can use.
This memory is provided by the instrumented code for performance reasons.
@sa get_thread_cond_locker_v1_t
*/
struct PSI_cond_locker_state_v1
{
/** Internal state. */
uint m_flags;
/** Current condition. */
struct PSI_cond *m_cond;
/** Current mutex. */
struct PSI_mutex *m_mutex;
/** Current thread. */
struct PSI_thread *m_thread;
/** Timer start. */
ulonglong m_timer_start;
/** Timer function. */
ulonglong (*m_timer)(void);
/** Current operation. */
enum PSI_cond_operation m_operation;
/** Source file. */
const char* m_src_file;
/** Source line number. */
int m_src_line;
/** Internal data. */
void *m_wait;
};
/**
State data storage for @c get_thread_file_name_locker_v1_t.
This structure provide temporary storage to a file locker.
The content of this structure is considered opaque,
the fields are only hints of what an implementation
of the psi interface can use.
This memory is provided by the instrumented code for performance reasons.
@sa get_thread_file_name_locker_v1_t
@sa get_thread_file_stream_locker_v1_t
@sa get_thread_file_descriptor_locker_v1_t
*/
struct PSI_file_locker_state_v1
{
/** Internal state. */
uint m_flags;
/** Current file. */
struct PSI_file *m_file;
/** Current thread. */
struct PSI_thread *m_thread;
/** Operation number of bytes. */
size_t m_number_of_bytes;
/** Timer start. */
ulonglong m_timer_start;
/** Timer function. */
ulonglong (*m_timer)(void);
/** Current operation. */
enum PSI_file_operation m_operation;
/** Source file. */
const char* m_src_file;
/** Source line number. */
int m_src_line;
/** Internal data. */
void *m_wait;
};
/**
State data storage for @c get_thread_table_locker_v1_t.
This structure provide temporary storage to a table locker.
The content of this structure is considered opaque,
the fields are only hints of what an implementation
of the psi interface can use.
This memory is provided by the instrumented code for performance reasons.
@sa get_thread_table_locker_v1_t
*/
struct PSI_table_locker_state_v1
{
/** Internal state. */
uint m_flags;
/** Current table handle. */
struct PSI_table *m_table;
/** Current table share. */
struct PSI_table_share *m_table_share;
/** Instrumentation class. */
void *m_class;
/** Current thread. */
struct PSI_thread *m_thread;
/** Timer start. */
ulonglong m_timer_start;
/** Timer function. */
ulonglong (*m_timer)(void);
/* Current operation (waiting for WL#4895). */
/* enum PSI_table_operation m_operation; */
/** Current table io index. */
uint m_index;
/** Current table lock index. */
uint m_lock_index;
/** Source file. */
const char* m_src_file;
/** Source line number. */
int m_src_line;
/** Internal data. */
void *m_wait;
};
/* Using typedef to make reuse between PSI_v1 and PSI_v2 easier later. */
/**
......@@ -619,40 +788,51 @@ typedef void (*delete_thread_v1_t)(struct PSI_thread *thread);
/**
Get a mutex instrumentation locker.
@param state data storage for the locker
@param mutex the instrumented mutex to lock
@return a mutex locker, or NULL
*/
typedef struct PSI_mutex_locker* (*get_thread_mutex_locker_v1_t)
(struct PSI_mutex *mutex, enum PSI_mutex_operation op);
(struct PSI_mutex_locker_state_v1 *state,
struct PSI_mutex *mutex,
enum PSI_mutex_operation op);
/**
Get a rwlock instrumentation locker.
@param state data storage for the locker
@param rwlock the instrumented rwlock to lock
@return a rwlock locker, or NULL
*/
typedef struct PSI_rwlock_locker* (*get_thread_rwlock_locker_v1_t)
(struct PSI_rwlock *rwlock, enum PSI_rwlock_operation op);
(struct PSI_rwlock_locker_state_v1 *state,
struct PSI_rwlock *rwlock,
enum PSI_rwlock_operation op);
/**
Get a cond instrumentation locker.
@param state data storage for the locker
@param cond the instrumented condition to wait on
@param mutex the instrumented mutex associated with the condition
@return a condition locker, or NULL
*/
typedef struct PSI_cond_locker* (*get_thread_cond_locker_v1_t)
(struct PSI_cond *cond, struct PSI_mutex *mutex,
(struct PSI_cond_locker_state_v1 *state,
struct PSI_cond *cond, struct PSI_mutex *mutex,
enum PSI_cond_operation op);
/**
Get a table instrumentation locker.
@param state data storage for the locker
@param table the instrumented table to lock
@return a table locker, or NULL
*/
typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t)
(struct PSI_table *table);
(struct PSI_table_locker_state_v1 *state,
struct PSI_table *table);
/**
Get a file instrumentation locker, for opening or creating a file.
@param state data storage for the locker
@param key the file instrumentation key
@param op the operation to perform
@param name the file name
......@@ -660,58 +840,59 @@ typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t)
@return a file locker, or NULL
*/
typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t)
(PSI_file_key key, enum PSI_file_operation op, const char *name,
(struct PSI_file_locker_state_v1 *state,
PSI_file_key key, enum PSI_file_operation op, const char *name,
const void *identity);
/**
Get a file stream instrumentation locker.
@param state data storage for the locker
@param file the file stream to access
@param op the operation to perform
@return a file locker, or NULL
*/
typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t)
(struct PSI_file *file, enum PSI_file_operation op);
(struct PSI_file_locker_state_v1 *state,
struct PSI_file *file, enum PSI_file_operation op);
/**
Get a file instrumentation locker.
@param state data storage for the locker
@param file the file descriptor to access
@param op the operation to perform
@return a file locker, or NULL
*/
typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t)
(File file, enum PSI_file_operation op);
(struct PSI_file_locker_state_v1 *state,
File file, enum PSI_file_operation op);
/**
Record a mutex instrumentation unlock event.
@param thread the running thread instrumentation
@param mutex the mutex instrumentation
*/
typedef void (*unlock_mutex_v1_t)
(struct PSI_thread *thread, struct PSI_mutex *mutex);
(struct PSI_mutex *mutex);
/**
Record a rwlock instrumentation unlock event.
@param thread the running thread instrumentation
@param rwlock the rwlock instrumentation
*/
typedef void (*unlock_rwlock_v1_t)
(struct PSI_thread *thread, struct PSI_rwlock *rwlock);
(struct PSI_rwlock *rwlock);
/**
Record a condition instrumentation signal event.
@param thread the running thread instrumentation
@param cond the cond instrumentation
*/
typedef void (*signal_cond_v1_t)
(struct PSI_thread *thread, struct PSI_cond *cond);
(struct PSI_cond *cond);
/**
Record a condition instrumentation broadcast event.
@param thread the running thread instrumentation
@param cond the cond instrumentation
*/
typedef void (*broadcast_cond_v1_t)
(struct PSI_thread *thread, struct PSI_cond *cond);
(struct PSI_cond *cond);
/**
Record a mutex instrumentation wait start event.
......@@ -1013,6 +1194,36 @@ struct PSI_file_info_v2
int placeholder;
};
struct PSI_mutex_locker_state_v2
{
/** Placeholder */
int placeholder;
};
struct PSI_rwlock_locker_state_v2
{
/** Placeholder */
int placeholder;
};
struct PSI_cond_locker_state_v2
{
/** Placeholder */
int placeholder;
};
struct PSI_file_locker_state_v2
{
/** Placeholder */
int placeholder;
};
struct PSI_table_locker_state_v2
{
/** Placeholder */
int placeholder;
};
/** @} (end of group Group_PSI_v2) */
#endif /* HAVE_PSI_2 */
......@@ -1056,6 +1267,11 @@ typedef struct PSI_rwlock_info_v1 PSI_rwlock_info;
typedef struct PSI_cond_info_v1 PSI_cond_info;
typedef struct PSI_thread_info_v1 PSI_thread_info;
typedef struct PSI_file_info_v1 PSI_file_info;
typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state;
typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state;
typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state;
typedef struct PSI_file_locker_state_v1 PSI_file_locker_state;
typedef struct PSI_table_locker_state_v1 PSI_table_locker_state;
#endif
#ifdef USE_PSI_2
......@@ -1065,6 +1281,11 @@ typedef struct PSI_rwlock_info_v2 PSI_rwlock_info;
typedef struct PSI_cond_info_v2 PSI_cond_info;
typedef struct PSI_thread_info_v2 PSI_thread_info;
typedef struct PSI_file_info_v2 PSI_file_info;
typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state;
typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state;
typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state;
typedef struct PSI_file_locker_state_v2 PSI_file_locker_state;
typedef struct PSI_table_locker_state_v2 PSI_table_locker_state;
#endif
#else /* HAVE_PSI_INTERFACE */
......
......@@ -88,6 +88,71 @@ struct PSI_file_info_v1
const char *m_name;
int m_flags;
};
struct PSI_mutex_locker_state_v1
{
uint m_flags;
struct PSI_mutex *m_mutex;
struct PSI_thread *m_thread;
ulonglong m_timer_start;
ulonglong (*m_timer)(void);
enum PSI_mutex_operation m_operation;
const char* m_src_file;
int m_src_line;
void *m_wait;
};
struct PSI_rwlock_locker_state_v1
{
uint m_flags;
struct PSI_rwlock *m_rwlock;
struct PSI_thread *m_thread;
ulonglong m_timer_start;
ulonglong (*m_timer)(void);
enum PSI_rwlock_operation m_operation;
const char* m_src_file;
int m_src_line;
void *m_wait;
};
struct PSI_cond_locker_state_v1
{
uint m_flags;
struct PSI_cond *m_cond;
struct PSI_mutex *m_mutex;
struct PSI_thread *m_thread;
ulonglong m_timer_start;
ulonglong (*m_timer)(void);
enum PSI_cond_operation m_operation;
const char* m_src_file;
int m_src_line;
void *m_wait;
};
struct PSI_file_locker_state_v1
{
uint m_flags;
struct PSI_file *m_file;
struct PSI_thread *m_thread;
size_t m_number_of_bytes;
ulonglong m_timer_start;
ulonglong (*m_timer)(void);
enum PSI_file_operation m_operation;
const char* m_src_file;
int m_src_line;
void *m_wait;
};
struct PSI_table_locker_state_v1
{
uint m_flags;
struct PSI_table *m_table;
struct PSI_table_share *m_table_share;
void *m_class;
struct PSI_thread *m_thread;
ulonglong m_timer_start;
ulonglong (*m_timer)(void);
uint m_index;
uint m_lock_index;
const char* m_src_file;
int m_src_line;
void *m_wait;
};
typedef void (*register_mutex_v1_t)
(const char *category, struct PSI_mutex_info_v1 *info, int count);
typedef void (*register_rwlock_v1_t)
......@@ -129,29 +194,38 @@ typedef void (*set_thread_v1_t)(struct PSI_thread *thread);
typedef void (*delete_current_thread_v1_t)(void);
typedef void (*delete_thread_v1_t)(struct PSI_thread *thread);
typedef struct PSI_mutex_locker* (*get_thread_mutex_locker_v1_t)
(struct PSI_mutex *mutex, enum PSI_mutex_operation op);
(struct PSI_mutex_locker_state_v1 *state,
struct PSI_mutex *mutex,
enum PSI_mutex_operation op);
typedef struct PSI_rwlock_locker* (*get_thread_rwlock_locker_v1_t)
(struct PSI_rwlock *rwlock, enum PSI_rwlock_operation op);
(struct PSI_rwlock_locker_state_v1 *state,
struct PSI_rwlock *rwlock,
enum PSI_rwlock_operation op);
typedef struct PSI_cond_locker* (*get_thread_cond_locker_v1_t)
(struct PSI_cond *cond, struct PSI_mutex *mutex,
(struct PSI_cond_locker_state_v1 *state,
struct PSI_cond *cond, struct PSI_mutex *mutex,
enum PSI_cond_operation op);
typedef struct PSI_table_locker* (*get_thread_table_locker_v1_t)
(struct PSI_table *table);
(struct PSI_table_locker_state_v1 *state,
struct PSI_table *table);
typedef struct PSI_file_locker* (*get_thread_file_name_locker_v1_t)
(PSI_file_key key, enum PSI_file_operation op, const char *name,
(struct PSI_file_locker_state_v1 *state,
PSI_file_key key, enum PSI_file_operation op, const char *name,
const void *identity);
typedef struct PSI_file_locker* (*get_thread_file_stream_locker_v1_t)
(struct PSI_file *file, enum PSI_file_operation op);
(struct PSI_file_locker_state_v1 *state,
struct PSI_file *file, enum PSI_file_operation op);
typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t)
(File file, enum PSI_file_operation op);
(struct PSI_file_locker_state_v1 *state,
File file, enum PSI_file_operation op);
typedef void (*unlock_mutex_v1_t)
(struct PSI_thread *thread, struct PSI_mutex *mutex);
(struct PSI_mutex *mutex);
typedef void (*unlock_rwlock_v1_t)
(struct PSI_thread *thread, struct PSI_rwlock *rwlock);
(struct PSI_rwlock *rwlock);
typedef void (*signal_cond_v1_t)
(struct PSI_thread *thread, struct PSI_cond *cond);
(struct PSI_cond *cond);
typedef void (*broadcast_cond_v1_t)
(struct PSI_thread *thread, struct PSI_cond *cond);
(struct PSI_cond *cond);
typedef void (*start_mutex_wait_v1_t)
(struct PSI_mutex_locker *locker, const char *src_file, uint src_line);
typedef void (*end_mutex_wait_v1_t)
......@@ -240,5 +314,10 @@ typedef struct PSI_rwlock_info_v1 PSI_rwlock_info;
typedef struct PSI_cond_info_v1 PSI_cond_info;
typedef struct PSI_thread_info_v1 PSI_thread_info;
typedef struct PSI_file_info_v1 PSI_file_info;
typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state;
typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state;
typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state;
typedef struct PSI_file_locker_state_v1 PSI_file_locker_state;
typedef struct PSI_table_locker_state_v1 PSI_table_locker_state;
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
C_MODE_END
......@@ -82,11 +82,36 @@ struct PSI_file_info_v2
{
int placeholder;
};
struct PSI_mutex_locker_state_v2
{
int placeholder;
};
struct PSI_rwlock_locker_state_v2
{
int placeholder;
};
struct PSI_cond_locker_state_v2
{
int placeholder;
};
struct PSI_file_locker_state_v2
{
int placeholder;
};
struct PSI_table_locker_state_v2
{
int placeholder;
};
typedef struct PSI_v2 PSI;
typedef struct PSI_mutex_info_v2 PSI_mutex_info;
typedef struct PSI_rwlock_info_v2 PSI_rwlock_info;
typedef struct PSI_cond_info_v2 PSI_cond_info;
typedef struct PSI_thread_info_v2 PSI_thread_info;
typedef struct PSI_file_info_v2 PSI_file_info;
typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state;
typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state;
typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state;
typedef struct PSI_file_locker_state_v2 PSI_file_locker_state;
typedef struct PSI_table_locker_state_v2 PSI_table_locker_state;
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
C_MODE_END
......@@ -194,12 +194,12 @@ various file I/O operations with performance schema.
used to register file creation, opening, closing and renaming.
2) register_pfs_file_io_begin() and register_pfs_file_io_end() are
used to register actual file read, write and flush */
# define register_pfs_file_open_begin(locker, key, op, name, \
# define register_pfs_file_open_begin(state, locker, key, op, name, \
src_file, src_line) \
do { \
if (PSI_server) { \
locker = PSI_server->get_thread_file_name_locker( \
key, op, name, &locker); \
state, key, op, name, &locker); \
if (locker) { \
PSI_server->start_file_open_wait( \
locker, src_file, src_line); \
......@@ -215,12 +215,12 @@ do { \
} \
} while (0)
# define register_pfs_file_io_begin(locker, file, count, op, \
# define register_pfs_file_io_begin(state, locker, file, count, op, \
src_file, src_line) \
do { \
if (PSI_server) { \
locker = PSI_server->get_thread_file_descriptor_locker( \
file, op); \
state, file, op); \
if (locker) { \
PSI_server->start_file_wait( \
locker, count, src_file, src_line); \
......
......@@ -55,9 +55,10 @@ pfs_os_file_create_simple_func(
{
os_file_t file;
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
/* register a file open or creation depending on "create_mode" */
register_pfs_file_open_begin(locker, key,
register_pfs_file_open_begin(&state, locker, key,
((create_mode == OS_FILE_CREATE)
? PSI_FILE_CREATE
: PSI_FILE_OPEN),
......@@ -101,9 +102,10 @@ pfs_os_file_create_simple_no_error_handling_func(
{
os_file_t file;
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
/* register a file open or creation depending on "create_mode" */
register_pfs_file_open_begin(locker, key,
register_pfs_file_open_begin(&state, locker, key,
((create_mode == OS_FILE_CREATE)
? PSI_FILE_CREATE
: PSI_FILE_OPEN),
......@@ -153,9 +155,10 @@ pfs_os_file_create_func(
{
os_file_t file;
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
/* register a file open or creation depending on "create_mode" */
register_pfs_file_open_begin(locker, key,
register_pfs_file_open_begin(&state, locker, key,
((create_mode == OS_FILE_CREATE)
? PSI_FILE_CREATE
: PSI_FILE_OPEN),
......@@ -183,9 +186,10 @@ pfs_os_file_close_func(
{
ibool result;
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
/* register the file close */
register_pfs_file_io_begin(locker, file, 0, PSI_FILE_CLOSE,
register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_CLOSE,
src_file, src_line);
result = os_file_close_func(file);
......@@ -230,9 +234,10 @@ pfs_os_aio_func(
{
ibool result;
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
/* Register the read or write I/O depending on "type" */
register_pfs_file_io_begin(locker, file, n,
register_pfs_file_io_begin(&state, locker, file, n,
(type == OS_FILE_WRITE)
? PSI_FILE_WRITE
: PSI_FILE_READ,
......@@ -268,8 +273,9 @@ pfs_os_file_read_func(
{
ibool result;
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
register_pfs_file_io_begin(locker, file, n, PSI_FILE_READ,
register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ,
src_file, src_line);
result = os_file_read_func(file, buf, offset, offset_high, n);
......@@ -303,8 +309,9 @@ pfs_os_file_read_no_error_handling_func(
{
ibool result;
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
register_pfs_file_io_begin(locker, file, n, PSI_FILE_READ,
register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ,
src_file, src_line);
result = os_file_read_no_error_handling_func(file, buf, offset,
......@@ -339,8 +346,9 @@ pfs_os_file_write_func(
{
ibool result;
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
register_pfs_file_io_begin(locker, file, n, PSI_FILE_WRITE,
register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_WRITE,
src_file, src_line);
result = os_file_write_func(name, file, buf, offset, offset_high, n);
......@@ -366,8 +374,9 @@ pfs_os_file_flush_func(
{
ibool result;
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
register_pfs_file_io_begin(locker, file, 0, PSI_FILE_SYNC,
register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_SYNC,
src_file, src_line);
result = os_file_flush_func(file);
......@@ -395,8 +404,9 @@ pfs_os_file_rename_func(
{
ibool result;
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
register_pfs_file_open_begin(locker, key, PSI_FILE_RENAME, newpath,
register_pfs_file_open_begin(&state, locker, key, PSI_FILE_RENAME, newpath,
src_file, src_line);
result = os_file_rename_func(oldpath, newpath);
......
......@@ -676,11 +676,12 @@ pfs_rw_lock_x_lock_func(
ulint line) /*!< in: line where requested */
{
struct PSI_rwlock_locker* locker = NULL;
PSI_rwlock_locker_state state;
/* Record the entry of rw x lock request in performance schema */
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
locker = PSI_server->get_thread_rwlock_locker(
lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
&state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
if (locker) {
PSI_server->start_rwlock_wrwait(locker,
......@@ -710,12 +711,13 @@ pfs_rw_lock_x_lock_func_nowait(
ulint line) /*!< in: line where requested */
{
struct PSI_rwlock_locker* locker = NULL;
PSI_rwlock_locker_state state;
ibool ret;
/* Record the entry of rw x lock request in performance schema */
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
locker = PSI_server->get_thread_rwlock_locker(
lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
&state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK);
if (locker) {
PSI_server->start_rwlock_wrwait(locker,
......@@ -765,11 +767,12 @@ pfs_rw_lock_s_lock_func(
ulint line) /*!< in: line where requested */
{
struct PSI_rwlock_locker* locker = NULL;
PSI_rwlock_locker_state state;
/* Instrumented to inform we are aquiring a shared rwlock */
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
locker = PSI_server->get_thread_rwlock_locker(
lock->pfs_psi, PSI_RWLOCK_READLOCK);
&state, lock->pfs_psi, PSI_RWLOCK_READLOCK);
if (locker) {
PSI_server->start_rwlock_rdwait(locker,
file_name, line);
......@@ -800,12 +803,13 @@ pfs_rw_lock_s_lock_low(
{
struct PSI_rwlock_locker* locker = NULL;
PSI_rwlock_locker_state state;
ibool ret;
/* Instrumented to inform we are aquiring a shared rwlock */
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
locker = PSI_server->get_thread_rwlock_locker(
lock->pfs_psi, PSI_RWLOCK_READLOCK);
&state, lock->pfs_psi, PSI_RWLOCK_READLOCK);
if (locker) {
PSI_server->start_rwlock_rdwait(locker,
file_name, line);
......@@ -838,11 +842,7 @@ pfs_rw_lock_x_unlock_func(
{
/* Inform performance schema we are unlocking the lock */
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
struct PSI_thread* thread;
thread = PSI_server->get_thread();
if (thread) {
PSI_server->unlock_rwlock(thread, lock->pfs_psi);
}
PSI_server->unlock_rwlock(lock->pfs_psi);
}
rw_lock_x_unlock_func(
......@@ -869,11 +869,7 @@ pfs_rw_lock_s_unlock_func(
{
/* Inform performance schema we are unlocking the lock */
if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) {
struct PSI_thread* thread;
thread = PSI_server->get_thread();
if (thread) {
PSI_server->unlock_rwlock(thread, lock->pfs_psi);
}
PSI_server->unlock_rwlock(lock->pfs_psi);
}
rw_lock_s_unlock_func(
......
......@@ -237,11 +237,12 @@ pfs_mutex_enter_func(
ulint line) /*!< in: line where locked */
{
struct PSI_mutex_locker* locker = NULL;
PSI_mutex_locker_state state;
int result = 0;
if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) {
locker = PSI_server->get_thread_mutex_locker(
mutex->pfs_psi, PSI_MUTEX_LOCK);
&state, mutex->pfs_psi, PSI_MUTEX_LOCK);
if (locker) {
PSI_server->start_mutex_wait(locker, file_name, line);
}
......@@ -270,11 +271,12 @@ pfs_mutex_enter_nowait_func(
{
ulint ret;
struct PSI_mutex_locker* locker = NULL;
PSI_mutex_locker_state state;
int result = 0;
if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) {
locker = PSI_server->get_thread_mutex_locker(
mutex->pfs_psi, PSI_MUTEX_LOCK);
&state, mutex->pfs_psi, PSI_MUTEX_LOCK);
if (locker) {
PSI_server->start_mutex_wait(locker, file_name, line);
}
......@@ -300,12 +302,7 @@ pfs_mutex_exit_func(
mutex_t* mutex) /*!< in: pointer to mutex */
{
if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) {
struct PSI_thread* thread;
thread = PSI_server->get_thread();
if (thread) {
PSI_server->unlock_mutex(thread, mutex->pfs_psi);
}
PSI_server->unlock_mutex(mutex->pfs_psi);
}
mutex_exit_func(mutex);
......
......@@ -2165,7 +2165,8 @@ row_merge_file_create(
file APIs, add instrumentation to register with
performance schema */
struct PSI_file_locker* locker = NULL;
register_pfs_file_open_begin(locker, innodb_file_temp_key,
PSI_file_locker_state state;
register_pfs_file_open_begin(&state, locker, innodb_file_temp_key,
PSI_FILE_OPEN,
"Innodb Merge Temp File",
__FILE__, __LINE__);
......@@ -2188,7 +2189,8 @@ row_merge_file_destroy(
{
#ifdef UNIV_PFS_IO
struct PSI_file_locker* locker = NULL;
register_pfs_file_io_begin(locker, merge_file->fd, 0, PSI_FILE_CLOSE,
PSI_file_locker_state state;
register_pfs_file_io_begin(&state, locker, merge_file->fd, 0, PSI_FILE_CLOSE,
__FILE__, __LINE__);
#endif
if (merge_file->fd != -1) {
......
......@@ -1093,7 +1093,8 @@ static void delete_thread_v1(PSI_thread *thread)
}
static PSI_mutex_locker*
get_thread_mutex_locker_v1(PSI_mutex *mutex, PSI_mutex_operation op)
get_thread_mutex_locker_v1(PSI_mutex_locker_state *state,
PSI_mutex *mutex, PSI_mutex_operation op)
{
PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex*> (mutex);
DBUG_ASSERT((int) op >= 0);
......@@ -1138,7 +1139,8 @@ get_thread_mutex_locker_v1(PSI_mutex *mutex, PSI_mutex_operation op)
}
static PSI_rwlock_locker*
get_thread_rwlock_locker_v1(PSI_rwlock *rwlock, PSI_rwlock_operation op)
get_thread_rwlock_locker_v1(PSI_rwlock_locker_state *state,
PSI_rwlock *rwlock, PSI_rwlock_operation op)
{
PFS_rwlock *pfs_rwlock= reinterpret_cast<PFS_rwlock*> (rwlock);
DBUG_ASSERT(static_cast<int> (op) >= 0);
......@@ -1184,7 +1186,8 @@ get_thread_rwlock_locker_v1(PSI_rwlock *rwlock, PSI_rwlock_operation op)
}
static PSI_cond_locker*
get_thread_cond_locker_v1(PSI_cond *cond, PSI_mutex * /* unused: mutex */,
get_thread_cond_locker_v1(PSI_cond_locker_state *state,
PSI_cond *cond, PSI_mutex * /* unused: mutex */,
PSI_cond_operation op)
{
/*
......@@ -1242,7 +1245,8 @@ get_thread_cond_locker_v1(PSI_cond *cond, PSI_mutex * /* unused: mutex */,
}
static PSI_table_locker*
get_thread_table_locker_v1(PSI_table *table)
get_thread_table_locker_v1(PSI_table_locker_state *state,
PSI_table *table)
{
PFS_table *pfs_table= reinterpret_cast<PFS_table*> (table);
DBUG_ASSERT(pfs_table != NULL);
......@@ -1284,7 +1288,8 @@ get_thread_table_locker_v1(PSI_table *table)
}
static PSI_file_locker*
get_thread_file_name_locker_v1(PSI_file_key key,
get_thread_file_name_locker_v1(PSI_file_locker_state *state,
PSI_file_key key,
PSI_file_operation op,
const char *name, const void *identity)
{
......@@ -1341,7 +1346,8 @@ get_thread_file_name_locker_v1(PSI_file_key key,
}
static PSI_file_locker*
get_thread_file_stream_locker_v1(PSI_file *file, PSI_file_operation op)
get_thread_file_stream_locker_v1(PSI_file_locker_state *state,
PSI_file *file, PSI_file_operation op)
{
PFS_file *pfs_file= reinterpret_cast<PFS_file*> (file);
......@@ -1392,7 +1398,8 @@ get_thread_file_stream_locker_v1(PSI_file *file, PSI_file_operation op)
}
static PSI_file_locker*
get_thread_file_descriptor_locker_v1(File file, PSI_file_operation op)
get_thread_file_descriptor_locker_v1(PSI_file_locker_state *state,
File file, PSI_file_operation op)
{
int index= static_cast<int> (file);
......@@ -1462,7 +1469,7 @@ get_thread_file_descriptor_locker_v1(File file, PSI_file_operation op)
return NULL;
}
static void unlock_mutex_v1(PSI_thread * thread, PSI_mutex *mutex)
static void unlock_mutex_v1(PSI_mutex *mutex)
{
PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex*> (mutex);
DBUG_ASSERT(pfs_mutex != NULL);
......@@ -1501,7 +1508,7 @@ static void unlock_mutex_v1(PSI_thread * thread, PSI_mutex *mutex)
#endif
}
static void unlock_rwlock_v1(PSI_thread *thread, PSI_rwlock *rwlock)
static void unlock_rwlock_v1(PSI_rwlock *rwlock)
{
PFS_rwlock *pfs_rwlock= reinterpret_cast<PFS_rwlock*> (rwlock);
DBUG_ASSERT(pfs_rwlock != NULL);
......@@ -1577,7 +1584,7 @@ static void unlock_rwlock_v1(PSI_thread *thread, PSI_rwlock *rwlock)
#endif
}
static void signal_cond_v1(PSI_thread *thread, PSI_cond* cond)
static void signal_cond_v1(PSI_cond* cond)
{
PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond);
DBUG_ASSERT(pfs_cond != NULL);
......@@ -1585,7 +1592,7 @@ static void signal_cond_v1(PSI_thread *thread, PSI_cond* cond)
pfs_cond->m_cond_stat.m_signal_count++;
}
static void broadcast_cond_v1(PSI_thread *thread, PSI_cond* cond)
static void broadcast_cond_v1(PSI_cond* cond)
{
PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond);
DBUG_ASSERT(pfs_cond != NULL);
......
......@@ -941,9 +941,13 @@ void test_locker_disabled()
ok(file_A1 != NULL, "instrumented");
PSI_mutex_locker *mutex_locker;
PSI_mutex_locker_state mutex_state;
PSI_rwlock_locker *rwlock_locker;
PSI_rwlock_locker_state rwlock_state;
PSI_cond_locker *cond_locker;
PSI_cond_locker_state cond_state;
PSI_file_locker *file_locker;
PSI_file_locker_state file_state;
/* Pretend thread T-1 is disabled */
/* ------------------------------ */
......@@ -955,17 +959,17 @@ void test_locker_disabled()
cond_class_A->m_enabled= true;
file_class_A->m_enabled= true;
mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK);
mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK);
ok(mutex_locker == NULL, "no locker");
rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK);
rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK);
ok(rwlock_locker == NULL, "no locker");
cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT);
cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT);
ok(cond_locker == NULL, "no locker");
file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL);
file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL);
ok(file_locker == NULL, "no locker");
file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ);
file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ);
file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
/* Pretend the consumer is disabled */
......@@ -978,17 +982,17 @@ void test_locker_disabled()
cond_class_A->m_enabled= true;
file_class_A->m_enabled= true;
mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK);
mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK);
ok(mutex_locker == NULL, "no locker");
rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK);
rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK);
ok(rwlock_locker == NULL, "no locker");
cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT);
cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT);
ok(cond_locker == NULL, "no locker");
file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL);
file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL);
ok(file_locker == NULL, "no locker");
file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ);
file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ);
file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
/* Pretend the instrument is disabled */
......@@ -1001,17 +1005,17 @@ void test_locker_disabled()
cond_class_A->m_enabled= false;
file_class_A->m_enabled= false;
mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK);
mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK);
ok(mutex_locker == NULL, "no locker");
rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK);
rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK);
ok(rwlock_locker == NULL, "no locker");
cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT);
cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT);
ok(cond_locker == NULL, "no locker");
file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL);
file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL);
ok(file_locker == NULL, "no locker");
file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ);
file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ);
file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
/* Pretend everything is enabled */
......@@ -1024,27 +1028,27 @@ void test_locker_disabled()
cond_class_A->m_enabled= true;
file_class_A->m_enabled= true;
mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK);
mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK);
ok(mutex_locker != NULL, "locker");
psi->start_mutex_wait(mutex_locker, __FILE__, __LINE__);
psi->end_mutex_wait(mutex_locker, 0);
rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK);
rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK);
ok(rwlock_locker != NULL, "locker");
psi->start_rwlock_rdwait(rwlock_locker, __FILE__, __LINE__);
psi->end_rwlock_rdwait(rwlock_locker, 0);
cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT);
cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT);
ok(cond_locker != NULL, "locker");
psi->start_cond_wait(cond_locker, __FILE__, __LINE__);
psi->end_cond_wait(cond_locker, 0);
file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL);
file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL);
ok(file_locker != NULL, "locker");
psi->start_file_open_wait(file_locker, __FILE__, __LINE__);
psi->end_file_open_wait(file_locker);
file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ);
file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ);
ok(file_locker != NULL, "locker");
psi->start_file_wait(file_locker, 10, __FILE__, __LINE__);
psi->end_file_wait(file_locker, 10);
file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ);
file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ);
ok(file_locker != NULL, "locker");
psi->start_file_wait(file_locker, 10, __FILE__, __LINE__);
psi->end_file_wait(file_locker, 10);
......@@ -1059,17 +1063,17 @@ void test_locker_disabled()
cond_class_A->m_enabled= true;
file_class_A->m_enabled= true;
mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK);
mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK);
ok(mutex_locker == NULL, "no locker");
rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK);
rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK);
ok(rwlock_locker == NULL, "no locker");
cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT);
cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT);
ok(cond_locker == NULL, "no locker");
file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL);
file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL);
ok(file_locker == NULL, "no locker");
file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ);
file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ);
file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ);
ok(file_locker == NULL, "no locker");
shutdown_performance_schema();
......@@ -1102,6 +1106,7 @@ void test_file_instrumentation_leak()
PFS_file_class *file_class_A;
PFS_file_class *file_class_B;
PSI_file_locker_state file_state;
PSI_thread *thread_1;
/* Preparation */
......@@ -1130,24 +1135,24 @@ void test_file_instrumentation_leak()
/* Simulate OPEN + READ of 100 bytes + CLOSE on descriptor 12 */
file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "AAA", NULL);
file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "AAA", NULL);
ok(file_locker != NULL, "locker");
psi->start_file_open_wait(file_locker, __FILE__, __LINE__);
psi->end_file_open_wait_and_bind_to_descriptor(file_locker, 12);
file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ);
file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ);
ok(file_locker != NULL, "locker");
psi->start_file_wait(file_locker, 100, __FILE__, __LINE__);
psi->end_file_wait(file_locker, 100);
file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_CLOSE);
file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_CLOSE);
ok(file_locker != NULL, "locker");
psi->start_file_wait(file_locker, 0, __FILE__, __LINE__);
psi->end_file_wait(file_locker, 0);
/* Simulate uninstrumented-OPEN + WRITE on descriptor 24 */
file_locker= psi->get_thread_file_descriptor_locker((File) 24, PSI_FILE_WRITE);
file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 24, PSI_FILE_WRITE);
ok(file_locker == NULL, "no locker, since the open was not instrumented");
/*
......@@ -1155,7 +1160,7 @@ void test_file_instrumentation_leak()
the instrumentation should not leak (don't charge the file io on unknown B to "AAA")
*/
file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_WRITE);
file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_WRITE);
ok(file_locker == NULL, "no locker, no leak");
shutdown_performance_schema();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment