Skip to content

Commit

Permalink
Fixed an issue where the percentage of keys pulled from memory would …
Browse files Browse the repository at this point in the history
…not exist if no keys have been read since the server started. (Thanks to Simon Greenaway)
  • Loading branch information
major committed May 28, 2009
1 parent c4bb3c0 commit e425897
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mysqltuner.pl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
# Blair Christensen Hans du Plooy # Blair Christensen Hans du Plooy
# Victor Trac Everett Barnes # Victor Trac Everett Barnes
# Tom Krouper Gary Barrueto # Tom Krouper Gary Barrueto
# Simon Greenaway
# #
# Inspired by Matthew Montgomery's tuning-primer.sh script: # Inspired by Matthew Montgomery's tuning-primer.sh script:
# http://forge.mysql.com/projects/view.php?id=44 # http://forge.mysql.com/projects/view.php?id=44
Expand Down Expand Up @@ -542,6 +543,8 @@ sub calculations {
} }
if ($mystat{'Key_read_requests'} > 0) { if ($mystat{'Key_read_requests'} > 0) {
$mycalc{'pct_keys_from_mem'} = sprintf("%.1f",(100 - (($mystat{'Key_reads'} / $mystat{'Key_read_requests'}) * 100))); $mycalc{'pct_keys_from_mem'} = sprintf("%.1f",(100 - (($mystat{'Key_reads'} / $mystat{'Key_read_requests'}) * 100)));
} else {
$mycalc{'pct_keys_from_mem'} = 0;
} }
if ($doremote eq 0 and $mysqlvermajor < 5) { if ($doremote eq 0 and $mysqlvermajor < 5) {
$mycalc{'total_myisam_indexes'} = `find $myvar{'datadir'} -name '*.MYI' 2>&1 | xargs du -L $duflags '{}' 2>&1 | awk '{ s += \$1 } END { printf (\"%d\",s) }'`; $mycalc{'total_myisam_indexes'} = `find $myvar{'datadir'} -name '*.MYI' 2>&1 | xargs du -L $duflags '{}' 2>&1 | awk '{ s += \$1 } END { printf (\"%d\",s) }'`;
Expand Down

0 comments on commit e425897

Please sign in to comment.