tests: Reduce sleep time when waiting for various daemons to die
authorKienan Stewart <kstewart@efficios.com>
Thu, 31 Aug 2023 18:00:26 +0000 (14:00 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 21 Dec 2023 21:38:35 +0000 (16:38 -0500)
Motivation
==========

Using the rough duration of the tests 'Wait after kill \w+ daemon',
approximately 200s were being spent in those areas when running
non-root, non-destructive tests on my development machine.

```
$ find . -iname '*.log' -exec grep -A4 -HE 'Wait for kill [a-z]+ daemon'
{} \; | grep duration_ms | cut -d':' -f2 | datamash sum 1
198078.707216
```

Solution
========

The `stop_x_opt()` functions with timers in `tests/utils/utils.sh`
have the timeouts multiplied by 5 to reduce the counted sleep interval
to 0.1s.

After applying this change, the time spent in the tests as counted
with the find command in the 'Motivation' section above was reduced to
92061.768ms, a reduction of about 1.5 minutes.

Known drawbacks
===============

None

Change-Id: I1d4ad899808f37f6cb7b88bbab0ff05ab0c2b787
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/utils/utils.sh

index 5bab2f372eeccc64ccb774bfd4806fe0dbb37f11..27816deddd9c25b1581515471e58ee76c00dd761 100644 (file)
@@ -675,8 +675,9 @@ function stop_lttng_relayd_opt()
 
 
        # Multiply time by 2 to simplify integer arithmetic
+       # Multiply time by 5 to adjust for sleeping every 0.1s
        if [ -n "$timeout_s" ]; then
-               dtimeleft_s=$((timeout_s * 2))
+               dtimeleft_s=$((timeout_s * 2 * 5))
        fi
 
 
@@ -711,7 +712,7 @@ function stop_lttng_relayd_opt()
                                fi
                                dtimeleft_s=$((dtimeleft_s - 1))
                        fi
-                       sleep 0.5
+                       sleep 0.1
                done
                if [ "$withtap" -eq "1" ]; then
                        if [ "$retval" -eq "0" ]; then
@@ -835,8 +836,9 @@ function stop_lttng_sessiond_opt()
        fi
 
        # Multiply time by 2 to simplify integer arithmetic
+       # Multiply time by 5 to adjust for sleeping every 0.1s
        if [ -n "$timeout_s" ]; then
-               dtimeleft_s=$((timeout_s * 2))
+               dtimeleft_s=$((timeout_s * 2 * 5))
        fi
 
        if [ -n "$TEST_NO_SESSIOND" ] && [ "$TEST_NO_SESSIOND" == "1" ]; then
@@ -881,7 +883,7 @@ function stop_lttng_sessiond_opt()
                                fi
                                dtimeleft_s=$((dtimeleft_s - 1))
                        fi
-                       sleep 0.5
+                       sleep 0.1
                done
                out=1
                while [ -n "$out" ]; do
@@ -893,7 +895,7 @@ function stop_lttng_sessiond_opt()
                                fi
                                dtimeleft_s=$((dtimeleft_s - 1))
                        fi
-                       sleep 0.5
+                       sleep 0.1
                done
 
                if [ "$withtap" -eq "1" ]; then
@@ -1003,8 +1005,9 @@ function stop_lttng_consumerd_opt()
        fi
 
        # Multiply time by 2 to simplify integer arithmetic
+       # Multiply time by 5 to adjust for sleeping every 0.1s
        if [ -n "$timeout_s" ]; then
-               dtimeleft_s=$((timeout_s * 2))
+               dtimeleft_s=$((timeout_s * 2 * 5))
        fi
 
        pids="$(lttng_pgrep "$CONSUMERD_MATCH")"
@@ -1049,7 +1052,7 @@ function stop_lttng_consumerd_opt()
                                fi
                                dtimeleft_s=$((dtimeleft_s - 1))
                        fi
-                       sleep 0.5
+                       sleep 0.1
                done
                if [ "$withtap" -eq "1" ]; then
                        if [ "$retval" -eq "0" ]; then
This page took 0.026895 seconds and 4 git commands to generate.