Wrong table cache hit rate calculation #548
This commit is contained in:
parent
213211aecc
commit
2079639e6b
1 changed files with 11 additions and 9 deletions
|
@ -2739,7 +2739,9 @@ sub calculations {
|
||||||
# Table cache
|
# Table cache
|
||||||
if ( $mystat{'Opened_tables'} > 0 ) {
|
if ( $mystat{'Opened_tables'} > 0 ) {
|
||||||
$mycalc{'table_cache_hit_rate'} =
|
$mycalc{'table_cache_hit_rate'} =
|
||||||
int( $mystat{'Open_tables'} * 100 / $mystat{'Opened_tables'} );
|
#int( $mystat{'Open_tables'} * 100 / $mystat{'Opened_tables'} );
|
||||||
|
int( $mystat{'Table_open_cache_hits'} * 100 / ( $mystat{'Table_open_cache_hits'} + $mystat{'Table_open_cache_misses'} ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$mycalc{'table_cache_hit_rate'} = 100;
|
$mycalc{'table_cache_hit_rate'} = 100;
|
||||||
|
@ -3290,10 +3292,10 @@ sub mysql_stats {
|
||||||
if ( $mystat{'Open_tables'} > 0 ) {
|
if ( $mystat{'Open_tables'} > 0 ) {
|
||||||
if ( $mycalc{'table_cache_hit_rate'} < 20 ) {
|
if ( $mycalc{'table_cache_hit_rate'} < 20 ) {
|
||||||
badprint "Table cache hit rate: $mycalc{'table_cache_hit_rate'}% ("
|
badprint "Table cache hit rate: $mycalc{'table_cache_hit_rate'}% ("
|
||||||
. hr_num( $mystat{'Open_tables'} )
|
. hr_num( $mystat{'Table_open_cache_hits'} )
|
||||||
. " open / "
|
. " hits / "
|
||||||
. hr_num( $mystat{'Opened_tables'} )
|
. hr_num( $mystat{'Table_open_cache_hits'} + $mystat{'Table_open_cache_misses'} )
|
||||||
. " opened)";
|
. " requests)";
|
||||||
if ( mysql_version_ge( 5, 1 ) ) {
|
if ( mysql_version_ge( 5, 1 ) ) {
|
||||||
$table_cache_var = "table_open_cache";
|
$table_cache_var = "table_open_cache";
|
||||||
}
|
}
|
||||||
|
@ -3335,10 +3337,10 @@ sub mysql_stats {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
goodprint "Table cache hit rate: $mycalc{'table_cache_hit_rate'}% ("
|
goodprint "Table cache hit rate: $mycalc{'table_cache_hit_rate'}% ("
|
||||||
. hr_num( $mystat{'Open_tables'} )
|
. hr_num( $mystat{'Table_open_cache_hits'} )
|
||||||
. " open / "
|
. " hits / "
|
||||||
. hr_num( $mystat{'Opened_tables'} )
|
. hr_num( $mystat{'Table_open_cache_hits'} + $mystat{'Table_open_cache_misses'} )
|
||||||
. " opened)";
|
. " requests)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue