mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
added gprof options
added a benchmark test for count(distinct) mysql-test/mysql-test-run.sh: u
This commit is contained in:
@ -127,6 +127,9 @@ while test $# -gt 0; do
|
|||||||
fi
|
fi
|
||||||
DO_GCOV=1
|
DO_GCOV=1
|
||||||
;;
|
;;
|
||||||
|
--gprof )
|
||||||
|
DO_GPROF=1
|
||||||
|
;;
|
||||||
--gdb )
|
--gdb )
|
||||||
if [ x$BINARY_DIST = x1 ] ; then
|
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"
|
$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_MASTER_INIT=$MYSQL_TMP_DIR/gdbinit.master
|
||||||
GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave
|
GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave
|
||||||
GCOV_MSG=$MYSQL_TMP_DIR/mysqld-gcov.out
|
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"
|
TIMEFILE="$MYSQL_TMP_DIR/mysqltest-time"
|
||||||
SLAVE_MYSQLD=$MYSQLD #this can be changed later if we are doing gcov
|
SLAVE_MYSQLD=$MYSQLD #this can be changed later if we are doing gcov
|
||||||
|
|
||||||
@ -324,6 +330,24 @@ mysql_install_db () {
|
|||||||
return 0
|
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 () {
|
gcov_prepare () {
|
||||||
$FIND $BASEDIR -name \*.gcov \
|
$FIND $BASEDIR -name \*.gcov \
|
||||||
-or -name \*.da | $XARGS $RM
|
-or -name \*.da | $XARGS $RM
|
||||||
@ -663,6 +687,7 @@ run_testcase ()
|
|||||||
[ "$DO_GCOV" -a ! -x "$GCOV" ] && error "No gcov found"
|
[ "$DO_GCOV" -a ! -x "$GCOV" ] && error "No gcov found"
|
||||||
|
|
||||||
[ "$DO_GCOV" ] && gcov_prepare
|
[ "$DO_GCOV" ] && gcov_prepare
|
||||||
|
[ "$DO_GPROF" ] && gprof_prepare
|
||||||
|
|
||||||
# Ensure that no old mysqld test servers are running
|
# Ensure that no old mysqld test servers are running
|
||||||
if [ -z "$USE_RUNNING_SERVER" ]
|
if [ -z "$USE_RUNNING_SERVER" ]
|
||||||
@ -722,5 +747,6 @@ report_stats
|
|||||||
$ECHO
|
$ECHO
|
||||||
|
|
||||||
[ "$DO_GCOV" ] && gcov_collect # collect coverage information
|
[ "$DO_GCOV" ] && gcov_collect # collect coverage information
|
||||||
|
[ "$DO_GPROF" ] && gprof_collect # collect coverage information
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
2
mysql-test/r/bench_count_distinct.result
Normal file
2
mysql-test/r/bench_count_distinct.result
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
count(distinct n)
|
||||||
|
10000
|
12
mysql-test/t/bench_count_distinct.test
Normal file
12
mysql-test/t/bench_count_distinct.test
Normal file
@ -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;
|
Reference in New Issue
Block a user