MySQL 9.1.0
Source Code Documentation
Collaboration diagram for File Instrumentation (ABI):

Classes

struct  PSI_file_info_v1
 File instrument information. More...
 
struct  PSI_file_locker_state_v1
 State data storage for get_thread_file_name_locker_v1_t. More...
 
struct  PSI_file_bootstrap
 Entry point for the performance schema interface. More...
 
struct  PSI_file_service_v2
 Performance Schema file Interface, version 2. More...
 

Macros

#define PSI_FILE_VERSION_1   1
 Performance Schema File Interface number for version 1. More...
 
#define PSI_FILE_VERSION_2   2
 Performance Schema File Interface number for version 2. More...
 
#define PSI_CURRENT_FILE_VERSION   2
 Performance Schema File Interface number for the most recent version. More...
 

Typedefs

typedef unsigned int PSI_file_key
 Instrumented file key. More...
 
typedef struct PSI_file PSI_file
 
typedef struct PSI_file_locker PSI_file_locker
 
typedef enum PSI_file_operation PSI_file_operation
 
typedef struct PSI_file_info_v1 PSI_file_info_v1
 
typedef struct PSI_file_locker_state_v1 PSI_file_locker_state_v1
 
typedef void(* register_file_v1_t) (const char *category, struct PSI_file_info_v1 *info, int count)
 File registration API. More...
 
typedef void(* create_file_v1_t) (PSI_file_key key, const char *name, File file)
 Create a file instrumentation for a created file. More...
 
typedef struct PSI_file_locker *(* get_thread_file_name_locker_v1_t) (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 instrumentation locker, for opening or creating a file. More...
 
typedef struct PSI_file_locker *(* get_thread_file_stream_locker_v1_t) (struct PSI_file_locker_state_v1 *state, struct PSI_file *file, enum PSI_file_operation op)
 Get a file stream instrumentation locker. More...
 
typedef struct PSI_file_locker *(* get_thread_file_descriptor_locker_v1_t) (struct PSI_file_locker_state_v1 *state, File file, enum PSI_file_operation op)
 Get a file instrumentation locker. More...
 
typedef void(* start_file_open_wait_v1_t) (struct PSI_file_locker *locker, const char *src_file, unsigned int src_line)
 Start a file instrumentation open operation. More...
 
typedef struct PSI_file *(* end_file_open_wait_v1_t) (struct PSI_file_locker *locker, void *result)
 End a file instrumentation open operation, for file streams. More...
 
typedef void(* end_file_open_wait_and_bind_to_descriptor_v1_t) (struct PSI_file_locker *locker, File file)
 End a file instrumentation open operation, for non stream files. More...
 
typedef void(* end_temp_file_open_wait_and_bind_to_descriptor_v1_t) (struct PSI_file_locker *locker, File file, const char *filename)
 End a file instrumentation open operation, for non stream temporary files. More...
 
typedef void(* start_file_wait_v1_t) (struct PSI_file_locker *locker, size_t count, const char *src_file, unsigned int src_line)
 Record a file instrumentation start event. More...
 
typedef void(* end_file_wait_v1_t) (struct PSI_file_locker *locker, size_t count)
 Record a file instrumentation end event. More...
 
typedef void(* start_file_close_wait_v1_t) (struct PSI_file_locker *locker, const char *src_file, unsigned int src_line)
 Start a file instrumentation close operation. More...
 
typedef void(* end_file_close_wait_v1_t) (struct PSI_file_locker *locker, int rc)
 End a file instrumentation close operation. More...
 
typedef void(* start_file_rename_wait_v1_t) (struct PSI_file_locker *locker, size_t count, const char *old_name, const char *new_name, const char *src_file, unsigned int src_line)
 Record a file instrumentation start event. More...
 
typedef void(* end_file_rename_wait_v1_t) (struct PSI_file_locker *locker, const char *old_name, const char *new_name, int rc)
 Rename a file instrumentation close operation. More...
 
typedef struct PSI_file_info_v1 PSI_file_info
 
typedef struct PSI_file_locker_state_v1 PSI_file_locker_state
 
typedef struct PSI_file_service_v2 PSI_file_service_t
 

Enumerations

enum  PSI_file_operation {
  PSI_FILE_CREATE = 0 , PSI_FILE_CREATE_TMP = 1 , PSI_FILE_OPEN = 2 , PSI_FILE_STREAM_OPEN = 3 ,
  PSI_FILE_CLOSE = 4 , PSI_FILE_STREAM_CLOSE = 5 , PSI_FILE_READ = 6 , PSI_FILE_WRITE = 7 ,
  PSI_FILE_SEEK = 8 , PSI_FILE_TELL = 9 , PSI_FILE_FLUSH = 10 , PSI_FILE_STAT = 11 ,
  PSI_FILE_FSTAT = 12 , PSI_FILE_CHSIZE = 13 , PSI_FILE_DELETE = 14 , PSI_FILE_RENAME = 15 ,
  PSI_FILE_SYNC = 16
}
 Operation performed on an instrumented file. More...
 

Variables

MYSQL_PLUGIN_IMPORT PSI_file_service_tpsi_file_service
 

Detailed Description

Macro Definition Documentation

◆ PSI_CURRENT_FILE_VERSION

#define PSI_CURRENT_FILE_VERSION   2

Performance Schema File Interface number for the most recent version.

The most current version is PSI_FILE_VERSION_2

◆ PSI_FILE_VERSION_1

#define PSI_FILE_VERSION_1   1

Performance Schema File Interface number for version 1.

This version is obsolete.

◆ PSI_FILE_VERSION_2

#define PSI_FILE_VERSION_2   2

Performance Schema File Interface number for version 2.

This version is supported.

Typedef Documentation

◆ create_file_v1_t

typedef void(* create_file_v1_t) (PSI_file_key key, const char *name, File file)

Create a file instrumentation for a created file.

This method does not create the file itself, but is used to notify the instrumentation interface that a file was just created.

Parameters
keythe file instrumentation key for this file
namethe file name
filethe file handle

◆ end_file_close_wait_v1_t

typedef void(* end_file_close_wait_v1_t) (struct PSI_file_locker *locker, int rc)

End a file instrumentation close operation.

Parameters
lockerthe file locker.
rcthe close operation return code (0 for success).

◆ end_file_open_wait_and_bind_to_descriptor_v1_t

typedef void(* end_file_open_wait_and_bind_to_descriptor_v1_t) (struct PSI_file_locker *locker, File file)

End a file instrumentation open operation, for non stream files.

Parameters
lockerthe file locker.
filethe file number assigned by open() or create() for this file.

◆ end_file_open_wait_v1_t

typedef struct PSI_file *(* end_file_open_wait_v1_t) (struct PSI_file_locker *locker, void *result)

End a file instrumentation open operation, for file streams.

Parameters
lockerthe file locker.
resultthe opened file (NULL indicates failure, non NULL success).
Returns
an instrumented file handle

◆ end_file_rename_wait_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)

