From 39eebd5dad935acc63211f62794786e3e9207e49 Mon Sep 17 00:00:00 2001 From: sssssssss0903 <2662810357@qq.com> Date: Tue, 10 Sep 2024 23:18:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E6=AF=8F=E6=AC=A1=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E4=BA=8B=E5=8A=A1=E5=BA=8F=E5=88=97=E6=97=B6=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=95=B4=E4=BD=93=E7=9A=84=E6=89=A7=E8=A1=8C=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dbtest/src/sqltest.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/dbtest/src/sqltest.cc b/src/dbtest/src/sqltest.cc index 644c9a9e..6b23b4fa 100644 --- a/src/dbtest/src/sqltest.cc +++ b/src/dbtest/src/sqltest.cc @@ -14,7 +14,7 @@ #include #include #include - +#include // Implement command-line argument parsing based on Google's gflags library DEFINE_string(db_type, "mysql", "data resource name, please see /etc/odbc.ini, such as mysql pg oracle ob tidb sqlserver crdb"); DEFINE_string(user, "test123", "username"); @@ -377,7 +377,8 @@ bool JobExecutor::ExecTestSequence(TestSequence& test_sequence, TestResultSet& t // remove the last commit at verification selct split_groups[thread_cnt-1].pop_back(); } - + // Start time for measuring the overall execution duration + auto start_time = std::chrono::high_resolution_clock::now(); // prepration phase for (auto& group : init_group) { // for (auto& txn_sql : group) { @@ -415,6 +416,14 @@ bool JobExecutor::ExecTestSequence(TestSequence& test_sequence, TestResultSet& t if(!outputter.WriteResultType(test_result_set.ResultType(), test_process_file)) { return false; } + // End time for measuring the overall execution duration + auto end_time = std::chrono::high_resolution_clock::now(); + std::chrono::duration elapsed = end_time - start_time; + + // Output execution time + std::string execution_time_info = "Transaction execution time: " + std::to_string(elapsed.count()) + " seconds"; + std::cout << execution_time_info << std::endl; + test_process << execution_time_info << std::endl; return true; }