MXS-2363 Keep track of individual QC cache hits

Useful statistics.
This commit is contained in:
Johan Wikman
2019-03-27 09:48:55 +02:00
parent 6aa846ebc7
commit 1a81371346

View File

@ -144,7 +144,7 @@ public:
if (i != m_infos.end()) if (i != m_infos.end())
{ {
const Entry& entry = i->second; Entry& entry = i->second;
if (entry.sql_mode == this_unit.qc_sql_mode) if (entry.sql_mode == this_unit.qc_sql_mode)
{ {
@ -152,6 +152,7 @@ public:
this_unit.classifier->qc_info_dup(entry.pInfo); this_unit.classifier->qc_info_dup(entry.pInfo);
pInfo = entry.pInfo; pInfo = entry.pInfo;
++entry.hits;
++m_stats.hits; ++m_stats.hits;
} }
else else
@ -210,11 +211,13 @@ private:
Entry(QC_STMT_INFO* pInfo, qc_sql_mode_t sql_mode) Entry(QC_STMT_INFO* pInfo, qc_sql_mode_t sql_mode)
: pInfo(pInfo) : pInfo(pInfo)
, sql_mode(sql_mode) , sql_mode(sql_mode)
, hits(0)
{ {
} }
QC_STMT_INFO* pInfo; QC_STMT_INFO* pInfo;
qc_sql_mode_t sql_mode; qc_sql_mode_t sql_mode;
int64_t hits;
}; };
typedef std::unordered_map<std::string, Entry> InfosByStmt; typedef std::unordered_map<std::string, Entry> InfosByStmt;