From 7dd218760b766b45ae3b70bd3d128c333deb3d50 Mon Sep 17 00:00:00 2001 From: Krzysztof Gibas Date: Fri, 21 Dec 2012 12:51:28 +0100 Subject: [PATCH 1/6] fix memory detection on FreeBSD --- mysqltuner.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysqltuner.pl b/mysqltuner.pl index f61881c..00f08a5 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -219,14 +219,14 @@ sub os_setup { } elsif ($os =~ /Darwin/) { $physical_memory = `sysctl -n hw.memsize` or memerror; $swap_memory = `sysctl -n vm.swapusage | awk '{print \$3}' | sed 's/\..*\$//'` or memerror; - } elsif ($os =~ /NetBSD|OpenBSD/) { + } elsif ($os =~ /NetBSD|OpenBSD|FreeBSD/) { $physical_memory = `sysctl -n hw.physmem` or memerror; if ($physical_memory < 0) { $physical_memory = `sysctl -n hw.physmem64` or memerror; } $swap_memory = `swapctl -l | grep '^/' | awk '{ s+= \$2 } END { print s }'` or memerror; } elsif ($os =~ /BSD/) { - $physical_memory = `sysctl -n hw.realmem`; + $physical_memory = `sysctl -n hw.realmem` or memerror; $swap_memory = `swapinfo | grep '^/' | awk '{ s+= \$2 } END { print s }'`; } elsif ($os =~ /SunOS/) { $physical_memory = `/usr/sbin/prtconf | grep Memory | cut -f 3 -d ' '` or memerror; From 409884e597ce7dee5b5fc738fe6e0a70f06d2102 Mon Sep 17 00:00:00 2001 From: Krzysztof Gibas Date: Fri, 21 Dec 2012 13:11:38 +0100 Subject: [PATCH 2/6] fix finding a 64bit architecture on FreeBSD --- mysqltuner.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysqltuner.pl b/mysqltuner.pl index 00f08a5..df3dde7 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -473,6 +473,9 @@ sub check_architecture { } elsif (`uname` =~ /AIX/ && `bootinfo -K` =~ /64/) { $arch = 64; goodprint "Operating on 64-bit architecture\n"; + } elsif (`uname` =~ /FreeBSD/ && `sysctl -b hw.machine_arch` =~ /64/) { + $arch = 64; + goodprint "Operating on 64-bit architecture\n"; } else { $arch = 32; if ($physical_memory > 2147483648) { From 1188149f32c02a8774b3b6fa00edfd2f5f197b63 Mon Sep 17 00:00:00 2001 From: Krzysztof Gibas Date: Fri, 21 Dec 2012 13:39:36 +0100 Subject: [PATCH 3/6] fixed finding a 64bit architecture on NetBSD/OpenBSD and FreeBSD --- mysqltuner.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysqltuner.pl b/mysqltuner.pl index df3dde7..9414ee6 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -473,6 +473,9 @@ sub check_architecture { } elsif (`uname` =~ /AIX/ && `bootinfo -K` =~ /64/) { $arch = 64; goodprint "Operating on 64-bit architecture\n"; + } elsif (`uname` =~ /NetBSD|OpenBSD/ && `sysctl -b hw.machine` =~ /64/) { + $arch = 64; + goodprint "Operating on 64-bit architecture\n"; } elsif (`uname` =~ /FreeBSD/ && `sysctl -b hw.machine_arch` =~ /64/) { $arch = 64; goodprint "Operating on 64-bit architecture\n"; From 4b95c66d3354911adb61d6b3ed1ec57a1b78594b Mon Sep 17 00:00:00 2001 From: Krzysztof Gibas Date: Fri, 24 May 2013 19:11:08 +0200 Subject: [PATCH 4/6] added Darwin as 64bit architecture, as kaalis pointed out in https://github.com/rackerhacker/MySQLTuner-perl/pull/27#issuecomment-15450764 --- mysqltuner.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mysqltuner.pl b/mysqltuner.pl index 9414ee6..43ecab5 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -479,6 +479,14 @@ sub check_architecture { } elsif (`uname` =~ /FreeBSD/ && `sysctl -b hw.machine_arch` =~ /64/) { $arch = 64; goodprint "Operating on 64-bit architecture\n"; + # Darwin box.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:57:01 PDT 2009; root:xnu1228.15.4~1/RELEASE_PPC Power Macintosh + } elsif (uname =~ /Darwin/ && uname -m =~ /Power Macintosh/) { + $arch = 64; + goodprint "Operating on 64-bit architecture\n"; + # Darwin gibas.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64 + } elsif (uname =~ /Darwin/ && uname -m =~ /x86_64/) { + $arch = 64; + goodprint "Operating on 64-bit architecture\n"; } else { $arch = 32; if ($physical_memory > 2147483648) { From fffef5c7c227b019699c9e68aedb783fa157f916 Mon Sep 17 00:00:00 2001 From: Krzysztof Gibas Date: Fri, 24 May 2013 19:24:23 +0200 Subject: [PATCH 5/6] added Darwin as 64bit architecture, as kaalis pointed out in https://github.com/rackerhacker/MySQLTuner-perl/pull/27#issuecomment-15450764 --- mysqltuner.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysqltuner.pl b/mysqltuner.pl index 43ecab5..4b06322 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -479,14 +479,14 @@ sub check_architecture { } elsif (`uname` =~ /FreeBSD/ && `sysctl -b hw.machine_arch` =~ /64/) { $arch = 64; goodprint "Operating on 64-bit architecture\n"; - # Darwin box.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:57:01 PDT 2009; root:xnu1228.15.4~1/RELEASE_PPC Power Macintosh } elsif (uname =~ /Darwin/ && uname -m =~ /Power Macintosh/) { + # Darwin box.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:57:01 PDT 2009; root:xnu1228.15.4~1/RELEASE_PPC Power Macintosh $arch = 64; goodprint "Operating on 64-bit architecture\n"; - # Darwin gibas.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64 } elsif (uname =~ /Darwin/ && uname -m =~ /x86_64/) { + # Darwin gibas.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64 $arch = 64; - goodprint "Operating on 64-bit architecture\n"; + goodprint "Operating on 64-bit architecture\n"; } else { $arch = 32; if ($physical_memory > 2147483648) { From fda5bad78d211c7ef039abbd8dfd072528a91f70 Mon Sep 17 00:00:00 2001 From: Krzysztof Gibas Date: Fri, 24 May 2013 19:43:26 +0200 Subject: [PATCH 6/6] fixed uname execution syntax --- mysqltuner.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mysqltuner.pl b/mysqltuner.pl index 4b06322..3e50639 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -100,6 +100,9 @@ sub usage { " --port Port to use for connection (default: 3306)\n". " --user Username to use for authentication\n". " --pass Password to use for authentication\n". + " Database type\n". + " --mysql Run with mysql database (default)\n". + " --maria Run with mariadb database\n". "\n". " Performance and Reporting Options\n". " --skipsize Don't enumerate tables and their types/sizes (default: on)\n". @@ -479,14 +482,14 @@ sub check_architecture { } elsif (`uname` =~ /FreeBSD/ && `sysctl -b hw.machine_arch` =~ /64/) { $arch = 64; goodprint "Operating on 64-bit architecture\n"; - } elsif (uname =~ /Darwin/ && uname -m =~ /Power Macintosh/) { + } elsif (`uname` =~ /Darwin/ && `uname -m` =~ /Power Macintosh/) { # Darwin box.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:57:01 PDT 2009; root:xnu1228.15.4~1/RELEASE_PPC Power Macintosh $arch = 64; goodprint "Operating on 64-bit architecture\n"; - } elsif (uname =~ /Darwin/ && uname -m =~ /x86_64/) { + } elsif (`uname` =~ /Darwin/ && `uname -m` =~ /x86_64/) { # Darwin gibas.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64 $arch = 64; - goodprint "Operating on 64-bit architecture\n"; + goodprint "Operating on 64-bit architecture\n"; } else { $arch = 32; if ($physical_memory > 2147483648) {