Merge "Add 5 time measurement points"
This commit is contained in:
commit
c6dbfdeb6b
@ -357,7 +357,9 @@ CURL_GET="${CURL_GET:-curl -g}"
|
|||||||
function wait_for_service {
|
function wait_for_service {
|
||||||
local timeout=$1
|
local timeout=$1
|
||||||
local url=$2
|
local url=$2
|
||||||
|
time_start "wait_for_service"
|
||||||
timeout $timeout sh -c "while ! $CURL_GET -k --noproxy '*' -s $url >/dev/null; do sleep 1; done"
|
timeout $timeout sh -c "while ! $CURL_GET -k --noproxy '*' -s $url >/dev/null; do sleep 1; done"
|
||||||
|
time_stop "wait_for_service"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -597,6 +597,7 @@ function git_timed {
|
|||||||
timeout=${GIT_TIMEOUT}
|
timeout=${GIT_TIMEOUT}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
time_start "git_timed"
|
||||||
until timeout -s SIGINT ${timeout} git "$@"; do
|
until timeout -s SIGINT ${timeout} git "$@"; do
|
||||||
# 124 is timeout(1)'s special return code when it reached the
|
# 124 is timeout(1)'s special return code when it reached the
|
||||||
# timeout; otherwise assume fatal failure
|
# timeout; otherwise assume fatal failure
|
||||||
@ -611,6 +612,7 @@ function git_timed {
|
|||||||
fi
|
fi
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
|
time_stop "git_timed"
|
||||||
}
|
}
|
||||||
|
|
||||||
# git update using reference as a branch.
|
# git update using reference as a branch.
|
||||||
@ -1410,6 +1412,7 @@ function run_process {
|
|||||||
local command="$2"
|
local command="$2"
|
||||||
local group=$3
|
local group=$3
|
||||||
|
|
||||||
|
time_start "run_process"
|
||||||
if is_service_enabled $service; then
|
if is_service_enabled $service; then
|
||||||
if [[ "$USE_SCREEN" = "True" ]]; then
|
if [[ "$USE_SCREEN" = "True" ]]; then
|
||||||
screen_process "$service" "$command" "$group"
|
screen_process "$service" "$command" "$group"
|
||||||
@ -1418,6 +1421,7 @@ function run_process {
|
|||||||
_run_process "$service" "$command" "$group" &
|
_run_process "$service" "$command" "$group" &
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
time_stop "run_process"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Helper to launch a process in a named screen
|
# Helper to launch a process in a named screen
|
||||||
@ -2232,9 +2236,11 @@ function test_with_retry {
|
|||||||
local until=${3:-10}
|
local until=${3:-10}
|
||||||
local sleep=${4:-0.5}
|
local sleep=${4:-0.5}
|
||||||
|
|
||||||
|
time_start "test_with_retry"
|
||||||
if ! timeout $until sh -c "while ! $testcmd; do sleep $sleep; done"; then
|
if ! timeout $until sh -c "while ! $testcmd; do sleep $sleep; done"; then
|
||||||
die $LINENO "$failmsg"
|
die $LINENO "$failmsg"
|
||||||
fi
|
fi
|
||||||
|
time_stop "test_with_retry"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Timing infrastructure - figure out where large blocks of time are
|
# Timing infrastructure - figure out where large blocks of time are
|
||||||
|
@ -185,9 +185,11 @@ function restart_apache_server {
|
|||||||
# Apache can be slow to stop, doing an explicit stop, sleep, start helps
|
# Apache can be slow to stop, doing an explicit stop, sleep, start helps
|
||||||
# to mitigate issues where apache will claim a port it's listening on is
|
# to mitigate issues where apache will claim a port it's listening on is
|
||||||
# still in use and fail to start.
|
# still in use and fail to start.
|
||||||
|
time_start "restart_apache_server"
|
||||||
stop_service $APACHE_NAME
|
stop_service $APACHE_NAME
|
||||||
sleep 3
|
sleep 3
|
||||||
start_service $APACHE_NAME
|
start_service $APACHE_NAME
|
||||||
|
time_stop "restart_apache_server"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Restore xtrace
|
# Restore xtrace
|
||||||
|
Loading…
Reference in New Issue
Block a user