diff options
author | Mark Wong | 2018-01-31 22:13:31 +0000 |
---|---|---|
committer | Mark Wong | 2018-01-31 22:13:31 +0000 |
commit | d4611000dbc8a44ec7b051d6d4dd47d2c37485c3 (patch) | |
tree | 0b55a455f4516bcaa244dec42d26677b2910318d | |
parent | a82347f5ce729c5a383308eb934d4f6bc926eeea (diff) |
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.
-rwxr-xr-x | client/perffarm-client.py | 5 | ||||
-rw-r--r-- | client/utils/misc.py | 13 |
2 files changed, 16 insertions, 2 deletions
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): |