MySQL 26.7.0
Source Code Documentation
mysql::scheduler::Statistics_instance_monitor Class Reference

CSA statistics monitor, gathers statistics coming from different CSA threads Each statistic is a pair of key (statistic string) and value. More...

#include <statistics_instance_monitor.h>

Public Types

using Mutex = concurrency::Mutex
 
using Mutex_key = concurrency::Mutex_key
 

Public Member Functions

void init ()
 
template<Statistic_allowed_type Type = long long>
void register_stat (const std::string &name, std::size_t thread_num=1, bool enable=true)
 Get statistic value. More...
 
template<Statistic_allowed_type Type = long long>
std::optional< std::reference_wrapper< typename Statistic_type_traits< Type >::type > > find_stat (const std::string &name)
 Get accumulated statistic value. More...
 
template<Statistic_allowed_type Type = long long>
Statistic_type_traits< Type >::typeget_stat (const std::string &name)
 Get accumulated statistic value w/o bound checking. More...
 
void reset ()
 Resets initialized statistics, use wisely. More...
 
void clear ()
 Frees registered statistics storage for this instance. More...
 
 Statistics_instance_monitor ()=default
 

Protected Types

using Registry_type = std::unordered_map< std::string, Sharded_counter >
 

Protected Attributes

Registry_type m_registry
 

Detailed Description

CSA statistics monitor, gathers statistics coming from different CSA threads Each statistic is a pair of key (statistic string) and value.

This will help with backward and forward compatibility of statistics implemented in CSA servis w.r.t. statistics supported in the server Statistic update method ingests thread id, to keep a sharded statistics value until coalescing operation requested by external thread to get accumulated value (if coalescing is requested during "get" operation). For the time being, we assume only 1 channel

Member Typedef Documentation

◆ Mutex

◆ Mutex_key

◆ Registry_type

using mysql::scheduler::Statistics_instance_monitor::Registry_type = std::unordered_map<std::string, Sharded_counter>
protected

Constructor & Destructor Documentation

◆ Statistics_instance_monitor()

mysql::scheduler::Statistics_instance_monitor::Statistics_instance_monitor ( )
default

Member Function Documentation

◆ clear()

void mysql::scheduler::Statistics_instance_monitor::clear ( )

Frees registered statistics storage for this instance.

◆ find_stat()

template<Statistic_allowed_type Type>
std::optional< std::reference_wrapper< typename Statistic_type_traits< Type >::type > > mysql::scheduler::Statistics_instance_monitor::find_stat ( const std::string &  name)

Get accumulated statistic value.

Parameters
nameName of statistic
Returns
Value if statistic is found, no value otherwise

◆ get_stat()

template<Statistic_allowed_type Type>
Statistic_type_traits< Type >::type & mysql::scheduler::Statistics_instance_monitor::get_stat ( const std::string &  name)

Get accumulated statistic value w/o bound checking.

Parameters
nameName of statistic
Returns
Value if statistic is found, no value otherwise w/o bound checking

◆ init()

void mysql::scheduler::Statistics_instance_monitor::init ( )

◆ register_stat()

template<Statistic_allowed_type Type>
void mysql::scheduler::Statistics_instance_monitor::register_stat ( const std::string &  name,
std::size_t  thread_num = 1,
bool  enable = true 
)

Get statistic value.

Parameters
nameName of statistic
thread_numThe number of threads accessing statistic
enableInformation on whether to enable this particular statistic

◆ reset()

void mysql::scheduler::Statistics_instance_monitor::reset ( )

Resets initialized statistics, use wisely.

Member Data Documentation

◆ m_registry

Registry_type mysql::scheduler::Statistics_instance_monitor::m_registry
protected

The documentation for this class was generated from the following files: