summaryrefslogtreecommitdiff
path: root/include/mysql/psi/mysql_file.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/mysql/psi/mysql_file.h')
-rw-r--r--include/mysql/psi/mysql_file.h44
1 files changed, 29 insertions, 15 deletions
diff --git a/include/mysql/psi/mysql_file.h b/include/mysql/psi/mysql_file.h
index 1d2ec34fc98..533c440d4f9 100644
--- a/include/mysql/psi/mysql_file.h
+++ b/include/mysql/psi/mysql_file.h
@@ -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;
}
}