Commit 89ae5d7f authored by Marko Mäkelä's avatar Marko Mäkelä

Allocate mutex_monitor, create_tracker statically

parent 30f1d2f6
......@@ -16740,7 +16740,7 @@ innodb_show_mutex_status(
DBUG_ASSERT(hton == innodb_hton_ptr);
mutex_monitor->iterate(collector);
mutex_monitor.iterate(collector);
if (!collector.to_string(hton, thd, stat_print)) {
DBUG_RETURN(1);
......@@ -18907,7 +18907,7 @@ innodb_monitor_set_option(
if (MONITOR_IS_ON(MONITOR_LATCHES)) {
mutex_monitor->enable();
mutex_monitor.enable();
}
break;
......@@ -18922,7 +18922,7 @@ innodb_monitor_set_option(
if (!MONITOR_IS_ON(MONITOR_LATCHES)) {
mutex_monitor->disable();
mutex_monitor.disable();
}
break;
......@@ -18931,13 +18931,13 @@ innodb_monitor_set_option(
if (monitor_id == (MONITOR_LATCHES)) {
mutex_monitor->reset();
mutex_monitor.reset();
}
break;
case MONITOR_RESET_ALL_VALUE:
srv_mon_reset_all(monitor_id);
mutex_monitor->reset();
mutex_monitor.reset();
break;
default:
......
......@@ -164,7 +164,7 @@ class MutexMonitor {
};
/** Defined in sync0sync.cc */
extern MutexMonitor* mutex_monitor;
extern MutexMonitor mutex_monitor;
/**
Creates, or rather, initializes a mutex object in a specified memory
......
/*****************************************************************************
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017, 2018, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -1705,7 +1705,7 @@ struct CreateTracker {
};
/** Track latch creation location. For reducing the size of the latches */
static CreateTracker* create_tracker;
static CreateTracker create_tracker;
/** Register a latch, called when it is created
@param[in] ptr Latch instance that was created
......@@ -1717,7 +1717,7 @@ sync_file_created_register(
const char* filename,
uint16_t line)
{
create_tracker->register_latch(ptr, filename, line);
create_tracker.register_latch(ptr, filename, line);
}
/** Deregister a latch, called when it is destroyed
......@@ -1725,7 +1725,7 @@ sync_file_created_register(
void
sync_file_created_deregister(const void* ptr)
{
create_tracker->deregister_latch(ptr);
create_tracker.deregister_latch(ptr);
}
/** Get the string where the file was created. Its format is "name:line"
......@@ -1734,7 +1734,7 @@ sync_file_created_deregister(const void* ptr)
std::string
sync_file_created_get(const void* ptr)
{
return(create_tracker->get(ptr));
return(create_tracker.get(ptr));
}
/** Initializes the synchronization data structures. */
......@@ -1744,12 +1744,6 @@ sync_check_init()
ut_ad(!LatchDebug::s_initialized);
ut_d(LatchDebug::s_initialized = true);
/** For collecting latch statistic - SHOW ... MUTEX */
mutex_monitor = UT_NEW_NOKEY(MutexMonitor());
/** For trcking mutex creation location */
create_tracker = UT_NEW_NOKEY(CreateTracker());
sync_latch_meta_init();
/* Init the rw-lock & mutex list and create the mutex to protect it. */
......@@ -1773,14 +1767,6 @@ sync_check_close()
sync_array_close();
UT_DELETE(mutex_monitor);
mutex_monitor = NULL;
UT_DELETE(create_tracker);
create_tracker = NULL;
sync_latch_meta_destroy();
}
......@@ -118,7 +118,7 @@ mysql_pfs_key_t trx_purge_latch_key;
#endif /* UNIV_PFS_RWLOCK */
/** For monitoring active mutexes */
MutexMonitor* mutex_monitor;
MutexMonitor mutex_monitor;
/**
Prints wait info of the sync system.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment