#!/usr/bin/perl

use strict;
use DBI;

my $dbh=DBI->connect("dbi:mysql:dbname=mysql;host=localhost","root","password");

my $select=0;
my $modify=0;

my $sql="SHOW GLOBAL STATUS LIKE 'Com_%'";
my $sth=$dbh->prepare($sql) or die;
$sth->execute or die;
while(my ($key,$val)=$sth->fetchrow) {
  if($key eq "Com_select") { $select=$val; }
  if($key eq "Com_insert" || $key eq "Com_insert_select" ||
     $key eq "Com_replace" || $key eq "Com_replace_select" ||
     $key eq "Com_update" || $key eq "Com_update_multi" ||
     $key eq "Com_delete" || $key eq "Com_delete_multi") { $modify+=$val; }
}

print $select,"\n",$modify,"\n";
