Skip to content

Commit 2ca8af4

Browse files
committed
Add 5 time measurement points
run_process process starting time test_with_retry process starting time (for neutron legacy) restart_apache_server Apache HTTPD restart time wait_for_service HTTP server waiting time git_timed git command execution time example ======================== DevStack Components Timed ======================== run_process - 52 secs test_with_retry - 3 secs apt-get-update - 8 secs pip_install - 76 secs restart_apache_server - 9 secs wait_for_service - 11 secs git_timed - 127 secs apt-get - 15 secs Change-Id: I66140726617450cd9fe9b702092cacf053a20065
1 parent 63b7d7b commit 2ca8af4

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

functions

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,9 @@ CURL_GET="${CURL_GET:-curl -g}"
357357
function wait_for_service {
358358
local timeout=$1
359359
local url=$2
360+
time_start "wait_for_service"
360361
timeout $timeout sh -c "while ! $CURL_GET -k --noproxy '*' -s $url >/dev/null; do sleep 1; done"
362+
time_stop "wait_for_service"
361363
}
362364

363365

functions-common

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,7 @@ function git_timed {
597597
timeout=${GIT_TIMEOUT}
598598
fi
599599

600+
time_start "git_timed"
600601
until timeout -s SIGINT ${timeout} git "$@"; do
601602
# 124 is timeout(1)'s special return code when it reached the
602603
# timeout; otherwise assume fatal failure
@@ -611,6 +612,7 @@ function git_timed {
611612
fi
612613
sleep 5
613614
done
615+
time_stop "git_timed"
614616
}
615617

616618
# git update using reference as a branch.
@@ -1373,6 +1375,7 @@ function run_process {
13731375
local command="$2"
13741376
local group=$3
13751377

1378+
time_start "run_process"
13761379
if is_service_enabled $service; then
13771380
if [[ "$USE_SCREEN" = "True" ]]; then
13781381
screen_process "$service" "$command" "$group"
@@ -1381,6 +1384,7 @@ function run_process {
13811384
_run_process "$service" "$command" "$group" &
13821385
fi
13831386
fi
1387+
time_stop "run_process"
13841388
}
13851389

13861390
# Helper to launch a process in a named screen
@@ -2196,9 +2200,11 @@ function test_with_retry {
21962200
local until=${3:-10}
21972201
local sleep=${4:-0.5}
21982202

2203+
time_start "test_with_retry"
21992204
if ! timeout $until sh -c "while ! $testcmd; do sleep $sleep; done"; then
22002205
die $LINENO "$failmsg"
22012206
fi
2207+
time_stop "test_with_retry"
22022208
}
22032209

22042210
# Timing infrastructure - figure out where large blocks of time are

lib/apache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,11 @@ function restart_apache_server {
185185
# Apache can be slow to stop, doing an explicit stop, sleep, start helps
186186
# to mitigate issues where apache will claim a port it's listening on is
187187
# still in use and fail to start.
188+
time_start "restart_apache_server"
188189
stop_service $APACHE_NAME
189190
sleep 3
190191
start_service $APACHE_NAME
192+
time_stop "restart_apache_server"
191193
}
192194

193195
# Restore xtrace

0 commit comments

Comments
 (0)