Rename a file instrumentation close operation.

Parameters
lockerthe file locker.
old_namename of the file to be renamed.
new_namename of the file after rename.
rcthe rename operation return code (0 for success).

◆ end_file_wait_v1_t

typedef void(* end_file_wait_v1_t) (struct PSI_file_locker *locker, size_t count)

Record a file instrumentation end event.

Note that for file close operations, the instrumented file handle associated with the file (which was provided to obtain a locker) is invalid after this call.

Parameters
lockera file locker for the running thread
countthe number of bytes actually used in the operation, or 0 if not applicable, or -1 if the operation failed
See also
get_thread_file_name_locker
get_thread_file_stream_locker
get_thread_file_descriptor_locker

◆ end_temp_file_open_wait_and_bind_to_descriptor_v1_t

typedef void(* end_temp_file_open_wait_and_bind_to_descriptor_v1_t) (struct PSI_file_locker *locker, File file, const char *filename)

End a file instrumentation open operation, for non stream temporary files.

Parameters
lockerthe file locker.
filethe file number assigned by open() or create() for this file.
filenamethe file name generated during temporary file creation.

◆ get_thread_file_descriptor_locker_v1_t

typedef struct PSI_file_locker *(* get_thread_file_descriptor_locker_v1_t) (struct PSI_file_locker_state_v1 *state, File file, enum PSI_file_operation op)

Get a file instrumentation locker.

Parameters
statedata storage for the locker
filethe file descriptor to access
opthe operation to perform
Returns
a file locker, or NULL

◆ get_thread_file_name_locker_v1_t

