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( ...@@ -16740,7 +16740,7 @@ innodb_show_mutex_status(
DBUG_ASSERT(hton == innodb_hton_ptr); DBUG_ASSERT(hton == innodb_hton_ptr);
mutex_monitor->iterate(collector); mutex_monitor.iterate(collector);
if (!collector.to_string(hton, thd, stat_print)) { if (!collector.to_string(hton, thd, stat_print)) {
DBUG_RETURN(1); DBUG_RETURN(1);
...@@ -18907,7 +18907,7 @@ innodb_monitor_set_option( ...@@ -18907,7 +18907,7 @@ innodb_monitor_set_option(
if (MONITOR_IS_ON(MONITOR_LATCHES)) { if (MONITOR_IS_ON(MONITOR_LATCHES)) {
mutex_monitor->enable(); mutex_monitor.enable();
} }
break; break;
...@@ -18922,7 +18922,7 @@ innodb_monitor_set_option( ...@@ -18922,7 +18922,7 @@ innodb_monitor_set_option(
if (!MONITOR_IS_ON(MONITOR_LATCHES)) { if (!MONITOR_IS_ON(MONITOR_LATCHES)) {
mutex_monitor->disable(); mutex_monitor.disable();
} }
break; break;
...@@ -18931,13 +18931,13 @@ innodb_monitor_set_option( ...@@ -18931,13 +18931,13 @@ innodb_monitor_set_option(
if (monitor_id == (MONITOR_LATCHES)) { if (monitor_id == (MONITOR_LATCHES)) {
mutex_monitor->reset(); mutex_monitor.reset();
} }
break; break;
case MONITOR_RESET_ALL_VALUE: case MONITOR_RESET_ALL_VALUE:
srv_mon_reset_all(monitor_id); srv_mon_reset_all(monitor_id);
mutex_monitor->reset(); mutex_monitor.reset();
break; break;
default: default:
......
...@@ -164,7 +164,7 @@ class MutexMonitor { ...@@ -164,7 +164,7 @@ class MutexMonitor {
}; };
/** Defined in sync0sync.cc */ /** Defined in sync0sync.cc */
extern MutexMonitor* mutex_monitor; extern MutexMonitor mutex_monitor;
/** /**
Creates, or rather, initializes a mutex object in a specified memory 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) 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 Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
...@@ -1705,7 +1705,7 @@ struct CreateTracker { ...@@ -1705,7 +1705,7 @@ struct CreateTracker {
}; };
/** Track latch creation location. For reducing the size of the latches */ /** 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 /** Register a latch, called when it is created
@param[in] ptr Latch instance that was created @param[in] ptr Latch instance that was created
...@@ -1717,7 +1717,7 @@ sync_file_created_register( ...@@ -1717,7 +1717,7 @@ sync_file_created_register(
const char* filename, const char* filename,
uint16_t line) 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 /** Deregister a latch, called when it is destroyed
...@@ -1725,7 +1725,7 @@ sync_file_created_register( ...@@ -1725,7 +1725,7 @@ sync_file_created_register(
void void
sync_file_created_deregister(const void* ptr) 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" /** Get the string where the file was created. Its format is "name:line"
...@@ -1734,7 +1734,7 @@ sync_file_created_deregister(const void* ptr) ...@@ -1734,7 +1734,7 @@ sync_file_created_deregister(const void* ptr)
std::string std::string
sync_file_created_get(const void* ptr) sync_file_created_get(const void* ptr)
{ {
return(create_tracker->get(ptr)); return(create_tracker.get(ptr));
} }
/** Initializes the synchronization data structures. */ /** Initializes the synchronization data structures. */
...@@ -1744,12 +1744,6 @@ sync_check_init() ...@@ -1744,12 +1744,6 @@ sync_check_init()
ut_ad(!LatchDebug::s_initialized); ut_ad(!LatchDebug::s_initialized);
ut_d(LatchDebug::s_initialized = true); 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(); sync_latch_meta_init();
/* Init the rw-lock & mutex list and create the mutex to protect it. */ /* Init the rw-lock & mutex list and create the mutex to protect it. */
...@@ -1773,14 +1767,6 @@ sync_check_close() ...@@ -1773,14 +1767,6 @@ sync_check_close()
sync_array_close(); sync_array_close();
UT_DELETE(mutex_monitor);
mutex_monitor = NULL;
UT_DELETE(create_tracker);
create_tracker = NULL;
sync_latch_meta_destroy(); sync_latch_meta_destroy();
} }
...@@ -118,7 +118,7 @@ mysql_pfs_key_t trx_purge_latch_key; ...@@ -118,7 +118,7 @@ mysql_pfs_key_t trx_purge_latch_key;
#endif /* UNIV_PFS_RWLOCK */ #endif /* UNIV_PFS_RWLOCK */
/** For monitoring active mutexes */ /** For monitoring active mutexes */
MutexMonitor* mutex_monitor; MutexMonitor mutex_monitor;
/** /**
Prints wait info of the sync system. 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