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
diff --git a/functions-common b/functions-common
index 1b01eef..023203d 100644
--- a/functions-common
+++ b/functions-common
@@ -597,6 +597,7 @@
timeout=${GIT_TIMEOUT}
fi
+ time_start "git_timed"
until timeout -s SIGINT ${timeout} git "$@"; do
# 124 is timeout(1)'s special return code when it reached the
# timeout; otherwise assume fatal failure
@@ -611,6 +612,7 @@
fi
sleep 5
done
+ time_stop "git_timed"
}
# git update using reference as a branch.
@@ -1373,6 +1375,7 @@
local command="$2"
local group=$3
+ time_start "run_process"
if is_service_enabled $service; then
if [[ "$USE_SCREEN" = "True" ]]; then
screen_process "$service" "$command" "$group"
@@ -1381,6 +1384,7 @@
_run_process "$service" "$command" "$group" &
fi
fi
+ time_stop "run_process"
}
# Helper to launch a process in a named screen
@@ -2196,9 +2200,11 @@
local until=${3:-10}
local sleep=${4:-0.5}
+ time_start "test_with_retry"
if ! timeout $until sh -c "while ! $testcmd; do sleep $sleep; done"; then
die $LINENO "$failmsg"
fi
+ time_stop "test_with_retry"
}
# Timing infrastructure - figure out where large blocks of time are