mirror of
https://github.com/Zygo/bees.git
synced 2025-05-17 21:35: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:
parent
19859b0a0d
commit
e3247d3471
@ -276,9 +276,10 @@ BeesStatTmpl<T>::add_count(string idx, size_t amount)
|
|||||||
{
|
{
|
||||||
unique_lock<mutex> lock(m_mutex);
|
unique_lock<mutex> lock(m_mutex);
|
||||||
if (!m_stats_map.count(idx)) {
|
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>
|
template <class T>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user