Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion console/executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ class executor
void dump_version() const;
void dump_hardware() const;
void dump_options() const;
void dump_configuration() const;
void dump_body_sizes() const;
void dump_records() const;
void dump_buckets() const;
void dump_progress() const;
void dump_collisions() const;
void dump_sizes() const;

// Store functions.
bool check_store_path(bool create=false) const;
Expand Down
11 changes: 9 additions & 2 deletions console/executor_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const std::string executor::name_{ "bs" };
bool executor::do_help()
{
log_.stop();
printer help(metadata_.load_options(), name_, BS_INFORMATION_MESSAGE);
printer help(metadata_.load_options(), name_, BS_DETAIL_MESSAGE);
help.initialize();
help.commandline(output_);
return true;
Expand Down Expand Up @@ -124,7 +124,14 @@ bool executor::do_information()
!open_store())
return false;

dump_sizes();
dump_body_sizes();
dump_records();
dump_buckets();
dump_collisions();

// This one can take a few seconds on cold iron.
logger(BS_INFORMATION_PROGRESS_START);
dump_progress();
return close_store();
}

Expand Down
31 changes: 13 additions & 18 deletions console/executor_dumps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,17 @@ void executor::dump_options() const
logger(format("[v]erbose...... " BS_LOG_TABLE) % levels::verbose_defined % toggle_.at(levels::verbose));
}

// query_ not valid unless store is loaded.
void executor::dump_configuration() const
{
logger(format(BS_INFORMATION_START)
% store_.is_dirty()
% query_.interval_span());
}

