summaryrefslogtreecommitdiff
path: root/mysql-test/lib
diff options
context:
space:
mode:
authorBjorn Munch <Bjorn.Munch@sun.com>2010-01-05 21:35:50 +0100
committerBjorn Munch <Bjorn.Munch@sun.com>2010-01-05 21:35:50 +0100
commitce019a2fac142fd0370c26e901218850cf36aeb5 (patch)
tree22016e52baac3f1dd315170a35985cecb43fffe0 /mysql-test/lib
parent4d8b228c8dd9ac6da7e895373bf029826d754279 (diff)
downloadmariadb-git-ce019a2fac142fd0370c26e901218850cf36aeb5.tar.gz
Bug #49345 re-introduce gprof to mysql-test-run.pl
Was available in v1 Porting to v2 required some rewriting Updated after review comments
Diffstat (limited to 'mysql-test/lib')
-rw-r--r--mysql-test/lib/mtr_gprof.pl45
1 files changed, 11 insertions, 34 deletions
diff --git a/mysql-test/lib/mtr_gprof.pl b/mysql-test/lib/mtr_gprof.pl
index f6615301dd7..5820a4007b8 100644
--- a/mysql-test/lib/mtr_gprof.pl
+++ b/mysql-test/lib/mtr_gprof.pl
@@ -20,43 +20,20 @@
use strict;
-# These are not to be prefixed with "mtr_"
+sub gprof_collect ($@) {
+ my ($exe_mysqld, @gprof_dirs)= @_;
-sub gprof_prepare ();
-sub gprof_collect ();
+ print ("Collecting gprof reports.....\n");
-##############################################################################
-#
-#
-#
-##############################################################################
-
-sub gprof_prepare () {
-
- rmtree($::opt_gprof_dir);
- mkdir($::opt_gprof_dir);
-}
-
-# FIXME what about master1 and slave1?!
-sub gprof_collect () {
-
- if ( -f "$::master->[0]->{'path_myddir'}/gmon.out" )
- {
- # FIXME check result code?!
- mtr_run("gprof",
- [$::exe_master_mysqld,
- "$::master->[0]->{'path_myddir'}/gmon.out"],
- $::opt_gprof_master, "", "", "");
- print "Master execution profile has been saved in $::opt_gprof_master\n";
- }
- if ( -f "$::slave->[0]->{'path_myddir'}/gmon.out" )
+ foreach my $datadir (@gprof_dirs)
{
- # FIXME check result code?!
- mtr_run("gprof",
- [$::exe_slave_mysqld,
- "$::slave->[0]->{'path_myddir'}/gmon.out"],
- $::opt_gprof_slave, "", "", "");
- print "Slave execution profile has been saved in $::opt_gprof_slave\n";
+ my $gprof_msg= "$datadir/gprof.msg";
+ my $gprof_err= "$datadir/gprof.err";
+ if ( -f "$datadir/gmon.out" )
+ {
+ system("gprof $exe_mysqld $datadir/gmon.out 2>$gprof_err >$gprof_msg");
+ print ("GPROF output in $gprof_msg, errors in $gprof_err\n");
+ }
}
}