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.
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.
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
15
package GenTest::Reporter::MemoryUsage;
18
@ISA = qw(GenTest::Reporter);
22
use GenTest::Constants;
24
use GenTest::Reporter;
25
use GenTest::Executor::MySQL;
32
system('ps -Ffyl -p '.$reporter->serverInfo('pid'));
34
my $dsn = $reporter->dsn();
35
my $dbh = DBI->connect($dsn);
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')
44
say("Total_rows: $total_rows; total_data: $total_data; total_indexes: $total_indexes");
51
return REPORTER_TYPE_PERIODIC ;