void executor::dump_body_sizes() const
{
logger(format(BS_MEASURE_SIZES) %
logger(format(BS_INFORMATION_SIZES) %
query_.header_body_size() %
query_.txs_body_size() %
query_.tx_body_size() %
Expand All @@ -100,7 +108,7 @@ void executor::dump_body_sizes() const

void executor::dump_records() const
{
logger(format(BS_MEASURE_RECORDS) %
logger(format(BS_INFORMATION_RECORDS) %
query_.header_records() %
query_.tx_records() %
query_.point_records() %
Expand All @@ -116,7 +124,7 @@ void executor::dump_records() const

void executor::dump_buckets() const
{
logger(format(BS_MEASURE_BUCKETS) %
logger(format(BS_INFORMATION_BUCKETS) %
query_.header_buckets() %
query_.txs_buckets() %
query_.tx_buckets() %
Expand All @@ -133,7 +141,7 @@ void executor::dump_buckets() const

void executor::dump_collisions() const
{
logger(format(BS_MEASURE_COLLISION_RATES) %
logger(format(BS_INFORMATION_COLLISION_RATES) %
(to_double(query_.header_records()) / query_.header_buckets()) %
(to_double(query_.tx_records()) / query_.tx_buckets()) %
(to_double(query_.point_records()) / query_.point_buckets()) %
Expand All @@ -147,7 +155,7 @@ void executor::dump_progress() const
{
using namespace system;

logger(format(BS_MEASURE_PROGRESS) %
logger(format(BS_INFORMATION_PROGRESS) %
query_.get_fork() %
query_.get_top_confirmed() %
encode_hash(query_.get_top_confirmed_hash()) %
Expand All @@ -159,18 +167,5 @@ void executor::dump_progress() const
query_.get_candidate_size());
}

// file and logical sizes.
void executor::dump_sizes() const
{
dump_body_sizes();
dump_records();
dump_buckets();
dump_collisions();

// This one can take a few seconds on cold iron.
logger(BS_MEASURE_PROGRESS_START);
dump_progress();
}

} // namespace server
} // namespace libbitcoin
2 changes: 1 addition & 1 deletion console/executor_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ void executor::do_resume()
// [i]nfo
void executor::do_info() const
{
dump_configuration();
dump_body_sizes();
dump_records();
dump_buckets();
dump_collisions();
////dump_progress();
}

// [m]enu
Expand Down
4 changes: 2 additions & 2 deletions console/executor_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ bool executor::do_run()
dump_body_sizes();
dump_records();
dump_buckets();
////logger(BS_MEASURE_PROGRESS_START);
////logger(BS_INFORMATION_PROGRESS_START);
////dump_progress();

// Stopped by stopper.
Expand Down Expand Up @@ -173,7 +173,7 @@ bool executor::do_run()
// Sizes and records change, buckets don't.
dump_body_sizes();
dump_records();
////logger(BS_MEASURE_PROGRESS_START);
////logger(BS_INFORMATION_PROGRESS_START);
////dump_progress();

if (!close_store(true))
Expand Down
6 changes: 3 additions & 3 deletions console/executor_scans.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void executor::scan_flags() const
// input and output table slab counts.
void executor::scan_slabs() const
{
logger(BS_MEASURE_SLABS);
logger(BS_INFORMATION_SLABS);
logger(BS_OPERATION_INTERRUPT);
database::tx_link::integer link{};
size_t inputs{}, outputs{};
Expand All @@ -92,14 +92,14 @@ void executor::scan_slabs() const
inputs += puts.first;
outputs += puts.second;
if (is_zero(link % frequency))
logger(format(BS_MEASURE_SLABS_ROW) % link % inputs % outputs);
logger(format(BS_INFORMATION_SLABS_ROW) % link % inputs % outputs);
}

if (canceled())
logger(BS_OPERATION_CANCELED);

const auto span = duration_cast<seconds>(logger::now() - start);
logger(format(BS_MEASURE_STOP) % inputs % outputs % span.count());
logger(format(BS_INFORMATION_STOP) % inputs % outputs % span.count());
}

// hashmap bucket fill rates.
Expand Down
2 changes: 1 addition & 1 deletion console/executor_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ code executor::open_store_coded(bool details)
return ec;
}

logger(store_.is_dirty() ? BS_DATABASE_STARTED_DIRTY : BS_DATABASE_STARTED);
logger(BS_DATABASE_STARTED);
return error::success;
}

Expand Down
30 changes: 16 additions & 14 deletions console/localize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
// --settings
#define BS_SETTINGS_MESSAGE \
"These are the configuration settings that can be set."
#define BS_INFORMATION_MESSAGE \
#define BS_DETAIL_MESSAGE \
"Runs a full bitcoin node server."

// --initchain
Expand Down Expand Up @@ -67,8 +67,12 @@
#define BS_RESTORE_COMPLETE \
"Restored the database in %1% secs."

// --measure
#define BS_MEASURE_SIZES \
// --information
#define BS_INFORMATION_START \
"Configuration...\n" \
" dirty :%1%\n" \
" interval :%2%"
#define BS_INFORMATION_SIZES \
"Body sizes...\n" \
" header :%1%\n" \
" txs :%2%\n" \
Expand All @@ -88,7 +92,7 @@
" filter_bk :%16%\n" \
" filter_tx :%17%\n" \
" address :%18%"
#define BS_MEASURE_RECORDS \
#define BS_INFORMATION_RECORDS \
"Table records...\n" \
" header :%1%\n" \
" tx :%2%\n" \
Expand All @@ -101,15 +105,15 @@
" strong_tx :%9%\n" \
" filter_bk :%10%\n" \
" address :%11%"
#define BS_MEASURE_SLABS \
#define BS_INFORMATION_SLABS \
"Table slabs..."
#define BS_MEASURE_SLABS_ROW \
#define BS_INFORMATION_SLABS_ROW \
" @tx :%1%, inputs:%2%, outputs:%3%"
#define BS_MEASURE_STOP \
#define BS_INFORMATION_STOP \
" input :%1%\n" \
" output :%2%\n" \
" seconds :%3%"
#define BS_MEASURE_BUCKETS \
#define BS_INFORMATION_BUCKETS \
"Head buckets...\n" \
" header :%1%\n" \
" txs :%2%\n" \
Expand All @@ -123,17 +127,17 @@
" filter_bk :%10%\n" \
" filter_tx :%11%\n" \
" address :%12%"
#define BS_MEASURE_COLLISION_RATES \
#define BS_INFORMATION_COLLISION_RATES \
"Collision rates...\n" \
" header :%1%\n" \
" tx :%2%\n" \
" point :%3%\n" \
" strong_tx :%4%\n" \
" valid_tx :%5%\n" \
" address :%6%"
#define BS_MEASURE_PROGRESS_START \
#define BS_INFORMATION_PROGRESS_START \
"Thinking..."
#define BS_MEASURE_PROGRESS \
#define BS_INFORMATION_PROGRESS \
"Chain progress...\n" \
" fork pt :%1%\n" \
" top conf :%2%:%3%\n" \
Expand Down Expand Up @@ -171,9 +175,7 @@
#define BS_NODE_INTERRUPT \
"Press CTRL-C to stop the node."
#define BS_DATABASE_STARTED \
"Database is started (clean)."
#define BS_DATABASE_STARTED_DIRTY \
"Database is started (dirty)."
"Database is started."
#define BS_NETWORK_STARTING \
"Please wait while network is starting..."
#define BS_NODE_START_FAIL \
Expand Down
4 changes: 2 additions & 2 deletions src/protocols/protocol_electrum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void protocol_electrum::handle_blockchain_block_headers(const code& ec,
{
object_t
{
{ "count", quantity },
{ "count", uint64_t{ quantity } },
{ "headers", std::move(headers) },
{ "max", maximum }
}
Expand Down Expand Up @@ -296,7 +296,7 @@ void protocol_electrum::handle_blockchain_headers_subscribe(const code& ec,
{
object_t
{
{ "height", top },
{ "height", uint64_t{ top } },
{ "hex", to_hex(*header, chain::header::serialized_size()) }
}
}, 256, BIND(complete, _1));
Expand Down
Loading