Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix memory detection on FreeBSD #26

Closed
wants to merge 12 commits into from
This page is out of date. Refresh to see the latest.
Showing with 92 additions and 2 deletions.
  1. +76 −0 index.html
  2. +16 −2 mysqltuner.pl
View
76 index.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset='utf-8'>
+
+ <title>rackerhacker/MySQLTuner-perl @ GitHub</title>
+
+ <style type="text/css">
+ body {
+ margin-top: 1.0em;
+ background-color: #FFFFFF;
+ font-family: Helvetica, Arial, FreeSans, san-serif;
+ color: #333333;
+ }
+ #container {
+ margin: 0 auto;
+ width: 700px;
+ }
+ h1 { font-size: 3.8em; color: #333333; margin-bottom: 3px; }
+ h1 .small { font-size: 0.4em; }
+/* h1 a { text-decoration: none }*/
+ h2 { font-size: 1.5em; color: #333333; }
+ h3 { text-align: center; color: #333333; }
+ a { color: #333333; }
+ .description { font-size: 1.2em; margin-bottom: 30px; margin-top: 30px; font-style: italic;}
+ .download { float: right; }
+ pre { background: #000; color: #fff; padding: 15px;}
+ hr { border: 0; width: 80%; border-bottom: 1px solid #aaa}
+ .footer { text-align:center; padding-top:30px; font-style: italic; }
+ </style>
+</head>
+
+<body>
+ <a href="http://github.com/rackerhacker/MySQLTuner-perl"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /></a>
+
+ <div id="container">
+
+ <div class="download">
+ <a href="http://github.com/rackerhacker/MySQLTuner-perl/zipball/master">
+ <img border="0" width="90" src="http://github.com/images/modules/download/zip.png"></a>
+ <a href="http://github.com/rackerhacker/MySQLTuner-perl/tarball/master">
+ <img border="0" width="90" src="http://github.com/images/modules/download/tar.png"></a>
+ </div>
+
+ <h1><a href="http://github.com/rackerhacker/MySQLTuner-perl">MySQLTuner-perl</a>
+ <span class="small">by <a href="http://github.com/rackerhacker">rackerhacker</a></span></h1>
+
+ <div class="description">
+ MySQLTuner is a script written in Perl that will assist you with your MySQL configuration and make recommendations for increased performance and stability.
+ </div>
+
+ <h2>Contact</h2>
+<p>Major Hayden (major@mhtx.net)
+<br/> </p>
+
+
+ <h2>Download</h2>
+ <p>
+ You can download this project in either
+ <a href="http://github.com/rackerhacker/MySQLTuner-perl/zipball/master">zip</a> or
+ <a href="http://github.com/rackerhacker/MySQLTuner-perl/tarball/master">tar</a> formats.
+ </p>
+ <p>You can also clone the project with <a href="http://git-scm.com">Git</a>
+ by running:
+ <pre>$ git clone git://github.com/rackerhacker/MySQLTuner-perl</pre>
+ </p>
+
+ <div class="footer">
+ get the source code on GitHub : <a href="http://github.com/rackerhacker/MySQLTuner-perl">rackerhacker/MySQLTuner-perl</a>
+ </div>
+
+ </div>
+
+
+</body>
+</html>
View
18 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;
@@ -473,6 +473,20 @@ 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";
+ } 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/) {
+ # 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";
} else {
$arch = 32;
if ($physical_memory > 2147483648) {
Something went wrong with that request. Please try again.