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
| ... | ... |
@@ -357,7 +357,9 @@ CURL_GET="${CURL_GET:-curl -g}"
|
| 357 | 357 |
function wait_for_service {
|
| 358 | 358 |
local timeout=$1 |
| 359 | 359 |
local url=$2 |
| 360 |
+ time_start "wait_for_service" |
|
| 360 | 361 |
timeout $timeout sh -c "while ! $CURL_GET -k --noproxy '*' -s $url >/dev/null; do sleep 1; done" |
| 362 |
+ time_stop "wait_for_service" |
|
| 361 | 363 |
} |
| 362 | 364 |
|
| 363 | 365 |
|
| ... | ... |
@@ -597,6 +597,7 @@ function git_timed {
|
| 597 | 597 |
timeout=${GIT_TIMEOUT}
|
| 598 | 598 |
fi |
| 599 | 599 |
|
| 600 |
+ time_start "git_timed" |
|
| 600 | 601 |
until timeout -s SIGINT ${timeout} git "$@"; do
|
| 601 | 602 |
# 124 is timeout(1)'s special return code when it reached the |
| 602 | 603 |
# timeout; otherwise assume fatal failure |
| ... | ... |
@@ -611,6 +612,7 @@ function git_timed {
|
| 611 | 611 |
fi |
| 612 | 612 |
sleep 5 |
| 613 | 613 |
done |
| 614 |
+ time_stop "git_timed" |
|
| 614 | 615 |
} |
| 615 | 616 |
|
| 616 | 617 |
# git update using reference as a branch. |
| ... | ... |
@@ -1373,6 +1375,7 @@ function run_process {
|
| 1373 | 1373 |
local command="$2" |
| 1374 | 1374 |
local group=$3 |
| 1375 | 1375 |
|
| 1376 |
+ time_start "run_process" |
|
| 1376 | 1377 |
if is_service_enabled $service; then |
| 1377 | 1378 |
if [[ "$USE_SCREEN" = "True" ]]; then |
| 1378 | 1379 |
screen_process "$service" "$command" "$group" |
| ... | ... |
@@ -1381,6 +1384,7 @@ function run_process {
|
| 1381 | 1381 |
_run_process "$service" "$command" "$group" & |
| 1382 | 1382 |
fi |
| 1383 | 1383 |
fi |
| 1384 |
+ time_stop "run_process" |
|
| 1384 | 1385 |
} |
| 1385 | 1386 |
|
| 1386 | 1387 |
# Helper to launch a process in a named screen |
| ... | ... |
@@ -2196,9 +2200,11 @@ function test_with_retry {
|
| 2196 | 2196 |
local until=${3:-10}
|
| 2197 | 2197 |
local sleep=${4:-0.5}
|
| 2198 | 2198 |
|
| 2199 |
+ time_start "test_with_retry" |
|
| 2199 | 2200 |
if ! timeout $until sh -c "while ! $testcmd; do sleep $sleep; done"; then |
| 2200 | 2201 |
die $LINENO "$failmsg" |
| 2201 | 2202 |
fi |
| 2203 |
+ time_stop "test_with_retry" |
|
| 2202 | 2204 |
} |
| 2203 | 2205 |
|
| 2204 | 2206 |
# Timing infrastructure - figure out where large blocks of time are |
| ... | ... |
@@ -185,9 +185,11 @@ function restart_apache_server {
|
| 185 | 185 |
# Apache can be slow to stop, doing an explicit stop, sleep, start helps |
| 186 | 186 |
# to mitigate issues where apache will claim a port it's listening on is |
| 187 | 187 |
# still in use and fail to start. |
| 188 |
+ time_start "restart_apache_server" |
|
| 188 | 189 |
stop_service $APACHE_NAME |
| 189 | 190 |
sleep 3 |
| 190 | 191 |
start_service $APACHE_NAME |
| 192 |
+ time_stop "restart_apache_server" |
|
| 191 | 193 |
} |
| 192 | 194 |
|
| 193 | 195 |
# Restore xtrace |