1#ifndef HISTOGRAMS_TABLE_HISTOGRAMS_INCLUDED
2#define HISTOGRAMS_TABLE_HISTOGRAMS_INCLUDED
311 std::array<Table_histograms *, kMaxNumberOfTableHistogramsInCollection>
The Table_histograms_collection manages a collection of reference-counted snapshots of histogram stat...
Definition: table_histograms.h:239
Table_histograms_collection & operator=(Table_histograms_collection &&)=delete
void free_table_histograms(size_t idx)
Frees a Table_histograms object from the collection and sets its pointer to nullptr.
Definition: table_histograms.h:306
size_t size() const
Counts the number of Table_histograms objects in the collection.
Definition: table_histograms.cc:154
std::array< Table_histograms *, kMaxNumberOfTableHistogramsInCollection > m_table_histograms
Definition: table_histograms.h:312
Table_histograms_collection()
Definition: table_histograms.cc:101
int total_reference_count() const
Count the total number of TABLE objects referencing Table_histograms objects in the collection.
Definition: table_histograms.cc:162
const Table_histograms * acquire()
Acquire a pointer to the most recently inserted Table_histograms object.
Definition: table_histograms.cc:114
void release(const Table_histograms *histograms)
Release a previously acquired Table_histograms object, decreasing its reference count.
Definition: table_histograms.cc:122
size_t m_current_index
Definition: table_histograms.h:313
~Table_histograms_collection()
Definition: table_histograms.cc:105
Table_histograms_collection & operator=(const Table_histograms_collection &)=delete
Table_histograms_collection(const Table_histograms_collection &)=delete
bool insert(Table_histograms *histograms)
Attempt to insert the supplied Table_histograms object into the collection.
Definition: table_histograms.cc:135
Table_histograms_collection(Table_histograms_collection &&)=delete
The Table_histograms class represents a snapshot of the collection of histograms associated with a ta...
Definition: table_histograms.h:145
const histograms::Histogram * find_histogram(unsigned int field_index) const
Perform a lookup in the local collection of histograms for a histogram on a given field.
Definition: table_histograms.cc:92
static Table_histograms * create(PSI_memory_key psi_key) noexcept
Factory method to create Table_histogram objects.
Definition: table_histograms.cc:45
void set_index(int index)
Definition: table_histograms.h:216
MEM_ROOT m_mem_root
Definition: table_histograms.h:198
void decrement_reference_counter()
Definition: table_histograms.h:209
~Table_histograms()=delete
Table_histograms & operator=(const Table_histograms &)=delete
Table_histograms(Table_histograms &&)=delete
bool insert_histogram(unsigned int field_index, const histograms::Histogram *histogram)
Copies the given histogram onto the local MEM_ROOT and inserts the copy into the local collection of ...
Definition: table_histograms.cc:77
mem_root_unordered_map< unsigned int, const histograms::Histogram * > * m_histograms
Definition: table_histograms.h:200
int reference_count() const
The number of TABLE objects referencing this object.
Definition: table_histograms.h:207
Table_histograms(const Table_histograms &)=delete
void increment_reference_counter()
Definition: table_histograms.h:208
size_t m_index
Definition: table_histograms.h:219
int m_reference_counter
Definition: table_histograms.h:218
Table_histograms & operator=(Table_histograms &&)=delete
void destroy()
Destroys the object and frees memory.
Definition: table_histograms.cc:65
int get_index() const
The index of this object in the Table_histograms_collection.
Definition: table_histograms.h:215
Table_histograms()=default
Histogram base class.
Definition: histogram.h:314
std::unordered_map, but allocated on a MEM_ROOT.
Definition: map_helpers.h:291
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:49
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
Definition: column_statistics.h:34
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
constexpr size_t kMaxNumberOfTableHistogramsInCollection
Definition: table_histograms.h:222