From 7c0c62706f2ae9821dc779db268a28ef986730fe Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Tue, 29 Jun 2021 20:11:37 +0200 Subject: lib: Application RIB with FRCT statistics Application flows can now be monitored from the RIB, exposing FRCT statistics (window edges, retransmission timeout, rtt estimate, etc). Application RIB requires user permissions to be able to access /dev/fuse. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/dev.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/lib/dev.c') diff --git a/src/lib/dev.c b/src/lib/dev.c index ec4561b2..fbbc096d 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -44,6 +44,9 @@ #include #include #include +#ifdef PROC_FLOW_STATS +#include +#endif #include #include @@ -361,7 +364,9 @@ static void init(int argc, { const char * prog = argv[0]; int i; - +#ifdef PROC_FLOW_STATS + char procstr[32]; +#endif (void) argc; (void) envp; @@ -437,6 +442,11 @@ static void init(int argc, if (timerwheel_init() < 0) goto fail_timerwheel; +#if defined PROC_FLOW_STATS + sprintf(procstr, "proc.%d", getpid()); + /* Don't bail, it just won't show metrics */ + rib_init(procstr); +#endif return; fail_timerwheel: @@ -470,7 +480,13 @@ static void init(int argc, static void fini(void) { - int i = 0; + int i = 0; +#ifdef PROC_FLOW_STATS + char procstr[32]; + + sprintf(procstr, "proc.%d", getpid()); + rib_fini(); +#endif if (ai.fds == NULL) return; -- cgit v1.2.3