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.
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)
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):