<commit_before>#!/usr/bin/env python

try:
  import matplotlib
  matplotlib.use('Agg')
  import pylab as plt
  do_plot = True
except ImportError:
  do_plot = False

import platform
import subprocess
import sys

DBS = ('ndb-proto1', 'ndb-proto2')
THREADS = (1, 2, 4, 8, 16, 24, 32, 40, 48)

def run_configuration(dbtype, nthreads):
  args = ['./ycsb', '--db-type', dbtype, '--num-threads', str(nthreads), '--num-keys', '1000000']
  p = subprocess.Popen(args, stdin=open('/dev/null', 'r'), stdout=subprocess.PIPE)
  r = p.stdout.read()
  p.wait()
  return float(r.strip())

if __name__ == '__main__':
  (_, outfile) = sys.argv
  if do_plot:
    print "matplotlib found, will draw plots"
  else:
    print "matplotlib not found"
  all_values = []
  for db in DBS:
    values = [run_configuration(db, n) for n in THREADS]
    all_values.append(values)
    print db, values
    if do_plot:
      plt.plot(THREADS, values)
  if do_plot:
    plt.xlabel('num threads')
    plt.ylabel('ops/sec')<commit_msg>runner<commit_after>#!/usr/bin/env python

try:
  import matplotlib
  matplotlib.use('Agg')
  import pylab as plt
  do_plot = True
except ImportError:
  do_plot = False

import platform
import subprocess
import sys

DBS = ('mysql', 'bdb', 'ndb-proto1', 'ndb-proto2')
THREADS = (1, 2, 4, 8, 16, 24, 32, 40, 48)

def run_configuration(basedir, dbtype, nthreads):
  args = ['./ycsb', '--basedir', basedir, '--db-type', dbtype, '--num-threads', str(nthreads), '--num-keys', '1000000']
  p = subprocess.Popen(args, stdin=open('/dev/null', 'r'), stdout=subprocess.PIPE)
  r = p.stdout.read()
  p.wait()
  return float(r.strip())

if __name__ == '__main__':
  (_, basedir, outfile) = sys.argv
  if do_plot:
    print "matplotlib found, will draw plots"
  else:
    print "matplotlib not found"
  all_values = []
  for db in DBS:
    values = [run_configuration(db, n) for n in THREADS]
    all_values.append(values)
    print db, values
    if do_plot:
      plt.plot(THREADS, values)
  if do_plot:
    plt.xlabel('num threads')
    plt.ylabel('ops/sec')
{'fraction_non_alphanumeric': 0.15647921760391198, 'fraction_numerical': 0.022493887530562348, 'mean_word_length': 3.618510158013544, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2088711', 'n_tokens_mistral': 826, 'n_tokens_neox': 785, 'n_words': 203}