Skip to content

Commit aa569a6

Browse files
committed
Disable -w, change -t to wire size computation.
1 parent 684e846 commit aa569a6

File tree

2 files changed

+41
-36
lines changed

2 files changed

+41
-36
lines changed

console/executor_test_reader.cpp

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,50 @@ using namespace network;
3131
using namespace system;
3232

3333
// arbitrary testing (const).
34+
35+
void executor::read_test(const hash_digest&) const
36+
{
37+
logger("Wire size computation.");
38+
const auto start = fine_clock::now();
39+
const auto last = metadata_.configured.node.maximum_height_();
40+
const auto concurrency = metadata_.configured.node.maximum_concurrency_();
41+
42+
size_t size{};
43+
for (auto height = zero; !cancel_ && height <= last; ++height)
44+
{
45+
const auto link = query_.to_candidate(height);
46+
if (link.is_terminal())
47+
{
48+
logger(format("Max candidate height is (%1%).") % sub1(height));
49+
return;
50+
}
51+
52+
const auto bytes = query_.get_block_size(link);
53+
if (is_zero(bytes))
54+
{
55+
logger(format("Block (%1%) is not associated.") % height);
56+
return;
57+
}
58+
59+
size += bytes;
60+
if (is_zero(height % concurrency))
61+
{
62+
const auto span = duration_cast<milliseconds>(fine_clock::now() - start);
63+
logger(format("Wire size (%1%) at (%2%) in (%3%) ms.") %
64+
size % height % span.count());
65+
}
66+
}
67+
}
68+
69+
#if defined(UNDEFINED)
70+
3471
void executor::read_test(const hash_digest&) const
3572
{
3673
logger(format("Point table body searches: %1% / (%2% + %1%)") %
3774
store_.point.positive_search_count() %
3875
store_.point.negative_search_count());
3976
}
4077

41-
#if defined(UNDEFINED)
42-
4378
void executor::read_test(const hash_digest&) const
4479
{
4580
using namespace database;
@@ -280,37 +315,6 @@ void executor::read_test(const hash_digest&) const
280315
query_.get_height(link));
281316
}
282317

283-
void executor::read_test(const hash_digest&) const
284-
{
285-
logger("Wire size computation.");
286-
const auto start = fine_clock::now();
287-
const auto last = metadata_.configured.node.maximum_height;
288-
289-
size_t size{};
290-
for (auto height = zero; !cancel_ && height <= last; ++height)
291-
{
292-
const auto link = query_.to_candidate(height);
293-
if (link.is_terminal())
294-
{
295-
logger(format("Max candidate height is (%1%).") % sub1(height));
296-
return;
297-
}
298-
299-
const auto bytes = query_.get_block_size(link);
300-
if (is_zero(bytes))
301-
{
302-
logger(format("Block (%1%) is not associated.") % height);
303-
return;
304-
}
305-
306-
size += bytes;
307-
}
308-
309-
const auto span = duration_cast<milliseconds>(fine_clock::now() - start);
310-
logger(format("Wire size (%1%) at (%2%) in (%3%) ms.") %
311-
size % last % span.count());
312-
}
313-
314318
void executor::read_test(const hash_digest&) const
315319
{
316320
auto start = fine_clock::now();

console/executor_test_writer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ using boost::format;
2929
using namespace network;
3030
using namespace system;
3131

32-
#if defined(UNDEFINED)
33-
3432
// arbitrary testing (non-const).
3533
void executor::write_test(const hash_digest&)
3634
{
3735
logger("No write test implemented.");
3836
}
3937

38+
#if defined(UNDEFINED)
39+
4040
void executor::write_test(const system::hash_digest&)
4141
{
4242
for (database::header_link link{ 793'008_u32 }; link < 885'000_u32; ++link)
@@ -201,7 +201,6 @@ void executor::write_test(const system::hash_digest&)
201201
logger(format("block" BN_WRITE_ROW) % height % span.count());
202202
}
203203

204-
#endif // UNDEFINED
205204

206205
void executor::write_test(const system::hash_digest& hash)
207206
{
@@ -221,5 +220,7 @@ void executor::write_test(const system::hash_digest& hash)
221220
}
222221
}
223222

223+
#endif // UNDEFINED
224+
224225
} // namespace node
225226
} // namespace libbitcoin

0 commit comments

Comments
 (0)