From 9db12bbaffd997fe3ba2959b7370b3a9b59401f6 Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Sun, 3 Oct 2021 11:23:36 +0100 Subject: [PATCH] collectd: sqm_collect: optimise parent search There can be only 1 parent process ID, so as soon as we find it, print it and exit - there's no point searching any of the following lines Signed-off-by: Kevin Darbyshire-Bryant --- utils/collectd/files/exec-scripts/sqm_collectd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/collectd/files/exec-scripts/sqm_collectd.sh b/utils/collectd/files/exec-scripts/sqm_collectd.sh index 690837017e..07fe555151 100755 --- a/utils/collectd/files/exec-scripts/sqm_collectd.sh +++ b/utils/collectd/files/exec-scripts/sqm_collectd.sh @@ -100,7 +100,7 @@ process_qdisc() { } # while not orphaned -while [ $(awk '$1 ~ "^PPid:" {print $2}' /proc/$$/status) -ne 1 ] ; do +while [ $(awk '$1 ~ "^PPid:" {print $2;exit}' /proc/$$/status) -ne 1 ] ; do for ifc in "$@" ; do process_qdisc "$ifc" done