33 template<
typename Key,
typename Counter>
35 const std::string & sTableName,
37 const std::string & sDescription)
42 std::lock_guard<std::mutex> m(mutex_);
50 template<
typename Key,
typename Counter>
53 std::lock_guard<std::mutex> m(mutex_);
55 auto iter = umap_.find(key);
57 if(iter != umap_.end())
59 iter->second += amount;
60 pStatisticTable_->setCell(key,1,
Any{iter->second});
64 umap_.insert(std::make_pair(key,amount));
65 pStatisticTable_->addRow(key,{
Any{key},
Any{amount}});
A StatisticTablePublisher produces two dimensional tables of Anys.
The StatisticRegistrar allows NEM layers to register statistics and statistic tables. Statistics and Statistic tables are owned by the emulator framework and a borrowed reference is returned to the registering NEM layer.
std::vector< std::string > StatisticTableLabels
StatisticHistogramTable(StatisticRegistrar ®istrar, const std::string &sTableName, const StatisticTableLabels &labels, const std::string &sDescription="")
StatisticTable< Key, Compare, scolumn > * registerTable(const std::string &sName, const StatisticTableLabels &labels, const StatisticProperties &properties=StatisticProperties::NONE, const std::string &sDescription="")
void increment(const Key &key, Counter amount=1)
The Any class can contain an instance of one of any type in its support type set. ...