old_contents: import datetime
  import logging
  import random
  import sys
  
  import riak.benchmark as benchmark
  
  from multiprocessing import cpu_count
  from riak import RiakClient
  
  # logger = logging.getLogger()
  # logger.level = logging.DEBUG
  # logger.addHandler(logging.StreamHandler(sys.stdout))
  
  epoch = datetime.datetime.utcfromtimestamp(0)
  onesec = datetime.timedelta(0, 1)
  
  rowcount = 32768
  batchsz = 32
  if rowcount % batchsz != 0:
      raise AssertionError('rowcount must be divisible by batchsz')
  
  weather = ['typhoon', 'hurricane', 'rain', 'wind', 'snow']
  rows = []
  keys = []
  for i in range(rowcount):
      ts = datetime.datetime(2016, 1, 1, 12, 0, 0) + \
          datetime.timedelta(seconds=i)
      family_idx = i % 4
      series_idx = i % 4
      family = 'hash{:d}'.format(family_idx)
      series = 'user{:d}'.format(series_idx)
      w = weather[i % len(weather)]
      temp = (i % 100) + random.random()
      row = [family, series, ts, w, temp]
      key = [family, series, ts]
      rows.append(row)
      keys.append(key)
  
  print("Benchmarking timeseries:")
  print("      CPUs: {0}".format(cpu_count()))
  print("      Rows: {0}".format(len(rows)))
  print()
  
  tbl = 'GeoCheckin'
  h = 'riak-test'
  n = [
      {'host': h, 'pb_port': 10017},
      {'host': h, 'pb_port': 10027},
      {'host': h, 'pb_port': 10037},
      {'host': h, 'pb_port': 10047}
  ]
  client = RiakClient(nodes=n, protocol='pbc', transport_options={'use_ttb': False})
  table = client.table(tbl)
  
  with benchmark.measure() as b:
      with b.report('populate'):
          for i in range(0, rowcount, batchsz):
              x = i
              y = i + batchsz
              r = rows[x:y]
              ts_obj = table.new(r)
              result = ts_obj.store()
              if result is not True:
                  raise AssertionError("expected success")
      with b.report('get'):
          for k in keys:
              ts_obj = client.ts_get(tbl, k)
              if ts_obj is None:
                  raise AssertionError("expected obj")
              if len(ts_obj.rows) != 1:
                  raise AssertionError("expected one row, got: %d" % len(tsobj.rows))
              row = ts_obj.rows[0]
              if len(row) != 5:
                  raise AssertionError("expected row to have five items")
  
new_contents: import datetime
  import logging
  import random
  import sys
  
  import riak.benchmark as benchmark
  
  from multiprocessing import cpu_count
  from riak import RiakClient
  
  # logger = logging.getLogger()
  # logger.level = logging.DEBUG
  # logger.addHandler(logging.StreamHandler(sys.stdout))
  
  # batch sizes 8, 16, 32, 64, 128, 256
  if len(sys.argv) != 3:
      raise AssertionError('first arg is batch size, second arg is true / false for use_ttb')
  
  rowcount = 32768
  batchsz = int(sys.argv[1])
  if rowcount % batchsz != 0:
      raise AssertionError('rowcount must be divisible by batchsz')
  use_ttb =  sys.argv[2].lower() == 'true'
  
  epoch = datetime.datetime.utcfromtimestamp(0)
  onesec = datetime.timedelta(0, 1)
  
  weather = ['typhoon', 'hurricane', 'rain', 'wind', 'snow']
  rows = []
  for i in range(rowcount):
      ts = datetime.datetime(2016, 1, 1, 12, 0, 0) + \
          datetime.timedelta(seconds=i)
      family_idx = i % batchsz
      series_idx = i % batchsz
      family = 'hash{:d}'.format(family_idx)
      series = 'user{:d}'.format(series_idx)
      w = weather[i % len(weather)]
      temp = (i % 100) + random.random()
      row = [family, series, ts, w, temp]
      key = [family, series, ts]
      rows.append(row)
  
  print("Benchmarking timeseries:")
  print("   Use TTB: {}".format(use_ttb))
  print("Batch Size: {}".format(batchsz))
  print("      CPUs: {}".format(cpu_count()))
  print("      Rows: {}".format(len(rows)))
  print()
  
  tbl = 'GeoCheckin'
  h = 'riak-test'
  n = [
      {'host': h, 'pb_port': 10017},
      {'host': h, 'pb_port': 10027},
      {'host': h, 'pb_port': 10037},
      {'host': h, 'pb_port': 10047},
      {'host': h, 'pb_port': 10057}
  ]
  client = RiakClient(nodes=n, protocol='pbc', transport_options={'use_ttb': use_ttb})
  table = client.table(tbl)
  
  with benchmark.measure() as b:
      for i in (1, 2, 3):
          with b.report('populate-%d' % i):
              for i in range(0, rowcount, batchsz):
                  x = i
                  y = i + batchsz
                  r = rows[x:y]
                  ts_obj = table.new(r)
                  result = ts_obj.store()
                  if result is not True:
                      raise AssertionError("expected success")
  
subject: Add args to benchmark program.