Skip to content

Commit 9246744

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 cb1bd82 commit 9246744

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
@@ -608,6 +608,12 @@ struct getroutes_info {
608608
struct layer *local_layer;
609609
};
610610

611+
static u64 time_delta_ms(struct timerel t)
612+
{
613+
u64 msec = t.ts.tv_sec * 1000 + t.ts.tv_nsec / 1000000;
614+
return msec;
615+
}
616+
611617
static struct command_result *do_getroutes(struct command *cmd,
612618
struct gossmap_localmods *localmods,
613619
const struct getroutes_info *info)
@@ -617,12 +623,20 @@ static struct command_result *do_getroutes(struct command *cmd,
617623
struct amount_msat *amounts;
618624
struct route **routes;
619625
struct json_stream *response;
626+
struct timemono time_start;
627+
struct timerel time_delta;
620628

629+
time_start = time_mono();
621630
err = get_routes(cmd, cmd,
622631
info->source, info->dest,
623632
*info->amount, *info->maxfee, *info->finalcltv,
624633
info->layers, localmods, info->local_layer,
625634
&routes, &amounts, info->additional_costs, &probability);
635+
time_delta = timemono_between(time_mono(), time_start);
636+
plugin_log(cmd->plugin, LOG_INFORM,
637+
"get_routes completed in %" PRIu64 " ms",
638+
time_delta_ms(time_delta));
639+
626640
if (err)
627641
return command_fail(cmd, PAY_ROUTE_NOT_FOUND, "%s", err);
628642

0 commit comments

Comments
 (0)