1# -*- cperl -*-
2# Copyright (c) 2004 MySQL AB, 2008 Sun Microsystems, Inc.
3# Use is subject to license terms.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; version 2 of the License.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1335  USA
17
18# This is a library file used by the Perl version of mysql-test-run,
19# and is part of the translation of the Bourne shell script with the
20# same name.
21
22use strict;
23
24# These are not to be prefixed with "mtr_"
25
26sub gprof_prepare ();
27sub gprof_collect ();
28
29##############################################################################
30#
31#
32#
33##############################################################################
34
35sub gprof_prepare () {
36
37  rmtree($::opt_gprof_dir);
38  mkdir($::opt_gprof_dir);
39}
40
41# FIXME what about master1 and slave1?!
42sub gprof_collect () {
43
44  if ( -f "$::master->[0]->{'path_myddir'}/gmon.out" )
45  {
46    # FIXME check result code?!
47    mtr_run("gprof",
48            [$::exe_master_mysqld,
49             "$::master->[0]->{'path_myddir'}/gmon.out"],
50            $::opt_gprof_master, "", "", "");
51    print "Master execution profile has been saved in $::opt_gprof_master\n";
52  }
53  if ( -f "$::slave->[0]->{'path_myddir'}/gmon.out" )
54  {
55    # FIXME check result code?!
56    mtr_run("gprof",
57            [$::exe_slave_mysqld,
58             "$::slave->[0]->{'path_myddir'}/gmon.out"],
59            $::opt_gprof_slave, "", "", "");
60    print "Slave execution profile has been saved in $::opt_gprof_slave\n";
61  }
62}
63
64
651;
66