~ubuntu-branches/ubuntu/saucy/drizzle/saucy-proposed

« back to all changes in this revision

Viewing changes to tests/kewpie/randgen/lib/GenTest/Reporter/MemoryUsage.pm

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# This program is free software; you can redistribute it and/or modify
 
2
# it under the terms of the GNU General Public License as published by
 
3
# the Free Software Foundation; version 2 of the License.
 
4
#
 
5
# This program is distributed in the hope that it will be useful, but
 
6
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
7
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
8
# General Public License for more details.
 
9
#
 
10
# You should have received a copy of the GNU General Public License
 
11
# along with this program; if not, write to the Free Software
 
12
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
 
13
# USA
 
14
 
 
15
package GenTest::Reporter::MemoryUsage;
 
16
 
 
17
require Exporter;
 
18
@ISA = qw(GenTest::Reporter);
 
19
 
 
20
use strict;
 
21
use GenTest;
 
22
use GenTest::Constants;
 
23
use GenTest::Result;
 
24
use GenTest::Reporter;
 
25
use GenTest::Executor::MySQL;
 
26
 
 
27
use DBI;
 
28
 
 
29
sub monitor {
 
30
        my $reporter = shift;
 
31
 
 
32
        system('ps -Ffyl -p '.$reporter->serverInfo('pid'));
 
33
 
 
34
        my $dsn = $reporter->dsn();
 
35
        my $dbh = DBI->connect($dsn);
 
36
 
 
37
        if (defined $dbh) {
 
38
                my ($total_rows, $total_data, $total_indexes) = $dbh->selectrow_array("
 
39
                        SELECT SUM(TABLE_ROWS) , SUM(DATA_LENGTH) , SUM(INDEX_LENGTH)
 
40
                        FROM INFORMATION_SCHEMA.TABLES
 
41
                        WHERE TABLE_SCHEMA NOT IN ('information_schema','mysql','performance_schema')
 
42
                ");
 
43
 
 
44
                say("Total_rows: $total_rows; total_data: $total_data; total_indexes: $total_indexes"); 
 
45
        }
 
46
 
 
47
        return STATUS_OK;
 
48
}
 
49
 
 
50
sub type {
 
51
        return REPORTER_TYPE_PERIODIC ;
 
52
}
 
53
 
 
54
1;