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
70 changes: 37 additions & 33 deletions console/executor_test_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,50 @@ using namespace network;
using namespace system;

// arbitrary testing (const).

void executor::read_test(const hash_digest&) const
{
logger("Wire size computation.");
const auto start = fine_clock::now();
const auto last = metadata_.configured.node.maximum_height_();
const auto concurrency = metadata_.configured.node.maximum_concurrency_();

size_t size{};
for (auto height = zero; !cancel_ && height <= last; ++height)
{
const auto link = query_.to_candidate(height);
if (link.is_terminal())
{
logger(format("Max candidate height is (%1%).") % sub1(height));
return;
}

const auto bytes = query_.get_block_size(link);
if (is_zero(bytes))
{
logger(format("Block (%1%) is not associated.") % height);
return;
}

size += bytes;
if (is_zero(height % concurrency))
{
const auto span = duration_cast<milliseconds>(fine_clock::now() - start);
logger(format("Wire size (%1%) at (%2%) in (%3%) ms.") %
size % height % span.count());
}
}
}

#if defined(UNDEFINED)

void executor::read_test(const hash_digest&) const
{
logger(format("Point table body searches: %1% / (%2% + %1%)") %
store_.point.positive_search_count() %
store_.point.negative_search_count());
}

#if defined(UNDEFINED)

void executor::read_test(const hash_digest&) const
{
using namespace database;
Expand Down Expand Up @@ -280,37 +315,6 @@ void executor::read_test(const hash_digest&) const
query_.get_height(link));
}

void executor::read_test(const hash_digest&) const
{
logger("Wire size computation.");
const auto start = fine_clock::now();
const auto last = metadata_.configured.node.maximum_height;

size_t size{};
for (auto height = zero; !cancel_ && height <= last; ++height)
{
const auto link = query_.to_candidate(height);
if (link.is_terminal())
{
logger(format("Max candidate height is (%1%).") % sub1(height));
return;
}

const auto bytes = query_.get_block_size(link);
if (is_zero(bytes))
{
logger(format("Block (%1%) is not associated.") % height);
return;
}

size += bytes;
}

const auto span = duration_cast<milliseconds>(fine_clock::now() - start);
logger(format("Wire size (%1%) at (%2%) in (%3%) ms.") %
size % last % span.count());
}

void executor::read_test(const hash_digest&) const
{
auto start = fine_clock::now();
Expand Down
7 changes: 4 additions & 3 deletions console/executor_test_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ using boost::format;
using namespace network;
using namespace system;

#if defined(UNDEFINED)

// arbitrary testing (non-const).
void executor::write_test(const hash_digest&)
{
logger("No write test implemented.");
}

#if defined(UNDEFINED)

void executor::write_test(const system::hash_digest&)
{
for (database::header_link link{ 793'008_u32 }; link < 885'000_u32; ++link)
Expand Down Expand Up @@ -201,7 +201,6 @@ void executor::write_test(const system::hash_digest&)
logger(format("block" BN_WRITE_ROW) % height % span.count());
}

#endif // UNDEFINED

void executor::write_test(const system::hash_digest& hash)
{
Expand All @@ -221,5 +220,7 @@ void executor::write_test(const system::hash_digest& hash)
}
}

#endif // UNDEFINED

} // namespace node
} // namespace libbitcoin
Loading