also add CSV output to pgbench
authorTomas Vondra <tomas@2ndquadrant.com>
Thu, 13 Oct 2016 13:39:10 +0000 (15:39 +0200)
committerTomas Vondra <tomas@2ndquadrant.com>
Mon, 27 Feb 2017 00:32:51 +0000 (01:32 +0100)
client/benchmarks/pgbench.py
client/settings.py

index 2ec38d558b3843e1baa9ad7a035015bddfa298c4..d92b2c7d116dd3ac8a361a8f2a4d4468b71ed43e 100644 (file)
@@ -185,7 +185,7 @@ class PgBench(object):
                return issues
 
 
-       def _run(self, duration, nclients=1, njobs=1, read_only=False, aggregate=True):
+       def _run(self, duration, nclients=1, njobs=1, read_only=False, aggregate=True, csv_queue):
                'run pgbench on the database (either a warmup or actual benchmark run)'
 
                args = ['pgbench', '-c', str(nclients), '-j', str(njobs), '-T', str(duration)]
@@ -216,10 +216,13 @@ class PgBench(object):
 
                r.update({'start' : start, 'end' : end})
 
+               if csv_queue:
+                       csv_queue.put([start, end, r['scale'], nclients, njobs, mode, duration, latency, tps])
+
                return r
 
 
-       def run_tests(self):
+       def run_tests(self, csv_queue):
                'execute the whole benchmark, including initialization, warmup and benchmark runs'
 
                # derive configuration for the CPU count / RAM size
@@ -240,12 +243,12 @@ class PgBench(object):
                                for clients in config['clients']:
 
                                        # read-only
-                                       r = self._run(self._duration, clients, clients, True)
+                                       r = self._run(self._duration, clients, clients, True, True, csv_queue)
                                        r.update({'run' : run})
                                        results.append(r)
 
                                        # read-write
-                                       r = self._run(self._duration, clients, clients, False)
+                                       r = self._run(self._duration, clients, clients, False, True, csv_queue)
                                        r.update({'run' : run})
                                        results.append(r)
 
index 4895f748805659dbf8f5dba57bb0f9dec8d75434..9ce8522f2e1aaf226c5bdda71ef6312061917f18 100644 (file)
@@ -31,7 +31,8 @@ OUTPUT_DIR = '/home/user/tmp/perf-output'
 #
 PGBENCH_CONFIG = {
        'runs' : 3,
-       'duration' : 60         # duration of per-client-count benchmark
+       'duration' : 60,        # duration of per-client-count benchmark
+       'csv' : False
 }
 
 # ignore missing file with local config