summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <sasha@mysql.sashanet.com>2001-04-09 18:25:06 -0600
committerunknown <sasha@mysql.sashanet.com>2001-04-09 18:25:06 -0600
commit2adea09e8e82abc3e66b295dd0315087a9326eb1 (patch)
treea8c6b25f1e220ac4f81e8ea33e154890297ca39b /mysql-test
parentd662fb2afa71068189cdb6b17fe52f31d66ba444 (diff)
downloadmariadb-git-2adea09e8e82abc3e66b295dd0315087a9326eb1.tar.gz
added gprof options
added a benchmark test for count(distinct) mysql-test/mysql-test-run.sh: u
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/mysql-test-run.sh28
-rw-r--r--mysql-test/r/bench_count_distinct.result2
-rw-r--r--mysql-test/t/bench_count_distinct.test12
3 files changed, 41 insertions, 1 deletions
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 401c0d31c7f..5bb005b60de 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -127,6 +127,9 @@ while test $# -gt 0; do
fi
DO_GCOV=1
;;
+ --gprof )
+ DO_GPROF=1
+ ;;
--gdb )
if [ x$BINARY_DIST = x1 ] ; then
$ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with -gdb option"
@@ -238,7 +241,10 @@ MYSQL_TEST="$MYSQL_TEST --no-defaults --socket=$MASTER_MYSOCK --database=$DB --u
GDB_MASTER_INIT=$MYSQL_TMP_DIR/gdbinit.master
GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave
GCOV_MSG=$MYSQL_TMP_DIR/mysqld-gcov.out
-GCOV_ERR=$MYSQL_TMP_DIR/mysqld-gcov.err
+GCOV_ERR=$MYSQL_TMP_DIR/mysqld-gcov.err
+GPROF_DIR=$MYSQL_TMP_DIR/gprof
+GPROF_MASTER=$GPROF_DIR/master.gprof
+GPROF_SLAVE=$GPROF_DIR/slave.gprof
TIMEFILE="$MYSQL_TMP_DIR/mysqltest-time"
SLAVE_MYSQLD=$MYSQLD #this can be changed later if we are doing gcov
@@ -324,6 +330,24 @@ mysql_install_db () {
return 0
}
+gprof_prepare ()
+{
+ rm -rf $GPROF_DIR
+ mkdir -p $GPROF_DIR
+}
+
+gprof_collect ()
+{
+ if [ -f $MASTER_MYDDIR/gmon.out ]; then
+ gprof $MYSQLD $MASTER_MYDDIR/gmon.out > $GPROF_MASTER
+ echo "Master execution profile has been saved in $GPROF_MASTER"
+ fi
+ if [ -f $SLAVE_MYDDIR/gmon.out ]; then
+ gprof $MYSQLD $SLAVE_MYDDIR/gmon.out > $GPROF_SLAVE
+ echo "Slave execution profile has been saved in $GPROF_SLAVE"
+ fi
+}
+
gcov_prepare () {
$FIND $BASEDIR -name \*.gcov \
-or -name \*.da | $XARGS $RM
@@ -663,6 +687,7 @@ run_testcase ()
[ "$DO_GCOV" -a ! -x "$GCOV" ] && error "No gcov found"
[ "$DO_GCOV" ] && gcov_prepare
+[ "$DO_GPROF" ] && gprof_prepare
# Ensure that no old mysqld test servers are running
if [ -z "$USE_RUNNING_SERVER" ]
@@ -722,5 +747,6 @@ report_stats
$ECHO
[ "$DO_GCOV" ] && gcov_collect # collect coverage information
+[ "$DO_GPROF" ] && gprof_collect # collect coverage information
exit 0
diff --git a/mysql-test/r/bench_count_distinct.result b/mysql-test/r/bench_count_distinct.result
new file mode 100644
index 00000000000..6265c146709
--- /dev/null
+++ b/mysql-test/r/bench_count_distinct.result
@@ -0,0 +1,2 @@
+count(distinct n)
+10000
diff --git a/mysql-test/t/bench_count_distinct.test b/mysql-test/t/bench_count_distinct.test
new file mode 100644
index 00000000000..20d80ff74a1
--- /dev/null
+++ b/mysql-test/t/bench_count_distinct.test
@@ -0,0 +1,12 @@
+drop table if exists t1;
+create table t1(n int not null, key(n));
+let $1=10000;
+while ($1)
+{
+ eval insert into t1 values($1);
+ eval insert into t1 values($1);
+ dec $1;
+}
+
+select count(distinct n) from t1;
+drop table t1;