This is an automated email from the ASF dual-hosted git repository.

gabriellee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 6c21df6324 [tools](tpch) run mode like clickbench (#19339)
6c21df6324 is described below

commit 6c21df6324ec3458507a556ef05edcb66a211159
Author: Dongyang Li <hello_step...@qq.com>
AuthorDate: Sat May 6 23:33:26 2023 +0800

    [tools](tpch) run mode like clickbench (#19339)
---
 tools/tpch-tools/bin/run-tpch-queries.sh | 53 +++++++++++++++++++++++---------
 1 file changed, 38 insertions(+), 15 deletions(-)

diff --git a/tools/tpch-tools/bin/run-tpch-queries.sh 
b/tools/tpch-tools/bin/run-tpch-queries.sh
index d437ea4ae6..282e815b11 100755
--- a/tools/tpch-tools/bin/run-tpch-queries.sh
+++ b/tools/tpch-tools/bin/run-tpch-queries.sh
@@ -91,7 +91,6 @@ echo "FE_HOST: ${FE_HOST}"
 echo "FE_QUERY_PORT: ${FE_QUERY_PORT}"
 echo "USER: ${USER}"
 echo "DB: ${DB}"
-echo "Time Unit: ms"
 
 run_sql() {
     echo "$*"
@@ -103,22 +102,46 @@ run_sql "show variables;"
 echo '============================================'
 run_sql "show table status;"
 echo '============================================'
+echo "Time Unit: ms"
 
-sum=0
+touch result.csv
+cold_run_sum=0
+best_hot_run_sum=0
 for i in $(seq 1 22); do
-    total=0
-    run=3
-    # Each query is executed ${run} times and takes the average time
-    for ((j = 0; j < run; j++)); do
-        start=$(date +%s%3N)
-        mysql -h"${FE_HOST}" -u "${USER}" -P"${FE_QUERY_PORT}" -D"${DB}" 
--comments <"${QUERIES_DIR}/q${i}.sql" >/dev/null
-        end=$(date +%s%3N)
-        total=$((total + end - start))
-    done
-    cost=$((total / run))
-    echo "q${i}: ${cost} ms"
-    sum=$((sum + cost))
+    cold=0
+    hot1=0
+    hot2=0
+
+    echo -ne "q${i}\t" | tee -a result.csv
+
+    start=$(date +%s%3N)
+    mysql -h"${FE_HOST}" -u "${USER}" -P"${FE_QUERY_PORT}" -D"${DB}" 
--comments <"${QUERIES_DIR}/q${i}.sql" >/dev/null
+    end=$(date +%s%3N)
+    cold=$((end - start))
+    echo -ne "${cold}\t" | tee -a result.csv
+
+    start=$(date +%s%3N)
+    mysql -h"${FE_HOST}" -u "${USER}" -P"${FE_QUERY_PORT}" -D"${DB}" 
--comments <"${QUERIES_DIR}/q${i}.sql" >/dev/null
+    end=$(date +%s%3N)
+    hot1=$((end - start))
+    echo -ne "${hot1}\t" | tee -a result.csv
+
+    start=$(date +%s%3N)
+    mysql -h"${FE_HOST}" -u "${USER}" -P"${FE_QUERY_PORT}" -D"${DB}" 
--comments <"${QUERIES_DIR}/q${i}.sql" >/dev/null
+    end=$(date +%s%3N)
+    hot2=$((end - start))
+    echo -ne "${hot2}" | tee -a result.csv
+
+    echo "" | tee -a result.csv
+
+    cold_run_sum=$((cold_run_sum + cold))
+    if [[ ${hot1} -lt ${hot2} ]]; then
+        best_hot_run_sum=$((best_hot_run_sum + hot1))
+    else
+        best_hot_run_sum=$((best_hot_run_sum + hot2))
+    fi
 done
-echo "Total cost: ${sum} ms"
 
+echo "Total cold run time: ${cold_run_sum} ms"
+echo "Total hot run time: ${best_hot_run_sum} ms"
 echo 'Finish tpch queries.'


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to