diff options
author | moneromooo <moneromoo@nowhere.nowhere.nowhere> | 2017-08-23 18:20:51 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-08-25 22:21:38 +0100 |
commit | 4dbf29bd329c8891f9b6a8eaab71ee985518800b (patch) | |
tree | 417bd0c9fa436222a5c2c8ea8701de0611ab906a /src/cryptonote_core/tx_pool.cpp | |
parent | Merge pull request #2311 (diff) | |
download | monero-4dbf29bd329c8891f9b6a8eaab71ee985518800b.tar.xz |
txpool: add tx size median to the pool stats
Diffstat (limited to 'src/cryptonote_core/tx_pool.cpp')
-rw-r--r-- | src/cryptonote_core/tx_pool.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index 73f519079..e7fc14a44 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -560,7 +560,10 @@ namespace cryptonote const uint64_t now = time(NULL); std::map<uint64_t, txpool_histo> agebytes; stats.txs_total = m_blockchain.get_txpool_tx_count(); - m_blockchain.for_all_txpool_txes([&stats, now, &agebytes](const crypto::hash &txid, const txpool_tx_meta_t &meta, const cryptonote::blobdata *bd){ + std::vector<uint32_t> sizes; + sizes.reserve(stats.txs_total); + m_blockchain.for_all_txpool_txes([&stats, &sizes, now, &agebytes](const crypto::hash &txid, const txpool_tx_meta_t &meta, const cryptonote::blobdata *bd){ + sizes.push_back(meta.blob_size); stats.bytes_total += meta.blob_size; if (!stats.bytes_min || meta.blob_size < stats.bytes_min) stats.bytes_min = meta.blob_size; @@ -580,6 +583,7 @@ namespace cryptonote agebytes[age].bytes += meta.blob_size; return true; }); + stats.bytes_med = epee::misc_utils::median(sizes); if (stats.txs_total > 1) { /* looking for 98th percentile */ |