blockchain_depth: add average min depth

This commit is contained in:
moneromooo-monero 2018-08-07 20:03:48 +00:00
parent 289880d82d
commit a4d2d84209
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 7 additions and 3 deletions

View File

@ -207,7 +207,7 @@ int main(int argc, char* argv[])
return 1; return 1;
} }
double cumulative_depth = 0.0; std::vector<uint64_t> depths;
for (const crypto::hash &start_txid: start_txids) for (const crypto::hash &start_txid: start_txids)
{ {
uint64_t depth = 0; uint64_t depth = 0;
@ -335,10 +335,14 @@ int main(int argc, char* argv[])
} }
done: done:
LOG_PRINT_L0("Min depth for txid " << start_txid << ": " << depth); 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(); core_storage->deinit();
return 0; return 0;