MySQL 8.3.0
Source Code Documentation
CreateTracker Struct Reference

Track mutex file creation name and line number. More...

Classes

struct  File
 For tracking the filename and line number. More...
 

Public Member Functions

 CreateTracker () 1
 Constructor. More...
 
 ~CreateTracker () 1
 Destructor. More...
 
void register_latch (const void *ptr, const char *filename, uint16_t line) 1
 Register where the latch was created. More...
 
void deregister_latch (const void *ptr) 1
 Deregister a latch - when it is destroyed. More...
 
std::string get (const void *ptr) 1
 Get the create string, format is "name:line". More...
 

Private Types

typedef std::map< const void *, File, std::less< const void * >, ut::allocator< std::pair< const void *const, File > > > Files
 Map the mutex instance to where it was created. More...
 
typedef OSMutex Mutex
 

Private Attributes

Mutex m_mutex
 Mutex protecting m_files. More...
 
Files m_files
 Track the latch creation. More...
 

Detailed Description

Track mutex file creation name and line number.

This is to avoid storing { const char* name; uint16_t line; } in every instance. This results in the sizeof(Mutex) > 64. We use a lookup table to store it separately. Fetching the values is very rare, only required for diagnostic purposes. And, we don't create/destroy mutexes that frequently.

Member Typedef Documentation

◆ Files

typedef std::map<const void *, File, std::less<const void *>, ut::allocator<std::pair<const void *const, File> > > CreateTracker::Files
private

Map the mutex instance to where it was created.

◆ Mutex

typedef OSMutex CreateTracker::Mutex
private

Constructor & Destructor Documentation

◆ CreateTracker()

CreateTracker::CreateTracker ( )
inline

Constructor.

◆ ~CreateTracker()

CreateTracker::~CreateTracker ( )
inline

Destructor.

Member Function Documentation

◆ deregister_latch()

void CreateTracker::deregister_latch ( const void *  ptr)
inline

Deregister a latch - when it is destroyed.

Parameters
[in]ptrLatch instance being destroyed

◆ get()

std::string CreateTracker::get ( const void *  ptr)
inline

Get the create string, format is "name:line".

Parameters
[in]ptrLatch instance
Returns
the create string or "" if not found

◆ register_latch()

void CreateTracker::register_latch ( const void *  ptr,
const char *  filename,
uint16_t  line 
)
inline

Register where the latch was created.

Parameters
[in]ptrLatch instance
[in]filenameWhere created
[in]lineLine number in filename

Member Data Documentation

◆ m_files

Files CreateTracker::m_files
private

Track the latch creation.

◆ m_mutex

Mutex CreateTracker::m_mutex
private

Mutex protecting m_files.


The documentation for this struct was generated from the following file: