diff options
author | Michael Widenius <monty@askmonty.org> | 2011-12-03 23:06:16 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-12-03 23:06:16 +0200 |
commit | 3e2cb35e11cb5ee6668d538a62a3b32e017944a5 (patch) | |
tree | d61d5066513fbbc9ad7944f6125c2636173a258d | |
parent | 921004e79dfece9bd4cc4239521b190c82f19560 (diff) | |
download | mariadb-git-3e2cb35e11cb5ee6668d538a62a3b32e017944a5.tar.gz |
Added handler and temporary table usage to mytop
Fixed prompt on reconnect in mysql client
client/mysql.cc:
Free server_version for reconnect.
This ensures that prompt is correct if reconnecting to a different server.
scripts/mytop.sh:
Added handler and temporary table usage
-rw-r--r-- | client/mysql.cc | 2 | ||||
-rwxr-xr-x | scripts/mytop.sh | 38 |
2 files changed, 38 insertions, 2 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 824a416ec36..765c44e49c9 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2780,6 +2780,8 @@ static int reconnect(void) } if (!connected) return put_info("Can't connect to the server\n",INFO_ERROR); + my_free(server_version,MYF(MY_ALLOW_ZERO_PTR)); + server_version= 0; /* purecov: end */ return 0; } diff --git a/scripts/mytop.sh b/scripts/mytop.sh index 5c88cf580a4..7cec85e2136 100755 --- a/scripts/mytop.sh +++ b/scripts/mytop.sh @@ -830,6 +830,11 @@ sub GetData() %OLD_STATUS = %STATUS; + # Set some status that may not exist in all versions + $STATUS{Handler_tmp_write}= 0; + $STATUS{Handler_tmp_update}= 0; + $STATUS{Rows_tmp_read}= 0; + foreach my $ref (@recs) { my $key = $ref->{Variable_name}; @@ -926,7 +931,7 @@ sub GetData() $lines_left--; - printf " Queries: %-6s qps: %4.0f Slow: %7s Se/In/Up/De(%%): %02.0f/%02.0f/%02.0f/%02.0f \n", + printf " Queries: %-6s qps: %4.0f Slow: %7s Se/In/Up/De(%%): %02.0f/%02.0f/%02.0f/%02.0f\n", make_short( $STATUS{Questions} ), # q total $STATUS{Questions} / $STATUS{Uptime}, # qps, average make_short( $STATUS{Slow_queries} ), # slow @@ -944,7 +949,7 @@ sub GetData() my $q_diff = ( $STATUS{Questions} - $OLD_STATUS{Questions} ); # print("q_diff: $STATUS{Questions} - $OLD_STATUS{Questions} / $t_delta = $q_diff\n"); - printf(" Sorts: %5.0f qps now: %4.0f Slow qps: %3.1f Threads: %4.0f (%4.0f/%4.0f) %02.0f/%02.0f/%02.0f/%02.0f \n", + printf(" Sorts: %5.0f qps now: %4.0f Slow qps: %3.1f Threads: %4.0f (%4.0f/%4.0f) %02.0f/%02.0f/%02.0f/%02.0f\n", ( $STATUS{Sort_rows} - $OLD_STATUS{Sort_rows} ) / $t_delta, ( $STATUS{Questions} - $OLD_STATUS{Questions} ) / $t_delta, ( # slow now (qps) @@ -1014,6 +1019,35 @@ sub GetData() } $lines_left--; + if ($t_delta) + { + printf(" Handler: (R/W/U/D) %5d/%5d/%5d/%5d Tmp: R/W/U: %5d/%5d/%5d\n", + ($STATUS{Handler_read_first}+$STATUS{Handler_read_key}+ + $STATUS{Handler_read_next}+$STATUS{Handler_read_prev}+ + $STATUS{Handler_read_rnd}+$STATUS{Handler_read_rnd_next} - + $OLD_STATUS{Handler_read_first}-$OLD_STATUS{Handler_read_key}- + $OLD_STATUS{Handler_read_next}-$OLD_STATUS{Handler_read_prev}- + $OLD_STATUS{Handler_read_rnd}- + $OLD_STATUS{Handler_read_rnd_next})/$t_delta, + ($STATUS{Handler_write} - $OLD_STATUS{Handler_write}) / + $t_delta, + ($STATUS{Handler_update} - $OLD_STATUS{Handler_update}) / + $t_delta, + ($STATUS{Handler_delete} - $OLD_STATUS{Handler_delete}) / + $t_delta, + ($STATUS{Rows_tmp_read} - $OLD_STATUS{Rows_tmp_read}) / + $t_delta, + ($STATUS{Handler_tmp_write} + -$OLD_STATUS{Handler_tmp_write})/$t_delta, + ($STATUS{Handler_tmp_update} - + $OLD_STATUS{Handler_tmp_update})/$t_delta); + } + else + { + print "\n"; + } + + $lines_left--; printf(" MyISAM Key Efficiency: %2.1f%% Bps in/out: %5s/%5s ", $cache_hits_percent, |