1
0
mirror of https://github.com/Zygo/bees.git synced 2025-05-17 13:25:45 +02:00

stats: streamline add_count

Perf was blaming BeesStats::add_count for >1% of instructions.

Trim the instruction count a little.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell 2018-11-01 14:39:12 -04:00
parent 19859b0a0d
commit e3247d3471

View File

@ -276,9 +276,10 @@ BeesStatTmpl<T>::add_count(string idx, size_t amount)
{
unique_lock<mutex> lock(m_mutex);
if (!m_stats_map.count(idx)) {
m_stats_map[idx] = 0;
m_stats_map[idx] = amount;
} else {
m_stats_map[idx] += amount;
}
m_stats_map.at(idx) += amount;
}
template <class T>