Browse Source

tools/bench-gossipd.sh: make it work (where possible) with DEVELOPER=0

Some tests require dev support, but the rest can run.  We simplify
the gossip_store output so it's the same in non-dev mode too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
pr-2587
Rusty Russell 6 years ago
parent
commit
bbc881bb43
  1. 7
      gossipd/gossip_store.c
  2. 20
      tools/bench-gossipd.sh

7
gossipd/gossip_store.c

@ -560,15 +560,8 @@ truncate_nomsg:
status_failed(STATUS_FAIL_INTERNAL_ERROR,
"Truncating store: %s", strerror(errno));
out:
#if DEVELOPER
status_info("total store load time: %"PRIu64" msec (%zu entries, %zu bytes)",
time_to_msec(time_between(time_now(), start)),
stats[0] + stats[1] + stats[2] + stats[3],
(size_t)gs->len);
#else
status_trace("total store load time: %"PRIu64" msec",
time_to_msec(time_between(time_now(), start)));
#endif
status_trace("gossip_store: Read %zu/%zu/%zu/%zu cannounce/cupdate/nannounce/cdelete from store in %"PRIu64" bytes",
stats[0], stats[1], stats[2], stats[3],
gs->len);

20
tools/bench-gossipd.sh

@ -24,7 +24,7 @@ wait_for_start()
fi
done
# Wait for it to catch up with bitcoind.
while [ "$($LCLI1 -H getinfo 2>/dev/null | grep '^blockheight=' | cut -d= -f2)" != "$(bitcoin-cli -regtest getblockcount)" ]; do sleep 1; done
while [ "$($LCLI1 -H getinfo | grep '^blockheight=' | cut -d= -f2)" != "$(bitcoin-cli -regtest getblockcount)" ]; do sleep 1; done
echo "$ID"
}
@ -77,7 +77,14 @@ if ! bitcoin-cli -regtest ping >/dev/null 2>&1; then
while ! bitcoin-cli -regtest ping >/dev/null 2>&1; do sleep 1; done
fi
LIGHTNINGD="./lightningd/lightningd --network=regtest --dev-gossip-time=1550513768 --dev-unknown-channel-satoshis=100000"
DEVELOPER=$(grep '^DEVELOPER=' config.vars | cut -d= -f2-)
if [ $DEVELOPER = 1 ]; then
LIGHTNINGD="./lightningd/lightningd --network=regtest --dev-gossip-time=1550513768 --dev-unknown-channel-satoshis=100000"
else
# Means we can't do the peer_read_all test properly, since it will time out.
LIGHTNINGD="./lightningd/lightningd --network=regtest"
fi
LCLI1="./cli/lightning-cli --lightning-dir=$DIR -R"
if [ -z "$DIR" ]; then
@ -110,7 +117,7 @@ if [ -z "${TARGETS##* vsz_kb *}" ]; then
fi
# How long does rewriting the store take?
if [ -z "${TARGETS##* store_rewrite_sec *}" ]; then
if [ -z "${TARGETS##* store_rewrite_sec *}" -a "$DEVELOPER" = 1 ]; then
# shellcheck disable=SC2086
/usr/bin/time --append -f %e $LCLI1 dev-compact-gossip-store 2>&1 > /dev/null | print_stat store_rewrite_sec
fi
@ -141,12 +148,13 @@ fi
# Try getting all from the peer.
if [ -z "${TARGETS##* peer_write_all_sec *}" ]; then
ENTRIES=$(sed -n 's/.*gossipd.*: total store load time: [0-9]* msec (\([0-9]*\) entries, [0-9]* bytes)/\1/p' < "$DIR"/log)
ENTRIES=$(grep 'Read .* cannounce/cupdate/nannounce/cdelete' "$DIR"/log | cut -d\ -f5 | tr / + | bc)
/usr/bin/time --quiet --append -f %e devtools/gossipwith --initial-sync --max-messages=$((ENTRIES - 5)) "$ID"@"$DIR"/peer 2>&1 > /dev/null | print_stat peer_write_all_sec
fi
if [ -z "${TARGETS##* peer_read_all_sec *}" ]; then
# Needs DEVELOPER otherwise timestamps will be more than 2 weeks old and it
# will ignore gossip.
if [ -z "${TARGETS##* peer_read_all_sec *}" -a "$DEVELOPER" = 1 ]; then
# shellcheck disable=SC2086
$LCLI1 stop > /dev/null
sleep 5

Loading…
Cancel
Save