mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
P_S 5.7.28
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2.0,
|
||||
@@ -48,6 +48,10 @@
|
||||
|
||||
#include "mysql/psi/psi.h"
|
||||
|
||||
#ifndef PSI_FILE_CALL
|
||||
#define PSI_FILE_CALL(M) PSI_DYNAMIC_CALL(M)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@defgroup File_instrumentation File Instrumentation
|
||||
@ingroup Instrumentation_interface
|
||||
@@ -295,7 +299,7 @@
|
||||
*/
|
||||
#ifdef HAVE_PSI_FILE_INTERFACE
|
||||
#define mysql_file_create_temp(K, T, D, P, M, F) \
|
||||
inline_mysql_file_create_temp(K, T, D, P, M, F)
|
||||
inline_mysql_file_create_temp(K, __FILE__, __LINE__, T, D, P, M, F)
|
||||
#else
|
||||
#define mysql_file_create_temp(K, T, D, P, M, F) \
|
||||
inline_mysql_file_create_temp(T, D, P, M, F)
|
||||
@@ -828,7 +832,8 @@ inline_mysql_file_fopen(
|
||||
const char *filename, int flags, myf myFlags)
|
||||
{
|
||||
MYSQL_FILE *that;
|
||||
that= (MYSQL_FILE*) my_malloc(sizeof(MYSQL_FILE), MYF(MY_WME));
|
||||
that= (MYSQL_FILE*) my_malloc(PSI_NOT_INSTRUMENTED,
|
||||
sizeof(MYSQL_FILE), MYF(MY_WME));
|
||||
if (likely(that != NULL))
|
||||
{
|
||||
#ifdef HAVE_PSI_FILE_INTERFACE
|
||||
@@ -1052,20 +1057,27 @@ inline_mysql_file_create(
|
||||
static inline File
|
||||
inline_mysql_file_create_temp(
|
||||
#ifdef HAVE_PSI_FILE_INTERFACE
|
||||
PSI_file_key key,
|
||||
PSI_file_key key, const char *src_file, uint src_line,
|
||||
#endif
|
||||
char *to, const char *dir, const char *pfx, int mode, myf myFlags)
|
||||
{
|
||||
File file;
|
||||
/*
|
||||
TODO: This event is instrumented, but not timed.
|
||||
The problem is that the file name is now known
|
||||
before the create_temp_file call.
|
||||
*/
|
||||
file= create_temp_file(to, dir, pfx, mode, myFlags);
|
||||
#ifdef HAVE_PSI_FILE_INTERFACE
|
||||
PSI_FILE_CALL(create_file)(key, to, file);
|
||||
struct PSI_file_locker *locker;
|
||||
PSI_file_locker_state state;
|
||||
locker= PSI_FILE_CALL(get_thread_file_name_locker)
|
||||
(&state, key, PSI_FILE_CREATE, NULL, &locker);
|
||||
if (likely(locker != NULL))
|
||||
{
|
||||
PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
|
||||
/* The file name is generated by create_temp_file(). */
|
||||
file= create_temp_file(to, dir, pfx, mode, myFlags);
|
||||
PSI_FILE_CALL(end_temp_file_open_wait_and_bind_to_descriptor)(locker, file, (const char*)to);
|
||||
return file;
|
||||
}
|
||||
#endif
|
||||
|
||||
file= create_temp_file(to, dir, pfx, mode, myFlags);
|
||||
return file;
|
||||
}
|
||||
|
||||
@@ -1355,12 +1367,13 @@ inline_mysql_file_rename(
|
||||
{
|
||||
struct PSI_file_locker *locker;
|
||||
PSI_file_locker_state state;
|
||||
locker= PSI_FILE_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, from, &locker);
|
||||
if (likely(locker != NULL))
|
||||
{
|
||||
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
|
||||
result= my_rename(from, to, flags);
|
||||
PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
|
||||
PSI_FILE_CALL(end_file_rename_wait)(locker, from, to, result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1449,12 +1462,13 @@ inline_mysql_file_rename_with_symlink(
|
||||
{
|
||||
struct PSI_file_locker *locker;
|
||||
PSI_file_locker_state state;
|
||||
locker= PSI_FILE_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, from, &locker);
|
||||
if (likely(locker != NULL))
|
||||
{
|
||||
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
|
||||
result= my_rename_with_symlink(from, to, flags);
|
||||
PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
|
||||
PSI_FILE_CALL(end_file_rename_wait)(locker, from, to, result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2.0,
|
||||
@@ -31,6 +31,10 @@
|
||||
|
||||
#include "mysql/psi/psi.h"
|
||||
|
||||
#ifndef PSI_IDLE_CALL
|
||||
#define PSI_IDLE_CALL(M) PSI_DYNAMIC_CALL(M)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@defgroup Idle_instrumentation Idle Instrumentation
|
||||
@ingroup Instrumentation_interface
|
||||
|
128
include/mysql/psi/mysql_mdl.h
Normal file
128
include/mysql/psi/mysql_mdl.h
Normal file
@@ -0,0 +1,128 @@
|
||||
/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2.0,
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is also distributed with certain software (including
|
||||
but not limited to OpenSSL) that is licensed under separate terms,
|
||||
as designated in a particular file or component or in included license
|
||||
documentation. The authors of MySQL hereby grant you an additional
|
||||
permission to link the program and your derivative works with the
|
||||
separately licensed software that they have included with MySQL.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License, version 2.0, for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
|
||||
|
||||
#ifndef MYSQL_MDL_H
|
||||
#define MYSQL_MDL_H
|
||||
|
||||
/**
|
||||
@file mysql/psi/mysql_mdl.h
|
||||
Instrumentation helpers for metadata locks.
|
||||
*/
|
||||
|
||||
#include "mysql/psi/psi.h"
|
||||
|
||||
#ifndef PSI_METADATA_CALL
|
||||
#define PSI_METADATA_CALL(M) PSI_DYNAMIC_CALL(M)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@defgroup Thread_instrumentation Metadata Instrumentation
|
||||
@ingroup Instrumentation_interface
|
||||
@{
|
||||
*/
|
||||
|
||||
/**
|
||||
@def mysql_mdl_create(K, M, A)
|
||||
Instrumented metadata lock creation.
|
||||
@param I Metadata lock identity
|
||||
@param K Metadata key
|
||||
@param T Metadata lock type
|
||||
@param D Metadata lock duration
|
||||
@param S Metadata lock status
|
||||
@param F request source file
|
||||
@param L request source line
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PSI_METADATA_INTERFACE
|
||||
#define mysql_mdl_create(I, K, T, D, S, F, L) \
|
||||
inline_mysql_mdl_create(I, K, T, D, S, F, L)
|
||||
#else
|
||||
#define mysql_mdl_create(I, K, T, D, S, F, L) NULL
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_METADATA_INTERFACE
|
||||
#define mysql_mdl_set_status(L, S) \
|
||||
inline_mysql_mdl_set_status(L, S)
|
||||
#else
|
||||
#define mysql_mdl_set_status(L, S) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
@def mysql_mdl_destroy(M)
|
||||
Instrumented metadata lock destruction.
|
||||
@param M Metadata lock
|
||||
*/
|
||||
#ifdef HAVE_PSI_METADATA_INTERFACE
|
||||
#define mysql_mdl_destroy(M) \
|
||||
inline_mysql_mdl_destroy(M, __FILE__, __LINE__)
|
||||
#else
|
||||
#define mysql_mdl_destroy(M) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_METADATA_INTERFACE
|
||||
|
||||
static inline PSI_metadata_lock *
|
||||
inline_mysql_mdl_create(void *identity,
|
||||
const MDL_key *mdl_key,
|
||||
enum_mdl_type mdl_type,
|
||||
enum_mdl_duration mdl_duration,
|
||||
MDL_ticket::enum_psi_status mdl_status,
|
||||
const char *src_file, uint src_line)
|
||||
{
|
||||
PSI_metadata_lock *result;
|
||||
|
||||
/* static_cast: Fit a round C++ enum peg into a square C int hole ... */
|
||||
result= PSI_METADATA_CALL(create_metadata_lock)
|
||||
(identity,
|
||||
mdl_key,
|
||||
static_cast<opaque_mdl_type> (mdl_type),
|
||||
static_cast<opaque_mdl_duration> (mdl_duration),
|
||||
static_cast<opaque_mdl_status> (mdl_status),
|
||||
src_file, src_line);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline void inline_mysql_mdl_set_status(
|
||||
PSI_metadata_lock *psi,
|
||||
MDL_ticket::enum_psi_status mdl_status)
|
||||
{
|
||||
if (psi != NULL)
|
||||
PSI_METADATA_CALL(set_metadata_lock_status)(psi, mdl_status);
|
||||
}
|
||||
|
||||
static inline void inline_mysql_mdl_destroy(
|
||||
PSI_metadata_lock *psi,
|
||||
const char *src_file, uint src_line)
|
||||
{
|
||||
if (psi != NULL)
|
||||
PSI_METADATA_CALL(destroy_metadata_lock)(psi);
|
||||
}
|
||||
#endif /* HAVE_PSI_METADATA_INTERFACE */
|
||||
|
||||
/** @} (end of group Metadata_instrumentation) */
|
||||
|
||||
#endif
|
||||
|
69
include/mysql/psi/mysql_memory.h
Normal file
69
include/mysql/psi/mysql_memory.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2.0,
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is also distributed with certain software (including
|
||||
but not limited to OpenSSL) that is licensed under separate terms,
|
||||
as designated in a particular file or component or in included license
|
||||
documentation. The authors of MySQL hereby grant you an additional
|
||||
permission to link the program and your derivative works with the
|
||||
separately licensed software that they have included with MySQL.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License, version 2.0, for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
|
||||
|
||||
#ifndef MYSQL_MEMORY_H
|
||||
#define MYSQL_MEMORY_H
|
||||
|
||||
/**
|
||||
@file mysql/psi/mysql_memory.h
|
||||
Instrumentation helpers for memory allocation.
|
||||
*/
|
||||
|
||||
#include "mysql/psi/psi.h"
|
||||
|
||||
#ifndef PSI_MEMORY_CALL
|
||||
#define PSI_MEMORY_CALL(M) PSI_DYNAMIC_CALL(M)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@defgroup Memory_instrumentation Memory Instrumentation
|
||||
@ingroup Instrumentation_interface
|
||||
@{
|
||||
*/
|
||||
|
||||
/**
|
||||
@def mysql_memory_register(P1, P2, P3)
|
||||
Memory registration.
|
||||
*/
|
||||
#define mysql_memory_register(P1, P2, P3) \
|
||||
inline_mysql_memory_register(P1, P2, P3)
|
||||
|
||||
static inline void inline_mysql_memory_register(
|
||||
#ifdef HAVE_PSI_MEMORY_INTERFACE
|
||||
const char *category,
|
||||
PSI_memory_info *info,
|
||||
int count)
|
||||
#else
|
||||
const char *category __attribute__((unused)),
|
||||
void *info __attribute__((unused)),
|
||||
int count __attribute__((unused)))
|
||||
#endif
|
||||
{
|
||||
#ifdef HAVE_PSI_MEMORY_INTERFACE
|
||||
PSI_MEMORY_CALL(register_memory)(category, info, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** @} (end of group Memory_instrumentation) */
|
||||
|
||||
#endif
|
||||
|
110
include/mysql/psi/mysql_ps.h
Normal file
110
include/mysql/psi/mysql_ps.h
Normal file
@@ -0,0 +1,110 @@
|
||||
/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2.0,
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is also distributed with certain software (including
|
||||
but not limited to OpenSSL) that is licensed under separate terms,
|
||||
as designated in a particular file or component or in included license
|
||||
documentation. The authors of MySQL hereby grant you an additional
|
||||
permission to link the program and your derivative works with the
|
||||
separately licensed software that they have included with MySQL.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License, version 2.0, for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
#ifndef MYSQL_PS_H
|
||||
#define MYSQL_PS_H
|
||||
|
||||
/**
|
||||
@file mysql/psi/mysql_ps.h
|
||||
Instrumentation helpers for prepared statements.
|
||||
*/
|
||||
|
||||
#include "mysql/psi/psi.h"
|
||||
|
||||
#ifndef PSI_PS_CALL
|
||||
#define PSI_PS_CALL(M) PSI_DYNAMIC_CALL(M)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_PS_INTERFACE
|
||||
#define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH) \
|
||||
inline_mysql_create_prepared_stmt(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH)
|
||||
#define MYSQL_EXECUTE_PS(LOCKER, PREPARED_STMT) \
|
||||
inline_mysql_execute_prepared_stmt(LOCKER, PREPARED_STMT)
|
||||
#define MYSQL_DESTROY_PS(PREPARED_STMT) \
|
||||
inline_mysql_destroy_prepared_stmt(PREPARED_STMT)
|
||||
#define MYSQL_REPREPARE_PS(PREPARED_STMT) \
|
||||
inline_mysql_reprepare_prepared_stmt(PREPARED_STMT)
|
||||
#define MYSQL_SET_PS_TEXT(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH) \
|
||||
inline_mysql_set_prepared_stmt_text(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH)
|
||||
#else
|
||||
#define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH) \
|
||||
NULL
|
||||
#define MYSQL_EXECUTE_PS(LOCKER, PREPARED_STMT) \
|
||||
do {} while (0)
|
||||
#define MYSQL_DESTROY_PS(PREPARED_STMT) \
|
||||
do {} while (0)
|
||||
#define MYSQL_REPREPARE_PS(PREPARED_STMT) \
|
||||
do {} while (0)
|
||||
#define MYSQL_SET_PS_TEXT(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_PS_INTERFACE
|
||||
static inline struct PSI_prepared_stmt*
|
||||
inline_mysql_create_prepared_stmt(void *identity, uint stmt_id,
|
||||
PSI_statement_locker *locker,
|
||||
const char *stmt_name, size_t stmt_name_length,
|
||||
const char *sqltext, size_t sqltext_length)
|
||||
{
|
||||
if (locker == NULL)
|
||||
return NULL;
|
||||
return PSI_PS_CALL(create_prepared_stmt)(identity, stmt_id,
|
||||
locker,
|
||||
stmt_name, stmt_name_length,
|
||||
sqltext, sqltext_length);
|
||||
}
|
||||
|
||||
static inline void
|
||||
inline_mysql_execute_prepared_stmt(PSI_statement_locker *locker,
|
||||
PSI_prepared_stmt* prepared_stmt)
|
||||
{
|
||||
if (prepared_stmt != NULL && locker != NULL)
|
||||
PSI_PS_CALL(execute_prepared_stmt)(locker, prepared_stmt);
|
||||
}
|
||||
|
||||
static inline void
|
||||
inline_mysql_destroy_prepared_stmt(PSI_prepared_stmt *prepared_stmt)
|
||||
{
|
||||
if (prepared_stmt != NULL)
|
||||
PSI_PS_CALL(destroy_prepared_stmt)(prepared_stmt);
|
||||
}
|
||||
|
||||
static inline void
|
||||
inline_mysql_reprepare_prepared_stmt(PSI_prepared_stmt *prepared_stmt)
|
||||
{
|
||||
if (prepared_stmt != NULL)
|
||||
PSI_PS_CALL(reprepare_prepared_stmt)(prepared_stmt);
|
||||
}
|
||||
|
||||
static inline void
|
||||
inline_mysql_set_prepared_stmt_text(PSI_prepared_stmt *prepared_stmt,
|
||||
const char *text,
|
||||
uint text_len)
|
||||
{
|
||||
if (prepared_stmt != NULL)
|
||||
{
|
||||
PSI_PS_CALL(set_prepared_stmt_text)(prepared_stmt, text, text_len);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
/* For my_chsize */
|
||||
#include <my_sys.h>
|
||||
/* For socket api */
|
||||
#ifdef __WIN__
|
||||
#ifdef _WIN32
|
||||
#include <ws2def.h>
|
||||
#include <winsock2.h>
|
||||
#include <MSWSock.h>
|
||||
@@ -47,6 +47,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
|
||||
#include "mysql/psi/psi.h"
|
||||
|
||||
#ifndef PSI_SOCKET_CALL
|
||||
#define PSI_SOCKET_CALL(M) PSI_DYNAMIC_CALL(M)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@defgroup Socket_instrumentation Socket Instrumentation
|
||||
@ingroup Instrumentation_interface
|
||||
@@ -65,6 +69,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
/** An instrumented socket. */
|
||||
struct st_mysql_socket
|
||||
{
|
||||
/** The real socket descriptor. */
|
||||
@@ -107,9 +112,8 @@ mysql_socket_invalid()
|
||||
/**
|
||||
Set socket descriptor and address.
|
||||
@param socket nstrumented socket
|
||||
@param fd socket descriptor
|
||||
@param addr unformatted socket address
|
||||
@param adr_len length of socket address
|
||||
@param addr_len length of socket address
|
||||
*/
|
||||
|
||||
static inline void
|
||||
@@ -134,7 +138,6 @@ mysql_socket_set_address(
|
||||
/**
|
||||
Set socket descriptor and address.
|
||||
@param socket instrumented socket
|
||||
@param thread instrumented owning thread
|
||||
*/
|
||||
static inline void
|
||||
mysql_socket_set_thread_owner(
|
||||
@@ -201,7 +204,6 @@ mysql_socket_setfd(MYSQL_SOCKET *mysql_socket, my_socket fd)
|
||||
@param STATE locker state
|
||||
@param SOCKET instrumented socket
|
||||
@param OP The socket operation to be performed
|
||||
@param FLAGS per-socket operation flags.
|
||||
@param COUNT bytes to be written/read
|
||||
@sa MYSQL_END_SOCKET_WAIT.
|
||||
*/
|
||||
@@ -230,6 +232,13 @@ mysql_socket_setfd(MYSQL_SOCKET *mysql_socket, my_socket fd)
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@def MYSQL_SOCKET_SET_STATE
|
||||
Set the state (IDLE, ACTIVE) of an instrumented socket.
|
||||
@param SOCKET the instrumented socket
|
||||
@param STATE the new state
|
||||
@sa PSI_socket_state
|
||||
*/
|
||||
#ifdef HAVE_PSI_SOCKET_INTERFACE
|
||||
#define MYSQL_SOCKET_SET_STATE(SOCKET, STATE) \
|
||||
inline_mysql_socket_set_state(SOCKET, STATE)
|
||||
@@ -325,8 +334,8 @@ inline_mysql_socket_set_state(MYSQL_SOCKET socket, enum PSI_socket_state state)
|
||||
Return port number and IP address of the local host
|
||||
@c mysql_socket_getsockname is a replacement for @c getsockname.
|
||||
@param FD Instrumented socket descriptor returned by socket()
|
||||
@param A Pointer to returned address of local host in sockaddr structure
|
||||
@param L Pointer to length of sockaddr structure
|
||||
@param AP Pointer to returned address of local host in @c sockaddr structure
|
||||
@param LP Pointer to length of @c sockaddr structure
|
||||
*/
|
||||
#ifdef HAVE_PSI_SOCKET_INTERFACE
|
||||
#define mysql_socket_getsockname(FD, AP, LP) \
|
||||
@@ -430,7 +439,7 @@ inline_mysql_socket_set_state(MYSQL_SOCKET socket, enum PSI_socket_state state)
|
||||
@param N Maximum bytes to receive
|
||||
@param FL Control flags
|
||||
@param AP Pointer to source address in sockaddr_storage structure
|
||||
@param L Size of sockaddr_storage structure
|
||||
@param LP Size of sockaddr_storage structure
|
||||
*/
|
||||
#ifdef HAVE_PSI_SOCKET_INTERFACE
|
||||
#define mysql_socket_recvfrom(FD, B, N, FL, AP, LP) \
|
||||
@@ -476,6 +485,19 @@ inline_mysql_socket_set_state(MYSQL_SOCKET socket, enum PSI_socket_state state)
|
||||
inline_mysql_socket_setsockopt(FD, LV, ON, OP, OL)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@def mysql_sock_set_nonblocking
|
||||
Set socket to non-blocking.
|
||||
@param FD instrumented socket descriptor
|
||||
*/
|
||||
#ifdef HAVE_PSI_SOCKET_INTERFACE
|
||||
#define mysql_sock_set_nonblocking(FD) \
|
||||
inline_mysql_sock_set_nonblocking(__FILE__, __LINE__, FD)
|
||||
#else
|
||||
#define mysql_sock_set_nonblocking(FD) \
|
||||
inline_mysql_sock_set_nonblocking(FD)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@def mysql_socket_listen(FD, N)
|
||||
Set socket state to listen for an incoming connection.
|
||||
@@ -972,6 +994,78 @@ inline_mysql_socket_setsockopt
|
||||
return result;
|
||||
}
|
||||
|
||||
/** set_socket_nonblock */
|
||||
static inline int
|
||||
set_socket_nonblock(my_socket fd)
|
||||
{
|
||||
int ret= 0;
|
||||
#ifdef _WIN32
|
||||
{
|
||||
u_long nonblocking= 1;
|
||||
ret= ioctlsocket(fd, FIONBIO, &nonblocking);
|
||||
}
|
||||
#else
|
||||
{
|
||||
int fd_flags;
|
||||
fd_flags= fcntl(fd, F_GETFL, 0);
|
||||
if (fd_flags < 0)
|
||||
return errno;
|
||||
#if defined(O_NONBLOCK)
|
||||
fd_flags |= O_NONBLOCK;
|
||||
#elif defined(O_NDELAY)
|
||||
fd_flags |= O_NDELAY;
|
||||
#elif defined(O_FNDELAY)
|
||||
fd_flags |= O_FNDELAY;
|
||||
#else
|
||||
#error "No definition of non-blocking flag found."
|
||||
#endif /* O_NONBLOCK */
|
||||
if (fcntl(fd, F_SETFL, fd_flags) == -1)
|
||||
ret= errno;
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** mysql_socket_set_nonblocking */
|
||||
|
||||
static inline int
|
||||
inline_mysql_sock_set_nonblocking
|
||||
(
|
||||
#ifdef HAVE_PSI_SOCKET_INTERFACE
|
||||
const char *src_file, uint src_line,
|
||||
#endif
|
||||
MYSQL_SOCKET mysql_socket
|
||||
)
|
||||
{
|
||||
int result= 0;
|
||||
|
||||
#ifdef HAVE_PSI_SOCKET_INTERFACE
|
||||
if (mysql_socket.m_psi)
|
||||
{
|
||||
/* Instrumentation start */
|
||||
PSI_socket_locker *locker;
|
||||
PSI_socket_locker_state state;
|
||||
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= set_socket_nonblock(mysql_socket.fd);
|
||||
|
||||
/* Instrumentation end */
|
||||
if (locker != NULL)
|
||||
PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Non instrumented code */
|
||||
result= set_socket_nonblock(mysql_socket.fd);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/** mysql_socket_listen */
|
||||
|
||||
static inline int
|
||||
@@ -1136,7 +1230,7 @@ inline_mysql_socket_shutdown
|
||||
{
|
||||
int result;
|
||||
|
||||
#ifdef __WIN__
|
||||
#ifdef _WIN32
|
||||
static LPFN_DISCONNECTEX DisconnectEx = NULL;
|
||||
if (DisconnectEx == NULL)
|
||||
{
|
||||
@@ -1159,7 +1253,7 @@ inline_mysql_socket_shutdown
|
||||
(&state, mysql_socket.m_psi, PSI_SOCKET_SHUTDOWN, (size_t)0, src_file, src_line);
|
||||
|
||||
/* Instrumented code */
|
||||
#ifdef __WIN__
|
||||
#ifdef _WIN32
|
||||
if (DisconnectEx)
|
||||
result= (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED) NULL,
|
||||
(DWORD) 0, (DWORD) 0) == TRUE) ? 0 : -1;
|
||||
@@ -1176,7 +1270,7 @@ inline_mysql_socket_shutdown
|
||||
#endif
|
||||
|
||||
/* Non instrumented code */
|
||||
#ifdef __WIN__
|
||||
#ifdef _WIN32
|
||||
if (DisconnectEx)
|
||||
result= (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED) NULL,
|
||||
(DWORD) 0, (DWORD) 0) == TRUE) ? 0 : -1;
|
||||
|
104
include/mysql/psi/mysql_sp.h
Normal file
104
include/mysql/psi/mysql_sp.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2.0,
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is also distributed with certain software (including
|
||||
but not limited to OpenSSL) that is licensed under separate terms,
|
||||
as designated in a particular file or component or in included license
|
||||
documentation. The authors of MySQL hereby grant you an additional
|
||||
permission to link the program and your derivative works with the
|
||||
separately licensed software that they have included with MySQL.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License, version 2.0, for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
#ifndef MYSQL_SP_H
|
||||
#define MYSQL_SP_H
|
||||
|
||||
/**
|
||||
@file mysql/psi/mysql_sp.h
|
||||
Instrumentation helpers for stored programs.
|
||||
*/
|
||||
|
||||
#include "mysql/psi/psi.h"
|
||||
|
||||
#ifndef PSI_SP_CALL
|
||||
#define PSI_SP_CALL(M) PSI_DYNAMIC_CALL(M)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_SP_INTERFACE
|
||||
#define MYSQL_START_SP(STATE, SP_SHARE) \
|
||||
inline_mysql_start_sp(STATE, SP_SHARE)
|
||||
#else
|
||||
#define MYSQL_START_SP(STATE, SP_SHARE) \
|
||||
NULL
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_PSI_SP_INTERFACE
|
||||
#define MYSQL_END_SP(LOCKER) \
|
||||
inline_mysql_end_sp(LOCKER)
|
||||
#else
|
||||
#define MYSQL_END_SP(LOCKER) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_SP_INTERFACE
|
||||
#define MYSQL_DROP_SP(OT, SN, SNL, ON, ONL) \
|
||||
inline_mysql_drop_sp(OT, SN, SNL, ON, ONL)
|
||||
#else
|
||||
#define MYSQL_DROP_SP(OT, SN, SNL, ON, ONL) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_SP_INTERFACE
|
||||
#define MYSQL_GET_SP_SHARE(OT, SN, SNL, ON, ONL) \
|
||||
inline_mysql_get_sp_share(OT, SN, SNL, ON, ONL)
|
||||
#else
|
||||
#define MYSQL_GET_SP_SHARE(OT, SN, SNL, ON, ONL) \
|
||||
NULL
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_SP_INTERFACE
|
||||
static inline struct PSI_sp_locker*
|
||||
inline_mysql_start_sp(PSI_sp_locker_state *state, PSI_sp_share *sp_share)
|
||||
{
|
||||
return PSI_SP_CALL(start_sp)(state, sp_share);
|
||||
}
|
||||
|
||||
static inline void inline_mysql_end_sp(PSI_sp_locker *locker)
|
||||
{
|
||||
if (likely(locker != NULL))
|
||||
PSI_SP_CALL(end_sp)(locker);
|
||||
}
|
||||
|
||||
static inline void
|
||||
inline_mysql_drop_sp(uint sp_type,
|
||||
const char* schema_name, uint shcema_name_length,
|
||||
const char* object_name, uint object_name_length)
|
||||
{
|
||||
PSI_SP_CALL(drop_sp)(sp_type,
|
||||
schema_name, shcema_name_length,
|
||||
object_name, object_name_length);
|
||||
}
|
||||
|
||||
static inline PSI_sp_share*
|
||||
inline_mysql_get_sp_share(uint sp_type,
|
||||
const char* schema_name, uint shcema_name_length,
|
||||
const char* object_name, uint object_name_length)
|
||||
{
|
||||
return PSI_SP_CALL(get_sp_share)(sp_type,
|
||||
schema_name, shcema_name_length,
|
||||
object_name, object_name_length);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2.0,
|
||||
@@ -30,6 +30,10 @@
|
||||
|
||||
#include "mysql/psi/psi.h"
|
||||
|
||||
#ifndef PSI_STAGE_CALL
|
||||
#define PSI_STAGE_CALL(M) PSI_DYNAMIC_CALL(M)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@defgroup Stage_instrumentation Stage Instrumentation
|
||||
@ingroup Instrumentation_interface
|
||||
@@ -48,12 +52,48 @@
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@def MYSQL_SET_STAGE
|
||||
Set the current stage.
|
||||
Use this API when the file and line
|
||||
is passed from the caller.
|
||||
@param K the stage key
|
||||
@param F the source file name
|
||||
@param L the source file line
|
||||
@return the current stage progress
|
||||
*/
|
||||
#ifdef HAVE_PSI_STAGE_INTERFACE
|
||||
#define MYSQL_SET_STAGE(K, F, L) \
|
||||
inline_mysql_set_stage(K, F, L)
|
||||
#else
|
||||
#define MYSQL_SET_STAGE(K, F, L) \
|
||||
do {} while (0)
|
||||
NULL
|
||||
#endif
|
||||
|
||||
/**
|
||||
@def mysql_set_stage
|
||||
Set the current stage.
|
||||
@param K the stage key
|
||||
@return the current stage progress
|
||||
*/
|
||||
#ifdef HAVE_PSI_STAGE_INTERFACE
|
||||
#define mysql_set_stage(K) \
|
||||
inline_mysql_set_stage(K, __FILE__, __LINE__)
|
||||
#else
|
||||
#define mysql_set_stage(K) \
|
||||
NULL
|
||||
#endif
|
||||
|
||||
/**
|
||||
@def mysql_end_stage
|
||||
End the last stage
|
||||
*/
|
||||
#ifdef HAVE_PSI_STAGE_INTERFACE
|
||||
#define mysql_end_stage \
|
||||
inline_mysql_end_stage
|
||||
#else
|
||||
#define mysql_end_stage \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_STAGE_INTERFACE
|
||||
@@ -65,11 +105,97 @@ static inline void inline_mysql_stage_register(
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_STAGE_INTERFACE
|
||||
static inline void
|
||||
static inline PSI_stage_progress*
|
||||
inline_mysql_set_stage(PSI_stage_key key,
|
||||
const char *src_file, int src_line)
|
||||
{
|
||||
PSI_STAGE_CALL(start_stage)(key, src_file, src_line);
|
||||
return PSI_STAGE_CALL(start_stage)(key, src_file, src_line);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_STAGE_INTERFACE
|
||||
static inline void
|
||||
inline_mysql_end_stage()
|
||||
{
|
||||
PSI_STAGE_CALL(end_stage)();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_STAGE_INTERFACE
|
||||
#define mysql_stage_set_work_completed(P1, P2) \
|
||||
inline_mysql_stage_set_work_completed(P1, P2)
|
||||
|
||||
#define mysql_stage_get_work_completed(P1) \
|
||||
inline_mysql_stage_get_work_completed(P1)
|
||||
#else
|
||||
#define mysql_stage_set_work_completed(P1, P2) \
|
||||
do {} while (0)
|
||||
|
||||
#define mysql_stage_get_work_completed(P1) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_STAGE_INTERFACE
|
||||
#define mysql_stage_inc_work_completed(P1, P2) \
|
||||
inline_mysql_stage_inc_work_completed(P1, P2)
|
||||
#else
|
||||
#define mysql_stage_inc_work_completed(P1, P2) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_STAGE_INTERFACE
|
||||
#define mysql_stage_set_work_estimated(P1, P2) \
|
||||
inline_mysql_stage_set_work_estimated(P1, P2)
|
||||
|
||||
#define mysql_stage_get_work_estimated(P1) \
|
||||
inline_mysql_stage_get_work_estimated(P1)
|
||||
#else
|
||||
#define mysql_stage_set_work_estimated(P1, P2) \
|
||||
do {} while (0)
|
||||
|
||||
#define mysql_stage_get_work_estimated(P1) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_STAGE_INTERFACE
|
||||
static inline void
|
||||
inline_mysql_stage_set_work_completed(PSI_stage_progress *progress,
|
||||
ulonglong val)
|
||||
{
|
||||
if (progress != NULL)
|
||||
progress->m_work_completed= val;
|
||||
}
|
||||
|
||||
static inline ulonglong
|
||||
inline_mysql_stage_get_work_completed(PSI_stage_progress *progress)
|
||||
{
|
||||
return progress->m_work_completed;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_STAGE_INTERFACE
|
||||
static inline void
|
||||
inline_mysql_stage_inc_work_completed(PSI_stage_progress *progress,
|
||||
ulonglong val)
|
||||
{
|
||||
if (progress != NULL)
|
||||
progress->m_work_completed+= val;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_STAGE_INTERFACE
|
||||
static inline void
|
||||
inline_mysql_stage_set_work_estimated(PSI_stage_progress *progress,
|
||||
ulonglong val)
|
||||
{
|
||||
if (progress != NULL)
|
||||
progress->m_work_estimated= val;
|
||||
}
|
||||
|
||||
static inline ulonglong
|
||||
inline_mysql_stage_get_work_estimated(PSI_stage_progress *progress)
|
||||
{
|
||||
return progress->m_work_estimated;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2.0,
|
||||
@@ -31,6 +31,17 @@
|
||||
|
||||
#include "mysql/psi/psi.h"
|
||||
|
||||
class Diagnostics_area;
|
||||
typedef const struct charset_info_st CHARSET_INFO;
|
||||
|
||||
#ifndef PSI_STATEMENT_CALL
|
||||
#define PSI_STATEMENT_CALL(M) PSI_DYNAMIC_CALL(M)
|
||||
#endif
|
||||
|
||||
#ifndef PSI_DIGEST_CALL
|
||||
#define PSI_DIGEST_CALL(M) PSI_DYNAMIC_CALL(M)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@defgroup Statement_instrumentation Statement Instrumentation
|
||||
@ingroup Instrumentation_interface
|
||||
@@ -66,10 +77,10 @@
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_STATEMENT_INTERFACE
|
||||
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS) \
|
||||
inline_mysql_start_statement(STATE, K, DB, DB_LEN, CS, __FILE__, __LINE__)
|
||||
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS, SPS) \
|
||||
inline_mysql_start_statement(STATE, K, DB, DB_LEN, CS, SPS, __FILE__, __LINE__)
|
||||
#else
|
||||
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS) \
|
||||
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS, SPS) \
|
||||
NULL
|
||||
#endif
|
||||
|
||||
@@ -153,11 +164,13 @@ static inline struct PSI_statement_locker *
|
||||
inline_mysql_start_statement(PSI_statement_locker_state *state,
|
||||
PSI_statement_key key,
|
||||
const char *db, size_t db_len,
|
||||
const CHARSET_INFO *charset,
|
||||
CHARSET_INFO *charset,
|
||||
PSI_sp_share *sp_share,
|
||||
const char *src_file, uint src_line)
|
||||
{
|
||||
PSI_statement_locker *locker;
|
||||
locker= PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset);
|
||||
locker= PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset,
|
||||
sp_share);
|
||||
if (psi_likely(locker != NULL))
|
||||
PSI_STATEMENT_CALL(start_statement)(locker, db, (uint)db_len, src_file, src_line);
|
||||
return locker;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation.
|
||||
/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2017, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2.0,
|
||||
@@ -31,6 +31,10 @@
|
||||
|
||||
#include "mysql/psi/psi.h"
|
||||
|
||||
#ifndef PSI_TABLE_CALL
|
||||
#define PSI_TABLE_CALL(M) PSI_DYNAMIC_CALL(M)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@defgroup Table_instrumentation Table Instrumentation
|
||||
@ingroup Instrumentation_interface
|
||||
@@ -54,7 +58,7 @@
|
||||
|
||||
#define PSI_CALL_unbind_table(A1) do { } while(0)
|
||||
#define PSI_CALL_rebind_table(A1,A2,A3) NULL
|
||||
#define PSI_CALL_close_table(A1) do { } while(0)
|
||||
#define PSI_CALL_close_table(A1,A2) do { } while(0)
|
||||
#define PSI_CALL_open_table(A1,A2) NULL
|
||||
#define PSI_CALL_get_table_share(A1,A2) NULL
|
||||
#define PSI_CALL_release_table_share(A1) do { } while(0)
|
||||
@@ -81,72 +85,6 @@
|
||||
#define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@def MYSQL_TABLE_IO_WAIT
|
||||
Instrumentation helper for table io_waits.
|
||||
This instrumentation marks the start of a wait event.
|
||||
@param PSI the instrumented table
|
||||
@param OP the table operation to be performed
|
||||
@param INDEX the table index used if any, or MAY_KEY.
|
||||
@param FLAGS per table operation flags.
|
||||
@sa MYSQL_END_TABLE_WAIT.
|
||||
*/
|
||||
#ifdef HAVE_PSI_TABLE_INTERFACE
|
||||
#define MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD) \
|
||||
{ \
|
||||
if (psi_likely(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) \
|
||||
PAYLOAD
|
||||
#endif
|
||||
|
||||
/**
|
||||
@def MYSQL_TABLE_LOCK_WAIT
|
||||
Instrumentation helper for table io_waits.
|
||||
This instrumentation marks the start of a wait event.
|
||||
@param PSI the instrumented table
|
||||
@param OP the table operation to be performed
|
||||
@param INDEX the table index used if any, or MAY_KEY.
|
||||
@param FLAGS per table operation flags.
|
||||
@sa MYSQL_END_TABLE_WAIT.
|
||||
*/
|
||||
#ifdef HAVE_PSI_TABLE_INTERFACE
|
||||
#define MYSQL_TABLE_LOCK_WAIT(PSI, OP, FLAGS, PAYLOAD) \
|
||||
{ \
|
||||
if (psi_likely(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) \
|
||||
PAYLOAD
|
||||
#endif
|
||||
|
||||
/**
|
||||
@def MYSQL_START_TABLE_LOCK_WAIT
|
||||
Instrumentation helper for table lock waits.
|
||||
@@ -182,6 +120,14 @@
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_TABLE_INTERFACE
|
||||
#define MYSQL_UNLOCK_TABLE(T) \
|
||||
inline_mysql_unlock_table(T)
|
||||
#else
|
||||
#define MYSQL_UNLOCK_TABLE(T) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_TABLE_INTERFACE
|
||||
/**
|
||||
Instrumentation calls for MYSQL_START_TABLE_LOCK_WAIT.
|
||||
@@ -213,6 +159,13 @@ inline_mysql_end_table_lock_wait(struct PSI_table_locker *locker)
|
||||
if (psi_likely(locker != NULL))
|
||||
PSI_TABLE_CALL(end_table_lock_wait)(locker);
|
||||
}
|
||||
|
||||
static inline void
|
||||
inline_mysql_unlock_table(struct PSI_table *table)
|
||||
{
|
||||
if (table != NULL)
|
||||
PSI_TABLE_CALL(unlock_table)(table);
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} (end of group Table_instrumentation) */
|
||||
|
@@ -62,6 +62,27 @@
|
||||
*/
|
||||
|
||||
#include "mysql/psi/psi.h"
|
||||
#ifdef MYSQL_SERVER
|
||||
#ifndef MYSQL_DYNAMIC_PLUGIN
|
||||
#include "pfs_thread_provider.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
/**
|
||||
@defgroup Thread_instrumentation Thread Instrumentation
|
||||
@@ -80,7 +101,7 @@
|
||||
#define PSI_CALL_set_thread_id PSI_THREAD_CALL(set_thread_id)
|
||||
#define PSI_CALL_set_thread_info PSI_THREAD_CALL(set_thread_info)
|
||||
#define PSI_CALL_set_thread_start_time PSI_THREAD_CALL(set_thread_start_time)
|
||||
#define PSI_CALL_set_thread_user_host PSI_THREAD_CALL(set_thread_user_host)
|
||||
#define PSI_CALL_set_thread_account PSI_THREAD_CALL(set_thread_account)
|
||||
#define PSI_CALL_spawn_thread PSI_THREAD_CALL(spawn_thread)
|
||||
#else
|
||||
#define PSI_CALL_delete_current_thread() do { } while(0)
|
||||
@@ -93,7 +114,7 @@
|
||||
#define PSI_CALL_set_thread_id(A1,A2) do { } while(0)
|
||||
#define PSI_CALL_set_thread_info(A1, A2) do { } while(0)
|
||||
#define PSI_CALL_set_thread_start_time(A1) do { } while(0)
|
||||
#define PSI_CALL_set_thread_user_host(A1, A2, A3, A4) do { } while(0)
|
||||
#define PSI_CALL_set_thread_account(A1, A2, A3, A4) do { } while(0)
|
||||
#define PSI_CALL_spawn_thread(A1, A2, A3, A4, A5) 0
|
||||
#endif
|
||||
|
||||
@@ -256,11 +277,19 @@ typedef struct st_mysql_cond mysql_cond_t;
|
||||
#define mysql_mutex_setflags(M, F) \
|
||||
safe_mutex_setflags(&(M)->m_mutex, (F))
|
||||
|
||||
/** Wrappers for instrumented prlock objects. */
|
||||
|
||||
/**
|
||||
@def mysql_prlock_assert_write_owner(M)
|
||||
Drop-in replacement
|
||||
for @c rw_pr_lock_assert_write_owner.
|
||||
*/
|
||||
#define mysql_prlock_assert_write_owner(M) \
|
||||
rw_pr_lock_assert_write_owner(&(M)->m_prlock)
|
||||
|
||||
/**
|
||||
@def mysql_prlock_assert_not_write_owner(M)
|
||||
Drop-in replacement
|
||||
for @c rw_pr_lock_assert_not_write_owner.
|
||||
*/
|
||||
#define mysql_prlock_assert_not_write_owner(M) \
|
||||
rw_pr_lock_assert_not_write_owner(&(M)->m_prlock)
|
||||
|
||||
@@ -538,7 +567,7 @@ typedef struct st_mysql_cond mysql_cond_t;
|
||||
Instrumented cond_wait.
|
||||
@c mysql_cond_wait is a drop-in replacement for @c pthread_cond_wait.
|
||||
*/
|
||||
#ifdef HAVE_PSI_COND_INTERFACE
|
||||
#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE)
|
||||
#define mysql_cond_wait(C, M) \
|
||||
inline_mysql_cond_wait(C, M, __FILE__, __LINE__)
|
||||
#else
|
||||
@@ -552,7 +581,7 @@ typedef struct st_mysql_cond mysql_cond_t;
|
||||
@c mysql_cond_timedwait is a drop-in replacement
|
||||
for @c pthread_cond_timedwait.
|
||||
*/
|
||||
#ifdef HAVE_PSI_COND_INTERFACE
|
||||
#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE)
|
||||
#define mysql_cond_timedwait(C, M, W) \
|
||||
inline_mysql_cond_timedwait(C, M, W, __FILE__, __LINE__)
|
||||
#else
|
||||
@@ -618,6 +647,17 @@ typedef struct st_mysql_cond mysql_cond_t;
|
||||
#define mysql_thread_set_psi_id(I) do {} while (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@def mysql_thread_set_psi_THD(T)
|
||||
Set the thread sql session for the instrumentation.
|
||||
@param I The thread identifier
|
||||
*/
|
||||
#ifdef HAVE_PSI_THREAD_INTERFACE
|
||||
#define mysql_thread_set_psi_THD(T) inline_mysql_thread_set_psi_THD(T)
|
||||
#else
|
||||
#define mysql_thread_set_psi_THD(T) do {} while (0)
|
||||
#endif
|
||||
|
||||
static inline void inline_mysql_mutex_register(
|
||||
#ifdef HAVE_PSI_MUTEX_INTERFACE
|
||||
const char *category,
|
||||
@@ -1154,7 +1194,7 @@ static inline int inline_mysql_cond_destroy(
|
||||
static inline int inline_mysql_cond_wait(
|
||||
mysql_cond_t *that,
|
||||
mysql_mutex_t *mutex
|
||||
#ifdef HAVE_PSI_COND_INTERFACE
|
||||
#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE)
|
||||
, const char *src_file, uint src_line
|
||||
#endif
|
||||
)
|
||||
@@ -1191,7 +1231,7 @@ static inline int inline_mysql_cond_timedwait(
|
||||
mysql_cond_t *that,
|
||||
mysql_mutex_t *mutex,
|
||||
const struct timespec *abstime
|
||||
#ifdef HAVE_PSI_COND_INTERFACE
|
||||
#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE)
|
||||
, const char *src_file, uint src_line
|
||||
#endif
|
||||
)
|
||||
@@ -1281,6 +1321,16 @@ static inline void inline_mysql_thread_set_psi_id(my_thread_id id)
|
||||
struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)();
|
||||
PSI_THREAD_CALL(set_thread_id)(psi, id);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
class THD;
|
||||
static inline void inline_mysql_thread_set_psi_THD(THD *thd)
|
||||
{
|
||||
struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)();
|
||||
PSI_THREAD_CALL(set_thread_THD)(psi, thd);
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* DISABLE_MYSQL_THREAD_H */
|
||||
|
220
include/mysql/psi/mysql_transaction.h
Normal file
220
include/mysql/psi/mysql_transaction.h
Normal file
@@ -0,0 +1,220 @@
|
||||
/* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2.0,
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is also distributed with certain software (including
|
||||
but not limited to OpenSSL) that is licensed under separate terms,
|
||||
as designated in a particular file or component or in included license
|
||||
documentation. The authors of MySQL hereby grant you an additional
|
||||
permission to link the program and your derivative works with the
|
||||
separately licensed software that they have included with MySQL.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License, version 2.0, for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
#ifndef MYSQL_TRANSACTION_H
|
||||
#define MYSQL_TRANSACTION_H
|
||||
|
||||
/**
|
||||
@file mysql/psi/mysql_transaction.h
|
||||
Instrumentation helpers for transactions.
|
||||
*/
|
||||
|
||||
#include "mysql/psi/psi.h"
|
||||
|
||||
#ifndef PSI_TRANSACTION_CALL
|
||||
#define PSI_TRANSACTION_CALL(M) PSI_DYNAMIC_CALL(M)
|
||||
#endif
|
||||
|
||||
/**
|
||||
@defgroup Transaction_instrumentation Transaction Instrumentation
|
||||
@ingroup Instrumentation_interface
|
||||
@{
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
|
||||
#define MYSQL_START_TRANSACTION(STATE, XID, TRXID, ISO, RO, AC) \
|
||||
inline_mysql_start_transaction(STATE, XID, TRXID, ISO, RO, AC, __FILE__, __LINE__)
|
||||
#else
|
||||
#define MYSQL_START_TRANSACTION(STATE, XID, TRXID, ISO, RO, AC) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
|
||||
#define MYSQL_SET_TRANSACTION_GTID(LOCKER, P1, P2) \
|
||||
inline_mysql_set_transaction_gtid(LOCKER, P1, P2)
|
||||
#else
|
||||
#define MYSQL_SET_TRANSACTION_GTID(LOCKER, P1, P2) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
|
||||
#define MYSQL_SET_TRANSACTION_XID(LOCKER, P1, P2) \
|
||||
inline_mysql_set_transaction_xid(LOCKER, P1, P2)
|
||||
#else
|
||||
#define MYSQL_SET_TRANSACTION_XID(LOCKER, P1, P2) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
|
||||
#define MYSQL_SET_TRANSACTION_XA_STATE(LOCKER, P1) \
|
||||
inline_mysql_set_transaction_xa_state(LOCKER, P1)
|
||||
#else
|
||||
#define MYSQL_SET_TRANSACTION_XA_STATE(LOCKER, P1) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
|
||||
#define MYSQL_SET_TRANSACTION_TRXID(LOCKER, P1) \
|
||||
inline_mysql_set_transaction_trxid(LOCKER, P1)
|
||||
#else
|
||||
#define MYSQL_SET_TRANSACTION_TRXID(LOCKER, P1) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
|
||||
#define MYSQL_INC_TRANSACTION_SAVEPOINTS(LOCKER, P1) \
|
||||
inline_mysql_inc_transaction_savepoints(LOCKER, P1)
|
||||
#else
|
||||
#define MYSQL_INC_TRANSACTION_SAVEPOINTS(LOCKER, P1) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
|
||||
#define MYSQL_INC_TRANSACTION_ROLLBACK_TO_SAVEPOINT(LOCKER, P1) \
|
||||
inline_mysql_inc_transaction_rollback_to_savepoint(LOCKER, P1)
|
||||
#else
|
||||
#define MYSQL_INC_TRANSACTION_ROLLBACK_TO_SAVEPOINT(LOCKER, P1) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
|
||||
#define MYSQL_INC_TRANSACTION_RELEASE_SAVEPOINT(LOCKER, P1) \
|
||||
inline_mysql_inc_transaction_release_savepoint(LOCKER, P1)
|
||||
#else
|
||||
#define MYSQL_INC_TRANSACTION_RELEASE_SAVEPOINT(LOCKER, P1) \
|
||||
do {} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
|
||||
#define MYSQL_ROLLBACK_TRANSACTION(LOCKER) \
|
||||
inline_mysql_rollback_transaction(LOCKER)
|
||||
#else
|
||||
#define MYSQL_ROLLBACK_TRANSACTION(LOCKER) \
|
||||
NULL
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
|
||||
#define MYSQL_COMMIT_TRANSACTION(LOCKER) \
|
||||
inline_mysql_commit_transaction(LOCKER)
|
||||
#else
|
||||
#define MYSQL_COMMIT_TRANSACTION(LOCKER) \
|
||||
NULL
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
|
||||
static inline struct PSI_transaction_locker *
|
||||
inline_mysql_start_transaction(PSI_transaction_locker_state *state,
|
||||
const void *xid,
|
||||
const ulonglong *trxid,
|
||||
int isolation_level,
|
||||
my_bool read_only,
|
||||
my_bool autocommit,
|
||||
const char *src_file, int src_line)
|
||||
{
|
||||
PSI_transaction_locker *locker;
|
||||
locker= PSI_TRANSACTION_CALL(get_thread_transaction_locker)(state,
|
||||
xid, trxid,
|
||||
isolation_level,
|
||||
read_only,
|
||||
autocommit);
|
||||
if (likely(locker != NULL))
|
||||
PSI_TRANSACTION_CALL(start_transaction)(locker, src_file, src_line);
|
||||
return locker;
|
||||
}
|
||||
|
||||
static inline void
|
||||
inline_mysql_set_transaction_gtid(PSI_transaction_locker *locker,
|
||||
const void *sid,
|
||||
const void *gtid_spec)
|
||||
{
|
||||
if (likely(locker != NULL))
|
||||
PSI_TRANSACTION_CALL(set_transaction_gtid)(locker, sid, gtid_spec);
|
||||
}
|
||||
|
||||
static inline void
|
||||
inline_mysql_set_transaction_xid(PSI_transaction_locker *locker,
|
||||
const void *xid,
|
||||
int xa_state)
|
||||
{
|
||||
if (likely(locker != NULL))
|
||||
PSI_TRANSACTION_CALL(set_transaction_xid)(locker, xid, xa_state);
|
||||
}
|
||||
|
||||
static inline void
|
||||
inline_mysql_set_transaction_xa_state(PSI_transaction_locker *locker,
|
||||
int xa_state)
|
||||
{
|
||||
if (likely(locker != NULL))
|
||||
PSI_TRANSACTION_CALL(set_transaction_xa_state)(locker, xa_state);
|
||||
}
|
||||
|
||||
static inline void
|
||||
inline_mysql_set_transaction_trxid(PSI_transaction_locker *locker,
|
||||
const ulonglong *trxid)
|
||||
{
|
||||
if (likely(locker != NULL))
|
||||
PSI_TRANSACTION_CALL(set_transaction_trxid)(locker, trxid);
|
||||
}
|
||||
|
||||
static inline void
|
||||
inline_mysql_inc_transaction_savepoints(PSI_transaction_locker *locker,
|
||||
ulong count)
|
||||
{
|
||||
if (likely(locker != NULL))
|
||||
PSI_TRANSACTION_CALL(inc_transaction_savepoints)(locker, count);
|
||||
}
|
||||
|
||||
static inline void
|
||||
inline_mysql_inc_transaction_rollback_to_savepoint(PSI_transaction_locker *locker,
|
||||
ulong count)
|
||||
{
|
||||
if (likely(locker != NULL))
|
||||
PSI_TRANSACTION_CALL(inc_transaction_rollback_to_savepoint)(locker, count);
|
||||
}
|
||||
|
||||
static inline void
|
||||
inline_mysql_inc_transaction_release_savepoint(PSI_transaction_locker *locker,
|
||||
ulong count)
|
||||
{
|
||||
if (likely(locker != NULL))
|
||||
PSI_TRANSACTION_CALL(inc_transaction_release_savepoint)(locker, count);
|
||||
}
|
||||
|
||||
static inline void
|
||||
inline_mysql_rollback_transaction(struct PSI_transaction_locker *locker)
|
||||
{
|
||||
if (likely(locker != NULL))
|
||||
PSI_TRANSACTION_CALL(end_transaction)(locker, false);
|
||||
}
|
||||
|
||||
static inline void
|
||||
inline_mysql_commit_transaction(struct PSI_transaction_locker *locker)
|
||||
{
|
||||
if (likely(locker != NULL))
|
||||
PSI_TRANSACTION_CALL(end_transaction)(locker, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} (end of group Transaction_instrumentation) */
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2.0,
|
||||
|
@@ -1,7 +1,23 @@
|
||||
#include "mysql/psi/psi.h"
|
||||
#include "psi_base.h"
|
||||
#include "psi_memory.h"
|
||||
#include "psi_base.h"
|
||||
struct PSI_thread;
|
||||
typedef unsigned int PSI_memory_key;
|
||||
C_MODE_START
|
||||
struct MDL_key;
|
||||
typedef struct MDL_key MDL_key;
|
||||
typedef int opaque_mdl_type;
|
||||
typedef int opaque_mdl_duration;
|
||||
typedef int opaque_mdl_status;
|
||||
typedef int opaque_vio_type;
|
||||
struct TABLE_SHARE;
|
||||
struct sql_digest_storage;
|
||||
struct opaque_THD
|
||||
{
|
||||
int dummy;
|
||||
};
|
||||
typedef struct opaque_THD THD;
|
||||
struct PSI_mutex;
|
||||
typedef struct PSI_mutex PSI_mutex;
|
||||
struct PSI_rwlock;
|
||||
@@ -18,14 +34,51 @@ struct PSI_file;
|
||||
typedef struct PSI_file PSI_file;
|
||||
struct PSI_socket;
|
||||
typedef struct PSI_socket PSI_socket;
|
||||
struct PSI_prepared_stmt;
|
||||
typedef struct PSI_prepared_stmt PSI_prepared_stmt;
|
||||
struct PSI_table_locker;
|
||||
typedef struct PSI_table_locker PSI_table_locker;
|
||||
struct PSI_statement_locker;
|
||||
typedef struct PSI_statement_locker PSI_statement_locker;
|
||||
struct PSI_transaction_locker;
|
||||
typedef struct PSI_transaction_locker PSI_transaction_locker;
|
||||
struct PSI_idle_locker;
|
||||
typedef struct PSI_idle_locker PSI_idle_locker;
|
||||
struct PSI_digest_locker;
|
||||
typedef struct PSI_digest_locker PSI_digest_locker;
|
||||
struct PSI_sp_share;
|
||||
typedef struct PSI_sp_share PSI_sp_share;
|
||||
struct PSI_sp_locker;
|
||||
typedef struct PSI_sp_locker PSI_sp_locker;
|
||||
struct PSI_metadata_lock;
|
||||
typedef struct PSI_metadata_lock PSI_metadata_lock;
|
||||
struct PSI_stage_progress
|
||||
{
|
||||
ulonglong m_work_completed;
|
||||
ulonglong m_work_estimated;
|
||||
};
|
||||
typedef struct PSI_stage_progress PSI_stage_progress;
|
||||
enum PSI_table_io_operation
|
||||
{
|
||||
PSI_TABLE_FETCH_ROW= 0,
|
||||
PSI_TABLE_WRITE_ROW= 1,
|
||||
PSI_TABLE_UPDATE_ROW= 2,
|
||||
PSI_TABLE_DELETE_ROW= 3
|
||||
};
|
||||
typedef enum PSI_table_io_operation PSI_table_io_operation;
|
||||
struct PSI_table_locker_state
|
||||
{
|
||||
uint m_flags;
|
||||
enum PSI_table_io_operation m_io_operation;
|
||||
struct PSI_table *m_table;
|
||||
struct PSI_table_share *m_table_share;
|
||||
struct PSI_thread *m_thread;
|
||||
ulonglong m_timer_start;
|
||||
ulonglong (*m_timer)(void);
|
||||
void *m_wait;
|
||||
uint m_index;
|
||||
};
|
||||
typedef struct PSI_table_locker_state PSI_table_locker_state;
|
||||
struct PSI_bootstrap
|
||||
{
|
||||
void* (*get_interface)(int version);
|
||||
|
@@ -1,6 +1,37 @@
|
||||
extern "C" {
|
||||
}
|
||||
extern "C" {
|
||||
struct PSI_thread;
|
||||
typedef unsigned int PSI_memory_key;
|
||||
struct PSI_memory_info_v1
|
||||
{
|
||||
PSI_memory_key *m_key;
|
||||
const char *m_name;
|
||||
int m_flags;
|
||||
};
|
||||
typedef struct PSI_memory_info_v1 PSI_memory_info_v1;
|
||||
typedef void (*register_memory_v1_t)
|
||||
(const char *category, struct PSI_memory_info_v1 *info, int count);
|
||||
typedef PSI_memory_key (*memory_alloc_v1_t)
|
||||
(PSI_memory_key key, size_t size, struct PSI_thread ** owner);
|
||||
typedef PSI_memory_key (*memory_realloc_v1_t)
|
||||
(PSI_memory_key key, size_t old_size, size_t new_size, struct PSI_thread ** owner);
|
||||
typedef PSI_memory_key (*memory_claim_v1_t)
|
||||
(PSI_memory_key key, size_t size, struct PSI_thread ** owner);
|
||||
typedef void (*memory_free_v1_t)
|
||||
(PSI_memory_key key, size_t size, struct PSI_thread * owner);
|
||||
typedef struct PSI_memory_info_v1 PSI_memory_info;
|
||||
}
|
||||
C_MODE_START
|
||||
struct MDL_key;
|
||||
typedef struct MDL_key MDL_key;
|
||||
typedef int opaque_mdl_type;
|
||||
typedef int opaque_mdl_duration;
|
||||
typedef int opaque_mdl_status;
|
||||
typedef int opaque_vio_type;
|
||||
struct TABLE_SHARE;
|
||||
struct sql_digest_storage;
|
||||
class THD;
|
||||
struct PSI_mutex;
|
||||
typedef struct PSI_mutex PSI_mutex;
|
||||
struct PSI_rwlock;
|
||||
@@ -17,14 +48,51 @@ struct PSI_file;
|
||||
typedef struct PSI_file PSI_file;
|
||||
struct PSI_socket;
|
||||
typedef struct PSI_socket PSI_socket;
|
||||
struct PSI_prepared_stmt;
|
||||
typedef struct PSI_prepared_stmt PSI_prepared_stmt;
|
||||
struct PSI_table_locker;
|
||||
typedef struct PSI_table_locker PSI_table_locker;
|
||||
struct PSI_statement_locker;
|
||||
typedef struct PSI_statement_locker PSI_statement_locker;
|
||||
struct PSI_transaction_locker;
|
||||
typedef struct PSI_transaction_locker PSI_transaction_locker;
|
||||
struct PSI_idle_locker;
|
||||
typedef struct PSI_idle_locker PSI_idle_locker;
|
||||
struct PSI_digest_locker;
|
||||
typedef struct PSI_digest_locker PSI_digest_locker;
|
||||
struct PSI_sp_share;
|
||||
typedef struct PSI_sp_share PSI_sp_share;
|
||||
struct PSI_sp_locker;
|
||||
typedef struct PSI_sp_locker PSI_sp_locker;
|
||||
struct PSI_metadata_lock;
|
||||
typedef struct PSI_metadata_lock PSI_metadata_lock;
|
||||
struct PSI_stage_progress
|
||||
{
|
||||
ulonglong m_work_completed;
|
||||
ulonglong m_work_estimated;
|
||||
};
|
||||
typedef struct PSI_stage_progress PSI_stage_progress;
|
||||
enum PSI_table_io_operation
|
||||
{
|
||||
PSI_TABLE_FETCH_ROW= 0,
|
||||
PSI_TABLE_WRITE_ROW= 1,
|
||||
PSI_TABLE_UPDATE_ROW= 2,
|
||||
PSI_TABLE_DELETE_ROW= 3
|
||||
};
|
||||
typedef enum PSI_table_io_operation PSI_table_io_operation;
|
||||
struct PSI_table_locker_state
|
||||
{
|
||||
uint m_flags;
|
||||
enum PSI_table_io_operation m_io_operation;
|
||||
struct PSI_table *m_table;
|
||||
struct PSI_table_share *m_table_share;
|
||||
struct PSI_thread *m_thread;
|
||||
ulonglong m_timer_start;
|
||||
ulonglong (*m_timer)(void);
|
||||
void *m_wait;
|
||||
uint m_index;
|
||||
};
|
||||
typedef struct PSI_table_locker_state PSI_table_locker_state;
|
||||
struct PSI_bootstrap
|
||||
{
|
||||
void* (*get_interface)(int version);
|
||||
@@ -40,6 +108,8 @@ struct PSI_file_locker;
|
||||
typedef struct PSI_file_locker PSI_file_locker;
|
||||
struct PSI_socket_locker;
|
||||
typedef struct PSI_socket_locker PSI_socket_locker;
|
||||
struct PSI_metadata_locker;
|
||||
typedef struct PSI_metadata_locker PSI_metadata_locker;
|
||||
enum PSI_mutex_operation
|
||||
{
|
||||
PSI_MUTEX_LOCK= 0,
|
||||
@@ -51,7 +121,13 @@ enum PSI_rwlock_operation
|
||||
PSI_RWLOCK_READLOCK= 0,
|
||||
PSI_RWLOCK_WRITELOCK= 1,
|
||||
PSI_RWLOCK_TRYREADLOCK= 2,
|
||||
PSI_RWLOCK_TRYWRITELOCK= 3
|
||||
PSI_RWLOCK_TRYWRITELOCK= 3,
|
||||
PSI_RWLOCK_SHAREDLOCK= 4,
|
||||
PSI_RWLOCK_SHAREDEXCLUSIVELOCK= 5,
|
||||
PSI_RWLOCK_EXCLUSIVELOCK= 6,
|
||||
PSI_RWLOCK_TRYSHAREDLOCK= 7,
|
||||
PSI_RWLOCK_TRYSHAREDEXCLUSIVELOCK= 8,
|
||||
PSI_RWLOCK_TRYEXCLUSIVELOCK= 9
|
||||
};
|
||||
typedef enum PSI_rwlock_operation PSI_rwlock_operation;
|
||||
enum PSI_cond_operation
|
||||
@@ -81,14 +157,6 @@ enum PSI_file_operation
|
||||
PSI_FILE_SYNC= 16
|
||||
};
|
||||
typedef enum PSI_file_operation PSI_file_operation;
|
||||
enum PSI_table_io_operation
|
||||
{
|
||||
PSI_TABLE_FETCH_ROW= 0,
|
||||
PSI_TABLE_WRITE_ROW= 1,
|
||||
PSI_TABLE_UPDATE_ROW= 2,
|
||||
PSI_TABLE_DELETE_ROW= 3
|
||||
};
|
||||
typedef enum PSI_table_io_operation PSI_table_io_operation;
|
||||
enum PSI_table_lock_operation
|
||||
{
|
||||
PSI_TABLE_LOCK= 0,
|
||||
@@ -134,48 +202,56 @@ struct PSI_mutex_info_v1
|
||||
const char *m_name;
|
||||
int m_flags;
|
||||
};
|
||||
typedef struct PSI_mutex_info_v1 PSI_mutex_info_v1;
|
||||
struct PSI_rwlock_info_v1
|
||||
{
|
||||
PSI_rwlock_key *m_key;
|
||||
const char *m_name;
|
||||
int m_flags;
|
||||
};
|
||||
typedef struct PSI_rwlock_info_v1 PSI_rwlock_info_v1;
|
||||
struct PSI_cond_info_v1
|
||||
{
|
||||
PSI_cond_key *m_key;
|
||||
const char *m_name;
|
||||
int m_flags;
|
||||
};
|
||||
typedef struct PSI_cond_info_v1 PSI_cond_info_v1;
|
||||
struct PSI_thread_info_v1
|
||||
{
|
||||
PSI_thread_key *m_key;
|
||||
const char *m_name;
|
||||
int m_flags;
|
||||
};
|
||||
typedef struct PSI_thread_info_v1 PSI_thread_info_v1;
|
||||
struct PSI_file_info_v1
|
||||
{
|
||||
PSI_file_key *m_key;
|
||||
const char *m_name;
|
||||
int m_flags;
|
||||
};
|
||||
typedef struct PSI_file_info_v1 PSI_file_info_v1;
|
||||
struct PSI_stage_info_v1
|
||||
{
|
||||
PSI_stage_key m_key;
|
||||
const char *m_name;
|
||||
int m_flags;
|
||||
};
|
||||
typedef struct PSI_stage_info_v1 PSI_stage_info_v1;
|
||||
struct PSI_statement_info_v1
|
||||
{
|
||||
PSI_statement_key m_key;
|
||||
const char *m_name;
|
||||
int m_flags;
|
||||
};
|
||||
typedef struct PSI_statement_info_v1 PSI_statement_info_v1;
|
||||
struct PSI_socket_info_v1
|
||||
{
|
||||
PSI_socket_key *m_key;
|
||||
const char *m_name;
|
||||
int m_flags;
|
||||
};
|
||||
typedef struct PSI_socket_info_v1 PSI_socket_info_v1;
|
||||
struct PSI_idle_locker_state_v1
|
||||
{
|
||||
uint m_flags;
|
||||
@@ -184,6 +260,7 @@ struct PSI_idle_locker_state_v1
|
||||
ulonglong (*m_timer)(void);
|
||||
void *m_wait;
|
||||
};
|
||||
typedef struct PSI_idle_locker_state_v1 PSI_idle_locker_state_v1;
|
||||
struct PSI_mutex_locker_state_v1
|
||||
{
|
||||
uint m_flags;
|
||||
@@ -194,6 +271,7 @@ struct PSI_mutex_locker_state_v1
|
||||
ulonglong (*m_timer)(void);
|
||||
void *m_wait;
|
||||
};
|
||||
typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state_v1;
|
||||
struct PSI_rwlock_locker_state_v1
|
||||
{
|
||||
uint m_flags;
|
||||
@@ -204,6 +282,7 @@ struct PSI_rwlock_locker_state_v1
|
||||
ulonglong (*m_timer)(void);
|
||||
void *m_wait;
|
||||
};
|
||||
typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state_v1;
|
||||
struct PSI_cond_locker_state_v1
|
||||
{
|
||||
uint m_flags;
|
||||
@@ -215,6 +294,7 @@ struct PSI_cond_locker_state_v1
|
||||
ulonglong (*m_timer)(void);
|
||||
void *m_wait;
|
||||
};
|
||||
typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state_v1;
|
||||
struct PSI_file_locker_state_v1
|
||||
{
|
||||
uint m_flags;
|
||||
@@ -228,21 +308,21 @@ struct PSI_file_locker_state_v1
|
||||
ulonglong (*m_timer)(void);
|
||||
void *m_wait;
|
||||
};
|
||||
struct PSI_table_locker_state_v1
|
||||
typedef struct PSI_file_locker_state_v1 PSI_file_locker_state_v1;
|
||||
struct PSI_metadata_locker_state_v1
|
||||
{
|
||||
uint m_flags;
|
||||
enum PSI_table_io_operation m_io_operation;
|
||||
struct PSI_table *m_table;
|
||||
struct PSI_table_share *m_table_share;
|
||||
struct PSI_metadata_lock *m_metadata_lock;
|
||||
struct PSI_thread *m_thread;
|
||||
ulonglong m_timer_start;
|
||||
ulonglong (*m_timer)(void);
|
||||
void *m_wait;
|
||||
uint m_index;
|
||||
};
|
||||
typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state_v1;
|
||||
struct PSI_statement_locker_state_v1
|
||||
{
|
||||
my_bool m_discarded;
|
||||
my_bool m_in_prepare;
|
||||
uchar m_no_index_used;
|
||||
uchar m_no_good_index_used;
|
||||
uint m_flags;
|
||||
@@ -269,7 +349,26 @@ struct PSI_statement_locker_state_v1
|
||||
char m_schema_name[(64 * 3)];
|
||||
uint m_schema_name_length;
|
||||
uint m_cs_number;
|
||||
PSI_sp_share *m_parent_sp_share;
|
||||
PSI_prepared_stmt *m_parent_prepared_stmt;
|
||||
};
|
||||
typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state_v1;
|
||||
struct PSI_transaction_locker_state_v1
|
||||
{
|
||||
uint m_flags;
|
||||
void *m_class;
|
||||
struct PSI_thread *m_thread;
|
||||
ulonglong m_timer_start;
|
||||
ulonglong (*m_timer)(void);
|
||||
void *m_transaction;
|
||||
my_bool m_read_only;
|
||||
my_bool m_autocommit;
|
||||
ulong m_statement_count;
|
||||
ulong m_savepoint_count;
|
||||
ulong m_rollback_to_savepoint_count;
|
||||
ulong m_release_savepoint_count;
|
||||
};
|
||||
typedef struct PSI_transaction_locker_state_v1 PSI_transaction_locker_state_v1;
|
||||
struct PSI_socket_locker_state_v1
|
||||
{
|
||||
uint m_flags;
|
||||
@@ -283,6 +382,16 @@ struct PSI_socket_locker_state_v1
|
||||
int m_src_line;
|
||||
void *m_wait;
|
||||
};
|
||||
typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state_v1;
|
||||
struct PSI_sp_locker_state_v1
|
||||
{
|
||||
uint m_flags;
|
||||
struct PSI_thread *m_thread;
|
||||
ulonglong m_timer_start;
|
||||
ulonglong (*m_timer)(void);
|
||||
PSI_sp_share* m_sp_share;
|
||||
};
|
||||
typedef struct PSI_sp_locker_state_v1 PSI_sp_locker_state_v1;
|
||||
typedef void (*register_mutex_v1_t)
|
||||
(const char *category, struct PSI_mutex_info_v1 *info, int count);
|
||||
typedef void (*register_rwlock_v1_t)
|
||||
@@ -324,7 +433,8 @@ typedef void (*unbind_table_v1_t)
|
||||
(struct PSI_table *table);
|
||||
typedef PSI_table* (*rebind_table_v1_t)
|
||||
(PSI_table_share *share, const void *identity, PSI_table *table);
|
||||
typedef void (*close_table_v1_t)(struct PSI_table *table);
|
||||
typedef void (*close_table_v1_t)(struct TABLE_SHARE *server_share,
|
||||
struct PSI_table *table);
|
||||
typedef void (*create_file_v1_t)(PSI_file_key key, const char *name,
|
||||
File file);
|
||||
typedef int (*spawn_thread_v1_t)(PSI_thread_key key,
|
||||
@@ -333,14 +443,18 @@ typedef int (*spawn_thread_v1_t)(PSI_thread_key key,
|
||||
void *(*start_routine)(void*), void *arg);
|
||||
typedef struct PSI_thread* (*new_thread_v1_t)
|
||||
(PSI_thread_key key, const void *identity, ulonglong thread_id);
|
||||
typedef void (*set_thread_THD_v1_t)(struct PSI_thread *thread,
|
||||
THD *thd);
|
||||
typedef void (*set_thread_id_v1_t)(struct PSI_thread *thread,
|
||||
ulonglong id);
|
||||
typedef void (*set_thread_os_id_v1_t)(struct PSI_thread *thread);
|
||||
typedef struct PSI_thread* (*get_thread_v1_t)(void);
|
||||
typedef void (*set_thread_user_v1_t)(const char *user, int user_len);
|
||||
typedef void (*set_thread_user_host_v1_t)(const char *user, int user_len,
|
||||
const char *host, int host_len);
|
||||
typedef void (*set_thread_account_v1_t)(const char *user, int user_len,
|
||||
const char *host, int host_len);
|
||||
typedef void (*set_thread_db_v1_t)(const char* db, int db_len);
|
||||
typedef void (*set_thread_command_v1_t)(int command);
|
||||
typedef void (*set_connection_type_v1_t)(opaque_vio_type conn_type);
|
||||
typedef void (*set_thread_start_time_v1_t)(time_t start_time);
|
||||
typedef void (*set_thread_state_v1_t)(const char* state);
|
||||
typedef void (*set_thread_info_v1_t)(const char* info, uint info_len);
|
||||
@@ -399,25 +513,30 @@ typedef struct PSI_cond_locker* (*start_cond_wait_v1_t)
|
||||
typedef void (*end_cond_wait_v1_t)
|
||||
(struct PSI_cond_locker *locker, int rc);
|
||||
typedef struct PSI_table_locker* (*start_table_io_wait_v1_t)
|
||||
(struct PSI_table_locker_state_v1 *state,
|
||||
(struct PSI_table_locker_state *state,
|
||||
struct PSI_table *table,
|
||||
enum PSI_table_io_operation op,
|
||||
uint index,
|
||||
const char *src_file, uint src_line);
|
||||
typedef void (*end_table_io_wait_v1_t)(struct PSI_table_locker *locker);
|
||||
typedef void (*end_table_io_wait_v1_t)
|
||||
(struct PSI_table_locker *locker,
|
||||
ulonglong numrows);
|
||||
typedef struct PSI_table_locker* (*start_table_lock_wait_v1_t)
|
||||
(struct PSI_table_locker_state_v1 *state,
|
||||
(struct PSI_table_locker_state *state,
|
||||
struct PSI_table *table,
|
||||
enum PSI_table_lock_operation op,
|
||||
ulong flags,
|
||||
const char *src_file, uint src_line);
|
||||
typedef void (*end_table_lock_wait_v1_t)(struct PSI_table_locker *locker);
|
||||
typedef void (*unlock_table_v1_t)(struct PSI_table *table);
|
||||
typedef void (*start_file_open_wait_v1_t)
|
||||
(struct PSI_file_locker *locker, const char *src_file, uint src_line);
|
||||
typedef struct PSI_file* (*end_file_open_wait_v1_t)
|
||||
(struct PSI_file_locker *locker, void *result);
|
||||
typedef void (*end_file_open_wait_and_bind_to_descriptor_v1_t)
|
||||
(struct PSI_file_locker *locker, File file);
|
||||
typedef void (*end_temp_file_open_wait_and_bind_to_descriptor_v1_t)
|
||||
(struct PSI_file_locker *locker, File file, const char *filename);
|
||||
typedef void (*start_file_wait_v1_t)
|
||||
(struct PSI_file_locker *locker, size_t count,
|
||||
const char *src_file, uint src_line);
|
||||
@@ -427,12 +546,16 @@ typedef void (*start_file_close_wait_v1_t)
|
||||
(struct PSI_file_locker *locker, const char *src_file, uint src_line);
|
||||
typedef void (*end_file_close_wait_v1_t)
|
||||
(struct PSI_file_locker *locker, int rc);
|
||||
typedef void (*start_stage_v1_t)
|
||||
typedef void (*end_file_rename_wait_v1_t)
|
||||
(struct PSI_file_locker *locker, const char *old_name,
|
||||
const char *new_name, int rc);
|
||||
typedef PSI_stage_progress* (*start_stage_v1_t)
|
||||
(PSI_stage_key key, const char *src_file, int src_line);
|
||||
typedef PSI_stage_progress* (*get_current_stage_progress_v1_t)(void);
|
||||
typedef void (*end_stage_v1_t) (void);
|
||||
typedef struct PSI_statement_locker* (*get_thread_statement_locker_v1_t)
|
||||
(struct PSI_statement_locker_state_v1 *state,
|
||||
PSI_statement_key key, const void *charset);
|
||||
PSI_statement_key key, const void *charset, PSI_sp_share *sp_share);
|
||||
typedef struct PSI_statement_locker* (*refine_statement_v1_t)
|
||||
(struct PSI_statement_locker *locker,
|
||||
PSI_statement_key key);
|
||||
@@ -477,6 +600,34 @@ typedef void (*set_statement_no_good_index_used_t)
|
||||
(struct PSI_statement_locker *locker);
|
||||
typedef void (*end_statement_v1_t)
|
||||
(struct PSI_statement_locker *locker, void *stmt_da);
|
||||
typedef struct PSI_transaction_locker* (*get_thread_transaction_locker_v1_t)
|
||||
(struct PSI_transaction_locker_state_v1 *state, const void *xid,
|
||||
const ulonglong *trxid, int isolation_level, my_bool read_only,
|
||||
my_bool autocommit);
|
||||
typedef void (*start_transaction_v1_t)
|
||||
(struct PSI_transaction_locker *locker,
|
||||
const char *src_file, uint src_line);
|
||||
typedef void (*set_transaction_xid_v1_t)
|
||||
(struct PSI_transaction_locker *locker,
|
||||
const void *xid, int xa_state);
|
||||
typedef void (*set_transaction_xa_state_v1_t)
|
||||
(struct PSI_transaction_locker *locker,
|
||||
int xa_state);
|
||||
typedef void (*set_transaction_gtid_v1_t)
|
||||
(struct PSI_transaction_locker *locker,
|
||||
const void *sid, const void *gtid_spec);
|
||||
typedef void (*set_transaction_trxid_v1_t)
|
||||
(struct PSI_transaction_locker *locker,
|
||||
const ulonglong *trxid);
|
||||
typedef void (*inc_transaction_savepoints_v1_t)
|
||||
(struct PSI_transaction_locker *locker, ulong count);
|
||||
typedef void (*inc_transaction_rollback_to_savepoint_v1_t)
|
||||
(struct PSI_transaction_locker *locker, ulong count);
|
||||
typedef void (*inc_transaction_release_savepoint_v1_t)
|
||||
(struct PSI_transaction_locker *locker, ulong count);
|
||||
typedef void (*end_transaction_v1_t)
|
||||
(struct PSI_transaction_locker *locker,
|
||||
my_bool commit);
|
||||
typedef struct PSI_socket_locker* (*start_socket_wait_v1_t)
|
||||
(struct PSI_socket_locker_state_v1 *state,
|
||||
struct PSI_socket *socket,
|
||||
@@ -492,10 +643,53 @@ typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket,
|
||||
const struct sockaddr *addr,
|
||||
socklen_t addr_len);
|
||||
typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket);
|
||||
typedef PSI_prepared_stmt* (*create_prepared_stmt_v1_t)
|
||||
(void *identity, uint stmt_id, PSI_statement_locker *locker,
|
||||
const char *stmt_name, size_t stmt_name_length,
|
||||
const char *name, size_t length);
|
||||
typedef void (*destroy_prepared_stmt_v1_t)
|
||||
(PSI_prepared_stmt *prepared_stmt);
|
||||
typedef void (*reprepare_prepared_stmt_v1_t)
|
||||
(PSI_prepared_stmt *prepared_stmt);
|
||||
typedef void (*execute_prepared_stmt_v1_t)
|
||||
(PSI_statement_locker *locker, PSI_prepared_stmt* prepared_stmt);
|
||||
typedef void (*set_prepared_stmt_text_v1_t)(PSI_prepared_stmt *prepared_stmt,
|
||||
const char *text,
|
||||
uint text_len);
|
||||
typedef struct PSI_digest_locker * (*digest_start_v1_t)
|
||||
(struct PSI_statement_locker *locker);
|
||||
typedef void (*digest_end_v1_t)
|
||||
(struct PSI_digest_locker *locker, const struct sql_digest_storage *digest);
|
||||
typedef PSI_sp_locker* (*start_sp_v1_t)
|
||||
(struct PSI_sp_locker_state_v1 *state, struct PSI_sp_share* sp_share);
|
||||
typedef void (*end_sp_v1_t)
|
||||
(struct PSI_sp_locker *locker);
|
||||
typedef void (*drop_sp_v1_t)
|
||||
(uint object_type,
|
||||
const char *schema_name, uint schema_name_length,
|
||||
const char *object_name, uint object_name_length);
|
||||
typedef struct PSI_sp_share* (*get_sp_share_v1_t)
|
||||
(uint object_type,
|
||||
const char *schema_name, uint schema_name_length,
|
||||
const char *object_name, uint object_name_length);
|
||||
typedef void (*release_sp_share_v1_t)(struct PSI_sp_share *share);
|
||||
typedef PSI_metadata_lock* (*create_metadata_lock_v1_t)
|
||||
(void *identity,
|
||||
const MDL_key *key,
|
||||
opaque_mdl_type mdl_type,
|
||||
opaque_mdl_duration mdl_duration,
|
||||
opaque_mdl_status mdl_status,
|
||||
const char *src_file,
|
||||
uint src_line);
|
||||
typedef void (*set_metadata_lock_status_v1_t)(PSI_metadata_lock *lock,
|
||||
opaque_mdl_status mdl_status);
|
||||
typedef void (*destroy_metadata_lock_v1_t)(PSI_metadata_lock *lock);
|
||||
typedef struct PSI_metadata_locker* (*start_metadata_wait_v1_t)
|
||||
(struct PSI_metadata_locker_state_v1 *state,
|
||||
struct PSI_metadata_lock *mdl,
|
||||
const char *src_file, uint src_line);
|
||||
typedef void (*end_metadata_wait_v1_t)
|
||||
(struct PSI_metadata_locker *locker, int rc);
|
||||
typedef int (*set_thread_connect_attrs_v1_t)(const char *buffer, uint length,
|
||||
const void *from_cs);
|
||||
struct PSI_v1
|
||||
@@ -527,11 +721,14 @@ struct PSI_v1
|
||||
spawn_thread_v1_t spawn_thread;
|
||||
new_thread_v1_t new_thread;
|
||||
set_thread_id_v1_t set_thread_id;
|
||||
set_thread_THD_v1_t set_thread_THD;
|
||||
set_thread_os_id_v1_t set_thread_os_id;
|
||||
get_thread_v1_t get_thread;
|
||||
set_thread_user_v1_t set_thread_user;
|
||||
set_thread_user_host_v1_t set_thread_user_host;
|
||||
set_thread_account_v1_t set_thread_account;
|
||||
set_thread_db_v1_t set_thread_db;
|
||||
set_thread_command_v1_t set_thread_command;
|
||||
set_connection_type_v1_t set_connection_type;
|
||||
set_thread_start_time_v1_t set_thread_start_time;
|
||||
set_thread_state_v1_t set_thread_state;
|
||||
set_thread_info_v1_t set_thread_info;
|
||||
@@ -563,11 +760,15 @@ struct PSI_v1
|
||||
end_file_open_wait_v1_t end_file_open_wait;
|
||||
end_file_open_wait_and_bind_to_descriptor_v1_t
|
||||
end_file_open_wait_and_bind_to_descriptor;
|
||||
end_temp_file_open_wait_and_bind_to_descriptor_v1_t
|
||||
end_temp_file_open_wait_and_bind_to_descriptor;
|
||||
start_file_wait_v1_t start_file_wait;
|
||||
end_file_wait_v1_t end_file_wait;
|
||||
start_file_close_wait_v1_t start_file_close_wait;
|
||||
end_file_close_wait_v1_t end_file_close_wait;
|
||||
end_file_rename_wait_v1_t end_file_rename_wait;
|
||||
start_stage_v1_t start_stage;
|
||||
get_current_stage_progress_v1_t get_current_stage_progress;
|
||||
end_stage_v1_t end_stage;
|
||||
get_thread_statement_locker_v1_t get_thread_statement_locker;
|
||||
refine_statement_v1_t refine_statement;
|
||||
@@ -590,14 +791,45 @@ struct PSI_v1
|
||||
set_statement_no_index_used_t set_statement_no_index_used;
|
||||
set_statement_no_good_index_used_t set_statement_no_good_index_used;
|
||||
end_statement_v1_t end_statement;
|
||||
get_thread_transaction_locker_v1_t get_thread_transaction_locker;
|
||||
start_transaction_v1_t start_transaction;
|
||||
set_transaction_xid_v1_t set_transaction_xid;
|
||||
set_transaction_xa_state_v1_t set_transaction_xa_state;
|
||||
set_transaction_gtid_v1_t set_transaction_gtid;
|
||||
set_transaction_trxid_v1_t set_transaction_trxid;
|
||||
inc_transaction_savepoints_v1_t inc_transaction_savepoints;
|
||||
inc_transaction_rollback_to_savepoint_v1_t inc_transaction_rollback_to_savepoint;
|
||||
inc_transaction_release_savepoint_v1_t inc_transaction_release_savepoint;
|
||||
end_transaction_v1_t end_transaction;
|
||||
start_socket_wait_v1_t start_socket_wait;
|
||||
end_socket_wait_v1_t end_socket_wait;
|
||||
set_socket_state_v1_t set_socket_state;
|
||||
set_socket_info_v1_t set_socket_info;
|
||||
set_socket_thread_owner_v1_t set_socket_thread_owner;
|
||||
create_prepared_stmt_v1_t create_prepared_stmt;
|
||||
destroy_prepared_stmt_v1_t destroy_prepared_stmt;
|
||||
reprepare_prepared_stmt_v1_t reprepare_prepared_stmt;
|
||||
execute_prepared_stmt_v1_t execute_prepared_stmt;
|
||||
set_prepared_stmt_text_v1_t set_prepared_stmt_text;
|
||||
digest_start_v1_t digest_start;
|
||||
digest_end_v1_t digest_end;
|
||||
set_thread_connect_attrs_v1_t set_thread_connect_attrs;
|
||||
start_sp_v1_t start_sp;
|
||||
end_sp_v1_t end_sp;
|
||||
drop_sp_v1_t drop_sp;
|
||||
get_sp_share_v1_t get_sp_share;
|
||||
release_sp_share_v1_t release_sp_share;
|
||||
register_memory_v1_t register_memory;
|
||||
memory_alloc_v1_t memory_alloc;
|
||||
memory_realloc_v1_t memory_realloc;
|
||||
memory_claim_v1_t memory_claim;
|
||||
memory_free_v1_t memory_free;
|
||||
unlock_table_v1_t unlock_table;
|
||||
create_metadata_lock_v1_t create_metadata_lock;
|
||||
set_metadata_lock_status_v1_t set_metadata_lock_status;
|
||||
destroy_metadata_lock_v1_t destroy_metadata_lock;
|
||||
start_metadata_wait_v1_t start_metadata_wait;
|
||||
end_metadata_wait_v1_t end_metadata_wait;
|
||||
};
|
||||
typedef struct PSI_v1 PSI;
|
||||
typedef struct PSI_mutex_info_v1 PSI_mutex_info;
|
||||
@@ -607,15 +839,18 @@ typedef struct PSI_thread_info_v1 PSI_thread_info;
|
||||
typedef struct PSI_file_info_v1 PSI_file_info;
|
||||
typedef struct PSI_stage_info_v1 PSI_stage_info;
|
||||
typedef struct PSI_statement_info_v1 PSI_statement_info;
|
||||
typedef struct PSI_transaction_info_v1 PSI_transaction_info;
|
||||
typedef struct PSI_socket_info_v1 PSI_socket_info;
|
||||
typedef struct PSI_idle_locker_state_v1 PSI_idle_locker_state;
|
||||
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;
|
||||
typedef struct PSI_statement_locker_state_v1 PSI_statement_locker_state;
|
||||
typedef struct PSI_transaction_locker_state_v1 PSI_transaction_locker_state;
|
||||
typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state;
|
||||
typedef struct PSI_sp_locker_state_v1 PSI_sp_locker_state;
|
||||
typedef struct PSI_metadata_locker_state_v1 PSI_metadata_locker_state;
|
||||
extern MYSQL_PLUGIN_IMPORT my_bool pfs_enabled;
|
||||
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
|
||||
C_MODE_END
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2.0,
|
||||
|
@@ -1,6 +1,24 @@
|
||||
extern "C" {
|
||||
}
|
||||
extern "C" {
|
||||
struct PSI_thread;
|
||||
typedef unsigned int PSI_memory_key;
|
||||
struct PSI_memory_info_v2
|
||||
{
|
||||
int placeholder;
|
||||
};
|
||||
typedef struct PSI_memory_info_v2 PSI_memory_info;
|
||||
}
|
||||
C_MODE_START
|
||||
struct MDL_key;
|
||||
typedef struct MDL_key MDL_key;
|
||||
typedef int opaque_mdl_type;
|
||||
typedef int opaque_mdl_duration;
|
||||
typedef int opaque_mdl_status;
|
||||
typedef int opaque_vio_type;
|
||||
struct TABLE_SHARE;
|
||||
struct sql_digest_storage;
|
||||
class THD;
|
||||
struct PSI_mutex;
|
||||
typedef struct PSI_mutex PSI_mutex;
|
||||
struct PSI_rwlock;
|
||||
@@ -17,14 +35,51 @@ struct PSI_file;
|
||||
typedef struct PSI_file PSI_file;
|
||||
struct PSI_socket;
|
||||
typedef struct PSI_socket PSI_socket;
|
||||
struct PSI_prepared_stmt;
|
||||
typedef struct PSI_prepared_stmt PSI_prepared_stmt;
|
||||
struct PSI_table_locker;
|
||||
typedef struct PSI_table_locker PSI_table_locker;
|
||||
struct PSI_statement_locker;
|
||||
typedef struct PSI_statement_locker PSI_statement_locker;
|
||||
struct PSI_transaction_locker;
|
||||
typedef struct PSI_transaction_locker PSI_transaction_locker;
|
||||
struct PSI_idle_locker;
|
||||
typedef struct PSI_idle_locker PSI_idle_locker;
|
||||
struct PSI_digest_locker;
|
||||
typedef struct PSI_digest_locker PSI_digest_locker;
|
||||
struct PSI_sp_share;
|
||||
typedef struct PSI_sp_share PSI_sp_share;
|
||||
struct PSI_sp_locker;
|
||||
typedef struct PSI_sp_locker PSI_sp_locker;
|
||||
struct PSI_metadata_lock;
|
||||
typedef struct PSI_metadata_lock PSI_metadata_lock;
|
||||
struct PSI_stage_progress
|
||||
{
|
||||
ulonglong m_work_completed;
|
||||
ulonglong m_work_estimated;
|
||||
};
|
||||
typedef struct PSI_stage_progress PSI_stage_progress;
|
||||
enum PSI_table_io_operation
|
||||
{
|
||||
PSI_TABLE_FETCH_ROW= 0,
|
||||
PSI_TABLE_WRITE_ROW= 1,
|
||||
PSI_TABLE_UPDATE_ROW= 2,
|
||||
PSI_TABLE_DELETE_ROW= 3
|
||||
};
|
||||
typedef enum PSI_table_io_operation PSI_table_io_operation;
|
||||
struct PSI_table_locker_state
|
||||
{
|
||||
uint m_flags;
|
||||
enum PSI_table_io_operation m_io_operation;
|
||||
struct PSI_table *m_table;
|
||||
struct PSI_table_share *m_table_share;
|
||||
struct PSI_thread *m_thread;
|
||||
ulonglong m_timer_start;
|
||||
ulonglong (*m_timer)(void);
|
||||
void *m_wait;
|
||||
uint m_index;
|
||||
};
|
||||
typedef struct PSI_table_locker_state PSI_table_locker_state;
|
||||
struct PSI_bootstrap
|
||||
{
|
||||
void* (*get_interface)(int version);
|
||||
@@ -40,6 +95,8 @@ struct PSI_file_locker;
|
||||
typedef struct PSI_file_locker PSI_file_locker;
|
||||
struct PSI_socket_locker;
|
||||
typedef struct PSI_socket_locker PSI_socket_locker;
|
||||
struct PSI_metadata_locker;
|
||||
typedef struct PSI_metadata_locker PSI_metadata_locker;
|
||||
enum PSI_mutex_operation
|
||||
{
|
||||
PSI_MUTEX_LOCK= 0,
|
||||
@@ -51,7 +108,13 @@ enum PSI_rwlock_operation
|
||||
PSI_RWLOCK_READLOCK= 0,
|
||||
PSI_RWLOCK_WRITELOCK= 1,
|
||||
PSI_RWLOCK_TRYREADLOCK= 2,
|
||||
PSI_RWLOCK_TRYWRITELOCK= 3
|
||||
PSI_RWLOCK_TRYWRITELOCK= 3,
|
||||
PSI_RWLOCK_SHAREDLOCK= 4,
|
||||
PSI_RWLOCK_SHAREDEXCLUSIVELOCK= 5,
|
||||
PSI_RWLOCK_EXCLUSIVELOCK= 6,
|
||||
PSI_RWLOCK_TRYSHAREDLOCK= 7,
|
||||
PSI_RWLOCK_TRYSHAREDEXCLUSIVELOCK= 8,
|
||||
PSI_RWLOCK_TRYEXCLUSIVELOCK= 9
|
||||
};
|
||||
typedef enum PSI_rwlock_operation PSI_rwlock_operation;
|
||||
enum PSI_cond_operation
|
||||
@@ -81,14 +144,6 @@ enum PSI_file_operation
|
||||
PSI_FILE_SYNC= 16
|
||||
};
|
||||
typedef enum PSI_file_operation PSI_file_operation;
|
||||
enum PSI_table_io_operation
|
||||
{
|
||||
PSI_TABLE_FETCH_ROW= 0,
|
||||
PSI_TABLE_WRITE_ROW= 1,
|
||||
PSI_TABLE_UPDATE_ROW= 2,
|
||||
PSI_TABLE_DELETE_ROW= 3
|
||||
};
|
||||
typedef enum PSI_table_io_operation PSI_table_io_operation;
|
||||
enum PSI_table_lock_operation
|
||||
{
|
||||
PSI_TABLE_LOCK= 0,
|
||||
@@ -160,6 +215,10 @@ struct PSI_statement_info_v2
|
||||
{
|
||||
int placeholder;
|
||||
};
|
||||
struct PSI_transaction_info_v2
|
||||
{
|
||||
int placeholder;
|
||||
};
|
||||
struct PSI_idle_locker_state_v2
|
||||
{
|
||||
int placeholder;
|
||||
@@ -180,18 +239,22 @@ struct PSI_file_locker_state_v2
|
||||
{
|
||||
int placeholder;
|
||||
};
|
||||
struct PSI_table_locker_state_v2
|
||||
{
|
||||
int placeholder;
|
||||
};
|
||||
struct PSI_statement_locker_state_v2
|
||||
{
|
||||
int placeholder;
|
||||
};
|
||||
struct PSI_transaction_locker_state_v2
|
||||
{
|
||||
int placeholder;
|
||||
};
|
||||
struct PSI_socket_locker_state_v2
|
||||
{
|
||||
int placeholder;
|
||||
};
|
||||
struct PSI_metadata_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;
|
||||
@@ -200,15 +263,18 @@ typedef struct PSI_thread_info_v2 PSI_thread_info;
|
||||
typedef struct PSI_file_info_v2 PSI_file_info;
|
||||
typedef struct PSI_stage_info_v2 PSI_stage_info;
|
||||
typedef struct PSI_statement_info_v2 PSI_statement_info;
|
||||
typedef struct PSI_transaction_info_v2 PSI_transaction_info;
|
||||
typedef struct PSI_socket_info_v2 PSI_socket_info;
|
||||
typedef struct PSI_idle_locker_state_v2 PSI_idle_locker_state;
|
||||
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;
|
||||
typedef struct PSI_statement_locker_state_v2 PSI_statement_locker_state;
|
||||
typedef struct PSI_transaction_locker_state_v2 PSI_transaction_locker_state;
|
||||
typedef struct PSI_socket_locker_state_v2 PSI_socket_locker_state;
|
||||
typedef struct PSI_sp_locker_state_v2 PSI_sp_locker_state;
|
||||
typedef struct PSI_metadata_locker_state_v2 PSI_metadata_locker_state;
|
||||
extern MYSQL_PLUGIN_IMPORT my_bool pfs_enabled;
|
||||
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
|
||||
C_MODE_END
|
||||
|
@@ -1,13 +1,25 @@
|
||||
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
it under the terms of the GNU General Public License, version 2.0,
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is also distributed with certain software (including
|
||||
but not limited to OpenSSL) that is licensed under separate terms,
|
||||
as designated in a particular file or component or in included license
|
||||
documentation. The authors of MySQL hereby grant you an additional
|
||||
permission to link the program and your derivative works with the
|
||||
separately licensed software that they have included with MySQL.
|
||||
|
||||
Without limiting anything contained in the foregoing, this file,
|
||||
which is part of C Driver for MySQL (Connector/C), is also subject to the
|
||||
Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
GNU General Public License, version 2.0, for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
@@ -30,6 +42,7 @@ extern "C" {
|
||||
*/
|
||||
|
||||
#define PSI_INSTRUMENT_ME 0
|
||||
#define PSI_INSTRUMENT_MEM ((PSI_memory_key)0)
|
||||
|
||||
#define PSI_NOT_INSTRUMENTED 0
|
||||
|
||||
@@ -69,6 +82,14 @@ extern "C" {
|
||||
*/
|
||||
#define PSI_FLAG_TRANSFER (1 << 5)
|
||||
|
||||
/**
|
||||
Volatility flag.
|
||||
This flag indicate that an instrumented object
|
||||
has a volatility (life cycle) comparable
|
||||
to the volatility of a session.
|
||||
*/
|
||||
#define PSI_FLAG_VOLATILITY_SESSION (1 << 6)
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
|
||||
/**
|
||||
|
@@ -1,13 +1,25 @@
|
||||
/* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
it under the terms of the GNU General Public License, version 2.0,
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is also distributed with certain software (including
|
||||
but not limited to OpenSSL) that is licensed under separate terms,
|
||||
as designated in a particular file or component or in included license
|
||||
documentation. The authors of MySQL hereby grant you an additional
|
||||
permission to link the program and your derivative works with the
|
||||
separately licensed software that they have included with MySQL.
|
||||
|
||||
Without limiting anything contained in the foregoing, this file,
|
||||
which is part of C Driver for MySQL (Connector/C), is also subject to the
|
||||
Universal FOSS Exception, version 1.0, a copy of which can be found at
|
||||
http://oss.oracle.com/licenses/universal-foss-exception.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
GNU General Public License, version 2.0, for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
|
Reference in New Issue
Block a user