summaryrefslogtreecommitdiff
path: root/sql-bench/bench-init.pl.sh
diff options
context:
space:
mode:
authormonty@work.mysql.com <>2001-09-02 18:38:33 +0200
committermonty@work.mysql.com <>2001-09-02 18:38:33 +0200
commit447c18954e904e5770d64ae3b0817a16b9060b74 (patch)
tree4689ffbe50e97ce9a47deb58fa2b9e7decdfc6a8 /sql-bench/bench-init.pl.sh
parent102cabfe4acd9c78fe321829bd168342b3fbd68a (diff)
parent759cf54a9e70013d92fe18a84b3e4c56244de7da (diff)
downloadmariadb-git-447c18954e904e5770d64ae3b0817a16b9060b74.tar.gz
merge with 3.23.42
Diffstat (limited to 'sql-bench/bench-init.pl.sh')
-rw-r--r--sql-bench/bench-init.pl.sh31
1 files changed, 30 insertions, 1 deletions
diff --git a/sql-bench/bench-init.pl.sh b/sql-bench/bench-init.pl.sh
index adfa114f569..0c4b1cb1b6a 100644
--- a/sql-bench/bench-init.pl.sh
+++ b/sql-bench/bench-init.pl.sh
@@ -31,7 +31,7 @@
# $server Object for current server
# $limits Hash reference to limits for benchmark
-$benchmark_version="2.13";
+$benchmark_version="2.14";
use Getopt::Long;
require "$pwd/server-cfg" || die "Can't read Configuration file: $!\n";
@@ -295,6 +295,35 @@ sub do_query
die "\nError executing '$query':\n$DBI::errstr\n";
}
+#
+# Run a query X times
+#
+
+sub time_fetch_all_rows
+{
+ my($test_text,$result_text,$query,$dbh,$test_count)=@_;
+ my($i,$loop_time,$end_time,$count,$rows,$estimated);
+
+ print $test_text . "\n" if (defined($test_text));
+ $count=$rows=0;
+ $loop_time=new Benchmark;
+ for ($i=1 ; $i <= $test_count ; $i++)
+ {
+ $count++;
+ $rows+=fetch_all_rows($dbh,$query) or die $DBI::errstr;
+ $end_time=new Benchmark;
+ last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i,
+ $test_count));
+ }
+ $end_time=new Benchmark;
+ if ($estimated)
+ { print "Estimated time"; }
+ else
+ { print "Time"; }
+ print " for $result_text ($count:$rows) " .
+ timestr(timediff($end_time, $loop_time),"all") . "\n\n";
+}
+
#
# Handle estimated time of the server is too slow