Browse code

Merge "Add 5 time measurement points"

Jenkins authored on 2016/01/06 04:24:10
Showing 3 changed files
... ...
@@ -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.
... ...
@@ -1410,6 +1412,7 @@ function run_process {
1410 1410
     local command="$2"
1411 1411
     local group=$3
1412 1412
 
1413
+    time_start "run_process"
1413 1414
     if is_service_enabled $service; then
1414 1415
         if [[ "$USE_SCREEN" = "True" ]]; then
1415 1416
             screen_process "$service" "$command" "$group"
... ...
@@ -1418,6 +1421,7 @@ function run_process {
1418 1418
             _run_process "$service" "$command" "$group" &
1419 1419
         fi
1420 1420
     fi
1421
+    time_stop "run_process"
1421 1422
 }
1422 1423
 
1423 1424
 # Helper to launch a process in a named screen
... ...
@@ -2232,9 +2236,11 @@ function test_with_retry {
2232 2232
     local until=${3:-10}
2233 2233
     local sleep=${4:-0.5}
2234 2234
 
2235
+    time_start "test_with_retry"
2235 2236
     if ! timeout $until sh -c "while ! $testcmd; do sleep $sleep; done"; then
2236 2237
         die $LINENO "$failmsg"
2237 2238
     fi
2239
+    time_stop "test_with_retry"
2238 2240
 }
2239 2241
 
2240 2242
 # 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