From: Mark Wong Date: Wed, 31 Jan 2018 22:13:31 +0000 (-0800) Subject: Add support for FreeBSD X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=d4611000dbc8a44ec7b051d6d4dd47d2c37485c3;p=pgperffarm.git Add support for FreeBSD The memory calculations for pgbench will need to be platform specific. Also the system data collection may have to be platform specific. Thus far, just added conditions so that things will run on FreeBSD now. --- diff --git a/client/perffarm-client.py b/client/perffarm-client.py index b04138d..90810e6 100755 --- a/client/perffarm-client.py +++ b/client/perffarm-client.py @@ -38,7 +38,10 @@ if __name__ == '__main__': collectors = MultiCollector() - collectors.register('system', LinuxCollector(OUTPUT_DIR)) + system = os.popen("uname").readlines()[0].split()[0] + if system == 'Linux': + collectors.register('system', LinuxCollector(OUTPUT_DIR)) + pg_collector = PostgresCollector(OUTPUT_DIR, dbname=DATABASE_NAME, bin_path=('%s/bin' % (BUILD_PATH))) collectors.register('postgres', pg_collector) diff --git a/client/utils/misc.py b/client/utils/misc.py index fa4e54c..05a5f8b 100644 --- a/client/utils/misc.py +++ b/client/utils/misc.py @@ -10,7 +10,18 @@ from tempfile import TemporaryFile def available_ram(): 'determine amount of RAM in the system (in megabytes)' - return int(os.popen("free -m").readlines()[1].split()[1]) + system = os.popen("uname").readlines()[0].split()[0] + + if system == 'FreeBSD': + mem = int(os.popen("sysctl hw.physmem").readlines()[0].split()[1]) + mem /= 1024 + mem /= 1024 + elif system == 'Linux': + mem = int(os.popen("free -m").readlines()[1].split()[1]) + else: + mem = 0 + + return mem def run_cmd(args, env=None, cwd=None):