Skip to content

Commit 266a5f9

Browse files
Lagrang3rustyrussell
authored andcommitted
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 <lagrang3@protonmail.com>
1 parent 07e2a77 commit 266a5f9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

plugins/askrene/askrene.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "config.h"
1010
#include <ccan/array_size/array_size.h>
1111
#include <ccan/tal/str/str.h>
12+
#include <ccan/time/time.h>
1213
#include <common/dijkstra.h>
1314
#include <common/gossmap.h>
1415
#include <common/gossmods_listpeerchannels.h>
@@ -373,6 +374,8 @@ static const char *get_routes(const tal_t *ctx,
373374
double delay_feefactor;
374375
u32 mu;
375376
const char *ret;
377+
struct timerel time_delta;
378+
struct timemono time_start = time_mono();
376379

377380
if (gossmap_refresh(askrene->gossmap)) {
378381
/* FIXME: gossmap_refresh callbacks to we can update in place */
@@ -586,14 +589,19 @@ static const char *get_routes(const tal_t *ctx,
586589
}
587590

588591
gossmap_remove_localmods(askrene->gossmap, localmods);
589-
592+
time_delta = timemono_between(time_mono(), time_start);
593+
rq_log(tmpctx, rq, LOG_DBG, "get_routes completed in %" PRIu64 " ms",
594+
time_to_msec(time_delta));
590595
return NULL;
591596

592597
/* Explicit failure path keeps the compiler (gcc version 12.3.0 -O3) from
593598
* warning about uninitialized variables in the caller */
594599
fail:
595600
assert(ret != NULL);
596601
gossmap_remove_localmods(askrene->gossmap, localmods);
602+
time_delta = timemono_between(time_mono(), time_start);
603+
rq_log(tmpctx, rq, LOG_DBG, "get_routes failed after %" PRIu64 " ms",
604+
time_to_msec(time_delta));
597605
return ret;
598606
}
599607

0 commit comments

Comments
 (0)