Cli debug online weight (#1744)
* cli for debugging online_weights table * formatting * drop clear, already a part of cli.cpp formatting verbiage update * stringify timestamps
This commit is contained in:
parent
7620d2dc8d
commit
d3f3459339
1 changed files with 17 additions and 0 deletions
|
@ -34,6 +34,7 @@ int main (int argc, char * const * argv)
|
|||
("batch_size",boost::program_options::value<std::size_t> (), "Increase sideband batch size, default 512")
|
||||
("debug_block_count", "Display the number of block")
|
||||
("debug_bootstrap_generate", "Generate bootstrap sequence of blocks")
|
||||
("debug_dump_online_weight", "Dump online_weights table")
|
||||
("debug_dump_representatives", "List representatives and weights")
|
||||
("debug_account_count", "Display the number of accounts")
|
||||
("debug_mass_activity", "Generates fake debug activity")
|
||||
|
@ -165,6 +166,22 @@ int main (int argc, char * const * argv)
|
|||
result = -1;
|
||||
}
|
||||
}
|
||||
else if (vm.count ("debug_dump_online_weight"))
|
||||
{
|
||||
nano::inactive_node node (data_path);
|
||||
auto current (node.node->online_reps.online_stake ());
|
||||
std::cout << boost::str (boost::format ("Online Weight %1%\n") % current);
|
||||
auto transaction (node.node->store.tx_begin_read ());
|
||||
for (auto i (node.node->store.online_weight_begin (transaction)), n (node.node->store.online_weight_end ()); i != n; ++i)
|
||||
{
|
||||
using time_point = std::chrono::system_clock::time_point;
|
||||
time_point ts (std::chrono::duration_cast<time_point::duration> (std::chrono::nanoseconds (i->first)));
|
||||
std::time_t timestamp = std::chrono::system_clock::to_time_t (ts);
|
||||
std::string weight;
|
||||
i->second.encode_dec (weight);
|
||||
std::cout << boost::str (boost::format ("Timestamp %1% Weight %2%\n") % ctime (×tamp) % weight);
|
||||
}
|
||||
}
|
||||
else if (vm.count ("debug_dump_representatives"))
|
||||
{
|
||||
nano::inactive_node node (data_path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue