@@ -215,7 +215,7 @@ package main;
215215# Activate debug variables
216216# if ( $opt{debug} ne '' ) { $opt{debug} = 2; }
217217# Activate experimental calculations and analysis
218- # if ( $opt{experimental} ne '' ) { $opt{experimental} = 1; }
218+ # if ( $opt{experimental} ne '' ) { $opt{experimental} = 1; }
219219
220220# check if we need to enable verbose mode
221221if ( $opt {feature } ne ' ' ) { $opt {verbose } = 1; }
@@ -595,7 +595,8 @@ sub os_setup {
595595 chomp ($physical_memory );
596596 chomp ($swap_memory );
597597 chomp ($os );
598- $physical_memory =$opt {forcemem } if (defined ($opt {forcemem }) and $opt {forcemem } gt 0);
598+ $physical_memory = $opt {forcemem }
599+ if ( defined ( $opt {forcemem } ) and $opt {forcemem } gt 0 );
599600 $result {' OS' }{' OS Type' } = $os ;
600601 $result {' OS' }{' Physical Memory' }{' bytes' } = $physical_memory ;
601602 $result {' OS' }{' Physical Memory' }{' pretty' } = hr_bytes($physical_memory );
@@ -2055,27 +2056,28 @@ sub system_recommendations {
20552056 infoprint " User process except mysqld used "
20562057 . hr_bytes_rnd($omem ) . " RAM." ;
20572058 if ( ( 0.15 * $physical_memory ) < $omem ) {
2058- if ( $opt {nondedicated }) {
2059- infoprint " No warning with --nondedicated option" ;
2060- infoprint
2059+ if ( $opt {nondedicated } ) {
2060+ infoprint " No warning with --nondedicated option" ;
2061+ infoprint
20612062" Other user process except mysqld used more than 15% of total physical memory "
2062- . percentage( $omem , $physical_memory ) . " % ("
2063- . hr_bytes_rnd($omem ) . " / "
2064- . hr_bytes_rnd($physical_memory ) . " )" ;
2065- } else {
2063+ . percentage( $omem , $physical_memory ) . " % ("
2064+ . hr_bytes_rnd($omem ) . " / "
2065+ . hr_bytes_rnd($physical_memory ) . " )" ;
2066+ }
2067+ else {
20662068
2067- badprint
2069+ badprint
20682070" Other user process except mysqld used more than 15% of total physical memory "
2069- . percentage( $omem , $physical_memory ) . " % ("
2070- . hr_bytes_rnd($omem ) . " / "
2071- . hr_bytes_rnd($physical_memory ) . " )" ;
2072- push ( @generalrec ,
2071+ . percentage( $omem , $physical_memory ) . " % ("
2072+ . hr_bytes_rnd($omem ) . " / "
2073+ . hr_bytes_rnd($physical_memory ) . " )" ;
2074+ push ( @generalrec ,
20732075" Consider stopping or dedicate server for additional process other than mysqld."
2074- );
2075- push ( @adjvars ,
2076+ );
2077+ push ( @adjvars ,
20762078" DON'T APPLY SETTINGS BECAUSE THERE ARE TOO MANY PROCESSES RUNNING ON THIS SERVER. OOM KILL CAN OCCUR!"
2077- );
2078- }
2079+ );
2080+ }
20792081 }
20802082 else {
20812083 infoprint
@@ -3234,12 +3236,14 @@ sub calculations {
32343236 $mystat {' Innodb_buffer_pool_pages_total' }
32353237 ) if defined $mystat {' Innodb_buffer_pool_pages_total' };
32363238
3237- my $lreq = " select ROUND( 100* sum(allocated)/ " .
3238- $myvar {' innodb_buffer_pool_size' } .
3239- ' ,1) FROM sys.x\$innodb_buffer_stats_by_table;' ;
3240- debugprint(" lreq: $lreq " );
3241- $mycalc {' innodb_buffer_alloc_pct' } = select_one( $lreq )
3242- if ($opt {experimental });
3239+ my $lreq =
3240+ " select ROUND( 100* sum(allocated)/ "
3241+ . $myvar {' innodb_buffer_pool_size' }
3242+ . ' ,1) FROM sys.x\$innodb_buffer_stats_by_table;' ;
3243+ debugprint(" lreq: $lreq " );
3244+ $mycalc {' innodb_buffer_alloc_pct' } = select_one($lreq )
3245+ if ( $opt {experimental } );
3246+
32433247 # Binlog Cache
32443248 if ( $myvar {' log_bin' } ne ' OFF' ) {
32453249 $mycalc {' pct_binlog_cache' } = percentage(
@@ -3379,22 +3383,25 @@ sub mysql_stats {
33793383 . " ($mycalc {'pct_max_physical_memory'}% of installed RAM)" ;
33803384 }
33813385
3382-
33833386 if ( $physical_memory <
3384- ( $mycalc {' max_peak_memory' } + get_other_process_memory() ) )
3387+ ( $mycalc {' max_peak_memory' } + get_other_process_memory() ) )
33853388 {
3386- if ( $opt {nondedicated }) {
3387- infoprint " No warning with --nondedicated option" ;
3388- infoprint " Overall possible memory usage with other process exceeded memory" ;
3389- } else {
3390- badprint
3391- " Overall possible memory usage with other process exceeded memory" ;
3392- push ( @generalrec ,
3393- " Dedicate this server to your database for highest performance." );
3394- }
3395- } else {
3396- goodprint
3397- " Overall possible memory usage with other process is compatible with memory available" ;
3389+ if ( $opt {nondedicated } ) {
3390+ infoprint " No warning with --nondedicated option" ;
3391+ infoprint
3392+ " Overall possible memory usage with other process exceeded memory" ;
3393+ }
3394+ else {
3395+ badprint
3396+ " Overall possible memory usage with other process exceeded memory" ;
3397+ push ( @generalrec ,
3398+ " Dedicate this server to your database for highest performance."
3399+ );
3400+ }
3401+ }
3402+ else {
3403+ goodprint
3404+ " Overall possible memory usage with other process is compatible with memory available" ;
33983405 }
33993406
34003407 # Slow queries
@@ -6391,24 +6398,27 @@ sub mysql_innodb {
63916398 }
63926399
63936400 # select round( 100* sum(allocated)/( select VARIABLE_VALUE
6394- # FROM performance_schema .global_variables
6401+ # FROM information_schema .global_variables
63956402 # where VARIABLE_NAME='innodb_buffer_pool_size' )
63966403 # ,2) as "PCT ALLOC/BUFFER POOL"
63976404 # from sys.x$innodb_buffer_stats_by_table;
63986405
63996406 if ( $opt {experimental } ) {
6400- debugprint (' innodb_buffer_alloc_pct: "' .$mycalc {innodb_buffer_alloc_pct }.' "' );
6401- if (defined $mycalc {innodb_buffer_alloc_pct } and
6402- $mycalc {innodb_buffer_alloc_pct } ne ' ' ) {
6403- if ( $mycalc {innodb_buffer_alloc_pct } < 80 ) {
6404- badprint " Ratio Buffer Pool allocated / Buffer Pool Size: "
6405- . $mycalc {' innodb_buffer_alloc_pct' } . ' %' ;
6406- }
6407- else {
6408- goodprint " Ratio Buffer Pool allocated / Buffer Pool Size: "
6409- . $mycalc {' innodb_buffer_alloc_pct' } . ' %' ;
6407+ debugprint( ' innodb_buffer_alloc_pct: "'
6408+ . $mycalc {innodb_buffer_alloc_pct }
6409+ . ' "' );
6410+ if ( defined $mycalc {innodb_buffer_alloc_pct }
6411+ and $mycalc {innodb_buffer_alloc_pct } ne ' ' )
6412+ {
6413+ if ( $mycalc {innodb_buffer_alloc_pct } < 80 ) {
6414+ badprint " Ratio Buffer Pool allocated / Buffer Pool Size: "
6415+ . $mycalc {' innodb_buffer_alloc_pct' } . ' %' ;
6416+ }
6417+ else {
6418+ goodprint " Ratio Buffer Pool allocated / Buffer Pool Size: "
6419+ . $mycalc {' innodb_buffer_alloc_pct' } . ' %' ;
6420+ }
64106421 }
6411- }
64126422 }
64136423 if ( $mycalc {' innodb_log_size_pct' } < 20
64146424 or $mycalc {' innodb_log_size_pct' } > 30 )
@@ -6436,7 +6446,7 @@ sub mysql_innodb {
64366446 . $myvar {' innodb_log_files_in_group' } . " / "
64376447 . hr_bytes( $myvar {' innodb_buffer_pool_size' } )
64386448 . " should be equal to 25%" ;
6439- push (
6449+ push (
64406450 @adjvars ,
64416451 " innodb_log_file_size should be (="
64426452 . hr_bytes_rnd(
@@ -7229,8 +7239,8 @@ sub headerprint {
72297239 . " \t * Major Hayden <major\@ mhtx.net>\n "
72307240 . " >> Bug reports, feature requests, and downloads at http://mysqltuner.pl/\n "
72317241 . " >> Run with '--help' for additional options and output filtering" ;
7232- debugprint(" Debug: " . $opt {debug });
7233- debugprint(" Experimental: " . $opt {experimental });
7242+ debugprint( " Debug: " . $opt {debug } );
7243+ debugprint( " Experimental: " . $opt {experimental } );
72347244}
72357245
72367246sub string2file {
0 commit comments