diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-08-07 20:03:48 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-08-07 21:20:54 +0000 |
commit | a4d2d8420987f6e05a49936ed7fc854065dfa0c3 (patch) | |
tree | 57dc5e91dfb408b678e5187ec9adbdd0ae834b04 | |
parent | blockchain_depth: get the average min depth of a set of txes (diff) | |
download | monero-a4d2d8420987f6e05a49936ed7fc854065dfa0c3.tar.xz |
blockchain_depth: add average min depth
-rw-r--r-- | src/blockchain_utilities/blockchain_depth.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/blockchain_utilities/blockchain_depth.cpp b/src/blockchain_utilities/blockchain_depth.cpp index 89fe6d03f..dd2387e5b 100644 --- a/src/blockchain_utilities/blockchain_depth.cpp +++ b/src/blockchain_utilities/blockchain_depth.cpp @@ -207,7 +207,7 @@ int main(int argc, char* argv[]) return 1; } - double cumulative_depth = 0.0; + std::vector<uint64_t> depths; for (const crypto::hash &start_txid: start_txids) { uint64_t depth = 0; @@ -335,10 +335,14 @@ int main(int argc, char* argv[]) } done: LOG_PRINT_L0("Min depth for txid " << start_txid << ": " << depth); - cumulative_depth += depth; + depths.push_back(depth); } - LOG_PRINT_L0("Average min depth for " << start_txids.size() << " transaction(s): " << cumulative_depth/start_txids.size()); + uint64_t cumulative_depth = 0; + for (uint64_t depth: depths) + cumulative_depth += depth; + LOG_PRINT_L0("Average min depth for " << start_txids.size() << " transaction(s): " << cumulative_depth/(float)depths.size()); + LOG_PRINT_L0("Median min depth for " << start_txids.size() << " transaction(s): " << epee::misc_utils::median(depths)); core_storage->deinit(); return 0; |