Skip to content

Commit 1e27620

Browse files
committed
askrene: add runtime of getroutes to the logs
Add log information about the runtime of getroutes. Changelog-None: askrene: add runtime of getroutes to the logs Signed-off-by: Lagrang3 <[email protected]>
1 parent 0e7615b commit 1e27620

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

plugins/askrene/askrene.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,12 @@ struct getroutes_info {
644644
struct layer *local_layer;
645645
};
646646

647+
static u64 time_delta_ms(struct timerel t)
648+
{
649+
u64 msec = t.ts.tv_sec * 1000 + t.ts.tv_nsec / 1000000;
650+
return msec;
651+
}
652+
647653
static struct command_result *do_getroutes(struct command *cmd,
648654
struct gossmap_localmods *localmods,
649655
const struct getroutes_info *info)
@@ -653,13 +659,21 @@ static struct command_result *do_getroutes(struct command *cmd,
653659
struct amount_msat *amounts;
654660
struct route **routes;
655661
struct json_stream *response;
662+
struct timemono time_start;
663+
struct timerel time_delta;
656664

665+
time_start = time_mono();
657666
err = get_routes(cmd, cmd,
658667
info->source, info->dest,
659668
*info->amount, *info->maxfee, *info->finalcltv,
660669
*info->maxdelay, info->layers, localmods, info->local_layer,
661670
have_layer(info->layers, "auto.no_mpp_support"),
662671
&routes, &amounts, info->additional_costs, &probability);
672+
time_delta = timemono_between(time_mono(), time_start);
673+
plugin_log(cmd->plugin, LOG_INFORM,
674+
"askrene::get_routes completed in %" PRIu64 " ms",
675+
time_delta_ms(time_delta));
676+
663677
if (err)
664678
return command_fail(cmd, PAY_ROUTE_NOT_FOUND, "%s", err);
665679

0 commit comments

Comments
 (0)