Browse Source

Merge pull request #4430 from benaadams/time-accuracy

Suggestion: Improve ENDTIME accuracy
Mike Smith 6 years ago
parent
commit
8aa9fe277d
4 changed files with 16 additions and 10 deletions
  1. 4 4
      toolset/utils/results.py
  2. 4 2
      toolset/wrk/concurrency.sh
  3. 4 2
      toolset/wrk/pipeline.sh
  4. 4 2
      toolset/wrk/query.sh

+ 4 - 4
toolset/utils/results.py

@@ -155,11 +155,11 @@ class Results:
                             if m != None:
                                 rawData['5xx'] = int(m.group(1))
                         if "STARTTIME" in line:
-                            m = re.search("[0-9]+", line)
-                            rawData["startTime"] = int(m.group(0))
+                            m = re.search("[0-9]+\.*[0-9]*", line)
+                            rawData["startTime"] = float(m.group(0))
                         if "ENDTIME" in line:
-                            m = re.search("[0-9]+", line)
-                            rawData["endTime"] = int(m.group(0))
+                            m = re.search("[0-9]+\.*[0-9]*", line)
+                            rawData["endTime"] = float(m.group(0))
                             test_stats = self.__parse_stats(
                                 framework_test, test_type,
                                 rawData["startTime"], rawData["endTime"], 1)

+ 4 - 2
toolset/wrk/concurrency.sh

@@ -28,8 +28,10 @@ echo " wrk -H 'Host: $server_host' -H 'Accept: $accept' -H 'Connection: keep-ali
 echo "---------------------------------------------------------"
 echo ""
 STARTTIME=$(date +"%s")
-wrk -H "Host: $server_host" -H "Accept: $accept" -H "Connection: keep-alive" --latency -d $duration -c $c --timeout 8 -t "$(($c>$max_threads?$max_threads:$c))" $url
+/usr/bin/time -o elapsed --format="%e" wrk -H "Host: $server_host" -H "Accept: $accept" -H "Connection: keep-alive" --latency -d $duration -c $c --timeout 8 -t "$(($c>$max_threads?$max_threads:$c))" $url
+ENDTIME=$(cat elapsed)
+ENDTIME=$(echo "$ENDTIME + $STARTTIME" | bc)
 echo "STARTTIME $STARTTIME"
-echo "ENDTIME $(date +"%s")"
+echo "ENDTIME $ENDTIME"
 sleep 2
 done

+ 4 - 2
toolset/wrk/pipeline.sh

@@ -28,8 +28,10 @@ echo " wrk -H 'Host: $server_host' -H 'Accept: $accept' -H 'Connection: keep-ali
 echo "---------------------------------------------------------"
 echo ""
 STARTTIME=$(date +"%s")
-wrk -H "Host: $server_host" -H "Accept: $accept" -H "Connection: keep-alive" --latency -d $duration -c $c --timeout 8 -t "$(($c>$max_threads?$max_threads:$c))" $url -s pipeline.lua -- $pipeline
+/usr/bin/time -o elapsed --format="%e" wrk -H "Host: $server_host" -H "Accept: $accept" -H "Connection: keep-alive" --latency -d $duration -c $c --timeout 8 -t "$(($c>$max_threads?$max_threads:$c))" $url -s pipeline.lua -- $pipeline
+ENDTIME=$(cat elapsed)
+ENDTIME=$(echo "$ENDTIME + $STARTTIME" | bc)
 echo "STARTTIME $STARTTIME"
-echo "ENDTIME $(date +"%s")"
+echo "ENDTIME $ENDTIME"
 sleep 2
 done

+ 4 - 2
toolset/wrk/query.sh

@@ -28,8 +28,10 @@ echo " wrk -H 'Host: $server_host' -H 'Accept: $accept' -H 'Connection: keep-ali
 echo "---------------------------------------------------------"
 echo ""
 STARTTIME=$(date +"%s")
-wrk -H "Host: $server_host" -H "Accept: $accept" -H "Connection: keep-alive" --latency -d $duration -c $max_concurrency --timeout 8 -t $max_threads "$url$c"
+/usr/bin/time -o elapsed --format="STARTTIME 0\nENDTIME %e" wrk -H "Host: $server_host" -H "Accept: $accept" -H "Connection: keep-alive" --latency -d $duration -c $max_concurrency --timeout 8 -t $max_threads "$url$c"
+ENDTIME=$(cat elapsed)
+ENDTIME=$(echo "$ENDTIME + $STARTTIME" | bc)
 echo "STARTTIME $STARTTIME"
-echo "ENDTIME $(date +"%s")"
+echo "ENDTIME $ENDTIME"
 sleep 2
 done