mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 22:45:27 +01:00
trace: Instrument topology functions
This commit is contained in:
parent
3da974ca19
commit
039aaaf777
2 changed files with 19 additions and 0 deletions
|
@ -15,6 +15,7 @@
|
|||
#include <common/configdir.h>
|
||||
#include <common/json_parse.h>
|
||||
#include <common/memleak.h>
|
||||
#include <common/trace.h>
|
||||
#include <db/exec.h>
|
||||
#include <lightningd/bitcoind.h>
|
||||
#include <lightningd/chaintopology.h>
|
||||
|
@ -464,6 +465,8 @@ getrawblockbyheight_callback(const char *buf, const jsmntok_t *toks,
|
|||
const char *block_str, *err;
|
||||
struct bitcoin_blkid blkid;
|
||||
struct bitcoin_block *blk;
|
||||
trace_span_resume(call);
|
||||
trace_span_end(call);
|
||||
|
||||
/* If block hash is `null`, this means not found! Call the callback
|
||||
* with NULL values. */
|
||||
|
@ -514,6 +517,9 @@ void bitcoind_getrawblockbyheight_(struct bitcoind *bitcoind,
|
|||
call->cb = cb;
|
||||
call->cb_arg = cb_arg;
|
||||
|
||||
trace_span_start("plugin/bitcoind", call);
|
||||
trace_span_tag(call, "method", "getrawblockbyheight");
|
||||
trace_span_suspend(call);
|
||||
req = jsonrpc_request_start(bitcoind, "getrawblockbyheight", NULL, true,
|
||||
bitcoind->log,
|
||||
NULL, getrawblockbyheight_callback,
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <common/json_command.h>
|
||||
#include <common/json_param.h>
|
||||
#include <common/timeout.h>
|
||||
#include <common/trace.h>
|
||||
#include <common/type_to_string.h>
|
||||
#include <db/exec.h>
|
||||
#include <lightningd/bitcoind.h>
|
||||
|
@ -971,13 +972,22 @@ static void add_tip(struct chain_topology *topo, struct block *b)
|
|||
b->prev = topo->tip;
|
||||
topo->tip->next = b; /* FIXME this doesn't seem to be used anywhere */
|
||||
topo->tip = b;
|
||||
trace_span_start("wallet_block_add", b);
|
||||
wallet_block_add(topo->ld->wallet, b);
|
||||
trace_span_end(b);
|
||||
|
||||
trace_span_start("topo_add_utxo", b);
|
||||
topo_add_utxos(topo, b);
|
||||
trace_span_end(b);
|
||||
|
||||
trace_span_start("topo_update_spends", b);
|
||||
topo_update_spends(topo, b);
|
||||
trace_span_end(b);
|
||||
|
||||
/* Only keep the transactions we care about. */
|
||||
trace_span_start("filter_block_txs", b);
|
||||
filter_block_txs(topo, b);
|
||||
trace_span_end(b);
|
||||
|
||||
block_map_add(topo->block_map, b);
|
||||
topo->max_blockheight = b->height;
|
||||
|
@ -1056,6 +1066,7 @@ static void get_new_block(struct bitcoind *bitcoind,
|
|||
if (!blkid && !blk) {
|
||||
/* No such block, we're done. */
|
||||
updates_complete(topo);
|
||||
trace_span_end(topo);
|
||||
return;
|
||||
}
|
||||
assert(blkid && blk);
|
||||
|
@ -1075,6 +1086,7 @@ static void get_new_block(struct bitcoind *bitcoind,
|
|||
}
|
||||
|
||||
/* Try for next one. */
|
||||
trace_span_end(topo);
|
||||
try_extend_tip(topo);
|
||||
}
|
||||
|
||||
|
@ -1083,6 +1095,7 @@ static void try_extend_tip(struct chain_topology *topo)
|
|||
topo->extend_timer = NULL;
|
||||
if (topo->stopping)
|
||||
return;
|
||||
trace_span_start("extend_tip", topo);
|
||||
bitcoind_getrawblockbyheight(topo->bitcoind, topo->tip->height + 1,
|
||||
get_new_block, topo);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue