1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

perfschema memory related instrumentation changes

This commit is contained in:
Sergei Golubchik
2020-01-29 13:50:26 +01:00
parent 2ac3121af2
commit 7c58e97bf6
307 changed files with 2622 additions and 1743 deletions

View File

@ -30,6 +30,13 @@
#include "sql_list.h"
class String;
#ifdef MYSQL_SERVER
extern PSI_memory_key key_memory_String_value;
#define STRING_PSI_MEMORY_KEY key_memory_String_value
#else
#define STRING_PSI_MEMORY_KEY PSI_NOT_INSTRUMENTED
#endif
typedef struct st_io_cache IO_CACHE;
typedef struct st_mem_root MEM_ROOT;
@ -659,28 +666,8 @@ public:
return realloc_with_extra(arg_length);
}
// Shrink the buffer, but only if it is allocated on the heap.
inline void shrink(size_t arg_length)
{
if (!is_alloced())
return;
if (ALIGN_SIZE(arg_length+1) < Alloced_length)
{
char *new_ptr;
if (unlikely(!(new_ptr=(char*)
my_realloc(Ptr,
arg_length,MYF((thread_specific ?
MY_THREAD_SPECIFIC : 0))))))
{
Alloced_length= 0;
real_alloc(arg_length);
}
else
{
Ptr= new_ptr;
Alloced_length= (uint32) arg_length;
}
}
}
void shrink(size_t arg_length);
void move(Binary_string &s)
{
set_alloced(s.Ptr, s.str_length, s.Alloced_length);