mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
perfschema memory related instrumentation changes
This commit is contained in:
@ -110,6 +110,8 @@ extern "C" uchar* get_hash_key(const uchar *buff, size_t *length,
|
||||
return (uchar*) udf->name.str;
|
||||
}
|
||||
|
||||
static PSI_memory_key key_memory_udf_mem;
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
static PSI_rwlock_key key_rwlock_THR_LOCK_udf;
|
||||
|
||||
@ -118,6 +120,11 @@ static PSI_rwlock_info all_udf_rwlocks[]=
|
||||
{ &key_rwlock_THR_LOCK_udf, "THR_LOCK_udf", PSI_FLAG_GLOBAL}
|
||||
};
|
||||
|
||||
static PSI_memory_info all_udf_memory[]=
|
||||
{
|
||||
{ &key_memory_udf_mem, "udf_mem", PSI_FLAG_GLOBAL}
|
||||
};
|
||||
|
||||
static void init_udf_psi_keys(void)
|
||||
{
|
||||
const char* category= "sql";
|
||||
@ -128,6 +135,9 @@ static void init_udf_psi_keys(void)
|
||||
|
||||
count= array_elements(all_udf_rwlocks);
|
||||
PSI_server->register_rwlock(category, all_udf_rwlocks, count);
|
||||
|
||||
count= array_elements(all_udf_memory);
|
||||
mysql_memory_register(category, all_udf_memory, count);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -154,10 +164,11 @@ void udf_init()
|
||||
|
||||
mysql_rwlock_init(key_rwlock_THR_LOCK_udf, &THR_LOCK_udf);
|
||||
|
||||
init_sql_alloc(&mem, "udf", UDF_ALLOC_BLOCK_SIZE, 0, MYF(0));
|
||||
init_sql_alloc(key_memory_udf_mem, &mem, UDF_ALLOC_BLOCK_SIZE, 0, MYF(0));
|
||||
THD *new_thd = new THD(0);
|
||||
if (!new_thd ||
|
||||
my_hash_init(&udf_hash,system_charset_info,32,0,0,get_hash_key, NULL, 0))
|
||||
my_hash_init(&udf_hash,system_charset_info,32,0,0,get_hash_key, NULL, 0,
|
||||
key_memory_udf_mem))
|
||||
{
|
||||
sql_print_error("Can't allocate memory for udf structures");
|
||||
my_hash_free(&udf_hash);
|
||||
|
Reference in New Issue
Block a user