diff options
Diffstat (limited to 'vio/vio.c')
-rw-r--r-- | vio/vio.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/vio/vio.c b/vio/vio.c index 21c475f5972..7a98eb2af7b 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -24,6 +24,28 @@ #include "vio_priv.h" #include "ssl_compat.h" +PSI_memory_key key_memory_vio_ssl_fd; +PSI_memory_key key_memory_vio; +PSI_memory_key key_memory_vio_read_buffer; + +#ifdef HAVE_PSI_INTERFACE +static PSI_memory_info all_vio_memory[]= +{ + {&key_memory_vio_ssl_fd, "ssl_fd", 0}, + {&key_memory_vio, "vio", 0}, + {&key_memory_vio_read_buffer, "read_buffer", 0}, +}; + +void init_vio_psi_keys() +{ + const char* category= "vio"; + int count; + + count= array_elements(all_vio_memory); + mysql_memory_register(category, all_vio_memory, count); +} +#endif + #ifdef _WIN32 /** @@ -81,7 +103,8 @@ static void vio_init(Vio *vio, enum enum_vio_type type, vio->localhost= flags & VIO_LOCALHOST; vio->read_timeout= vio->write_timeout= -1; if ((flags & VIO_BUFFERED_READ) && - !(vio->read_buffer= (char*)my_malloc(VIO_READ_BUFFER_SIZE, MYF(MY_WME)))) + !(vio->read_buffer= (char*)my_malloc(key_memory_vio_read_buffer, + VIO_READ_BUFFER_SIZE, MYF(MY_WME)))) flags&= ~VIO_BUFFERED_READ; #ifdef _WIN32 if (type == VIO_TYPE_NAMEDPIPE) @@ -218,7 +241,7 @@ Vio *mysql_socket_vio_new(MYSQL_SOCKET mysql_socket, enum enum_vio_type type, ui my_socket sd= mysql_socket_getfd(mysql_socket); DBUG_ENTER("mysql_socket_vio_new"); DBUG_PRINT("enter", ("sd: %d", (int)sd)); - if ((vio = (Vio*) my_malloc(sizeof(*vio),MYF(MY_WME)))) + if ((vio = (Vio*) my_malloc(key_memory_vio, sizeof(*vio), MYF(MY_WME)))) { vio_init(vio, type, sd, flags); vio->desc= (vio->type == VIO_TYPE_SOCKET ? "socket" : "TCP/IP"); @@ -248,7 +271,7 @@ Vio *vio_new_win32pipe(HANDLE hPipe) { Vio *vio; DBUG_ENTER("vio_new_handle"); - if ((vio = (Vio*) my_malloc(sizeof(Vio),MYF(MY_WME)))) + if ((vio = (Vio*) my_malloc(PSI_INSTRUMENT_ME, sizeof(Vio),MYF(MY_WME)))) { vio_init(vio, VIO_TYPE_NAMEDPIPE, 0, VIO_LOCALHOST); vio->desc= "named pipe"; |