typedef struct PSI_file_locker *(* get_thread_file_name_locker_v1_t) (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 instrumentation locker, for opening or creating a file.

Parameters
statedata storage for the locker
keythe file instrumentation key
opthe operation to perform
namethe file name
identitya pointer representative of this file.
Returns
a file locker, or NULL

◆ get_thread_file_stream_locker_v1_t

typedef struct PSI_file_locker *(* get_thread_file_stream_locker_v1_t) (struct PSI_file_locker_state_v1 *state, struct PSI_file *file, enum PSI_file_operation op)

Get a file stream instrumentation locker.

Parameters
statedata storage for the locker
filethe file stream to access
opthe operation to perform
Returns
a file locker, or NULL

◆ PSI_file

typedef struct PSI_file PSI_file

◆ PSI_file_info

◆ PSI_file_info_v1

◆ PSI_file_key

typedef unsigned int PSI_file_key

Instrumented file key.

To instrument a file, a file key must be obtained using register_file. Using a zero key always disable the instrumentation.

◆ PSI_file_locker

◆ PSI_file_locker_state

◆ PSI_file_locker_state_v1

◆ PSI_file_operation

◆ PSI_file_service_t

◆ register_file_v1_t

typedef void(* register_file_v1_t) (const char *category, struct PSI_file_info_v1 *info, int count)

File registration API.

Parameters
categorya category name (typically a plugin name)
infoan array of file info to register
countthe size of the info array

◆ start_file_close_wait_v1_t

typedef void(* start_file_close_wait_v1_t) (struct PSI_file_locker *locker, const char *src_file, unsigned int src_line)

Start a file instrumentation close operation.

Parameters
lockerthe file locker
src_filethe source file name
src_linethe source line number

◆ start_file_open_wait_v1_t

typedef void(* start_file_open_wait_v1_t) (struct PSI_file_locker *locker, const char *src_file, unsigned int src_line)

Start a file instrumentation open operation.

Parameters
lockerthe file locker
src_filethe source file name
src_linethe source line number

◆ start_file_rename_wait_v1_t

typedef void(* start_file_rename_wait_v1_t) (struct PSI_file_locker *locker, size_t count, const char *old_name, const char *new_name, const char *src_file, unsigned int src_line)

Record a file instrumentation start event.

Parameters
lockera file locker for the running thread
countthe number of bytes requested, or 0 if not applicable
old_namename of the file to be renamed.
new_namename of the file after rename.
src_filethe source file name
src_linethe source line number

◆ start_file_wait_v1_t

typedef void(* start_file_wait_v1_t) (struct PSI_file_locker *locker, size_t count, const char *src_file, unsigned int src_line)

Record a file instrumentation start event.

Parameters
lockera file locker for the running thread
countthe number of bytes requested, or 0 if not applicable
src_filethe source file name
src_linethe source line number

Enumeration Type Documentation

◆ PSI_file_operation

Operation performed on an instrumented file.

Enumerator
PSI_FILE_CREATE 

File creation, as in create().

PSI_FILE_CREATE_TMP 

Temporary file creation, as in create_temp_file().

PSI_FILE_OPEN 

File open, as in open().

PSI_FILE_STREAM_OPEN 

File open, as in fopen().

PSI_FILE_CLOSE 

File close, as in close().

PSI_FILE_STREAM_CLOSE 

File close, as in fclose().

PSI_FILE_READ 

Generic file read, such as fgets(), fgetc(), fread(), read(), pread().

PSI_FILE_WRITE 

Generic file write, such as fputs(), fputc(), fprintf(), vfprintf(), fwrite(), write(), pwrite().

PSI_FILE_SEEK 

Generic file seek, such as fseek() or seek().

PSI_FILE_TELL 

Generic file tell, such as ftell() or tell().

PSI_FILE_FLUSH 

File flush, as in fflush().

PSI_FILE_STAT 

File stat, as in stat().

PSI_FILE_FSTAT 

File stat, as in fstat().

PSI_FILE_CHSIZE 

File chsize, as in my_chsize().

PSI_FILE_DELETE 

File delete, such as my_delete() or my_delete_with_symlink().

PSI_FILE_RENAME 

File rename, such as my_rename() or my_rename_with_symlink().

PSI_FILE_SYNC 

File sync, as in fsync() or my_sync().

Variable Documentation

◆ psi_file_service

MYSQL_PLUGIN_IMPORT PSI_file_service_t* psi_file_service
extern