mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 00:54:20 +01:00
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>
This commit is contained in:
committed by
neil saitug
parent
1ccfbef4e7
commit
b248bb155a
@@ -560,15 +560,8 @@ truncate_nomsg:
|
|||||||
status_failed(STATUS_FAIL_INTERNAL_ERROR,
|
status_failed(STATUS_FAIL_INTERNAL_ERROR,
|
||||||
"Truncating store: %s", strerror(errno));
|
"Truncating store: %s", strerror(errno));
|
||||||
out:
|
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",
|
status_trace("total store load time: %"PRIu64" msec",
|
||||||
time_to_msec(time_between(time_now(), start)));
|
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",
|
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],
|
stats[0], stats[1], stats[2], stats[3],
|
||||||
gs->len);
|
gs->len);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ wait_for_start()
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# Wait for it to catch up with bitcoind.
|
# 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"
|
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
|
while ! bitcoin-cli -regtest ping >/dev/null 2>&1; do sleep 1; done
|
||||||
fi
|
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"
|
LCLI1="./cli/lightning-cli --lightning-dir=$DIR -R"
|
||||||
|
|
||||||
if [ -z "$DIR" ]; then
|
if [ -z "$DIR" ]; then
|
||||||
@@ -110,7 +117,7 @@ if [ -z "${TARGETS##* vsz_kb *}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# How long does rewriting the store take?
|
# 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
|
# shellcheck disable=SC2086
|
||||||
/usr/bin/time --append -f %e $LCLI1 dev-compact-gossip-store 2>&1 > /dev/null | print_stat store_rewrite_sec
|
/usr/bin/time --append -f %e $LCLI1 dev-compact-gossip-store 2>&1 > /dev/null | print_stat store_rewrite_sec
|
||||||
fi
|
fi
|
||||||
@@ -141,12 +148,13 @@ fi
|
|||||||
|
|
||||||
# Try getting all from the peer.
|
# Try getting all from the peer.
|
||||||
if [ -z "${TARGETS##* peer_write_all_sec *}" ]; then
|
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
|
/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
|
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
|
# shellcheck disable=SC2086
|
||||||
$LCLI1 stop > /dev/null
|
$LCLI1 stop > /dev/null
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|||||||
Reference in New Issue
Block a user