def stop(self): self.wait_for_idle() logging.msg('stopping server for mysql\n') time.sleep(2) subprocess.call([self.mysqladmin(), '--user=root', 'shutdown']) self.server.wait() self.server = None
def after_each_test(self): iteration = len(self.test_history) used_time = self.test_history[-1].used_time() logging.msg('=== native iteration %d done === (%f) (%s)\n' % (iteration, used_time, os.getcwd())) f = open('timing', 'a') f.write('%f\n' % used_time) f.close()
def stop(self): p = psutil.Process(self.server.pid) while p.get_cpu_percent() > 5.0: time.sleep(1) logging.msg('stopping server for memcached_bug_127_training\n') os.kill(self.server.pid, signal.SIGINT) self.server.wait() self.server = None
def start(self): args, sio = self.input() cmd = [] if self.prefix != None: cmd.extend(self.prefix) cmd.extend(args) logging.msg('starting aget bug2\n') self.proc = subprocess.Popen(cmd)
def main(argv): if len(argv) < 1: logging.err(command_usage()) command = argv[0] logging.msg('performing command: %s ...\n' % command, 2) if valid_command(command): eval('__command_%s(argv[1:])' % command) else: logging.err(command_usage())
def verify(profiler, testcase): sinfo = static_info.StaticInfo() sinfo.load(profiler.knobs['sinfo_out']) iroot_db = iroot.iRootDB(sinfo) iroot_db.load(profiler.knobs['iroot_out']) if len(iroot_db.iroot_map) >= 40: logging.msg('iroot_db size mismatch\n') return False return True
def verify(profiler, testcase): sinfo = static_info.StaticInfo() sinfo.load(profiler.knobs['sinfo_out']) iroot_db = iroot.iRootDB(sinfo) iroot_db.load(profiler.knobs['iroot_out']) if len(iroot_db.iroot_map) > 19 or len(iroot_db.iroot_map) < 18: logging.msg('iroot_db size mismatch\n') return False return True
def main(argv): if len(argv) < 1: logging.err(command_usage()) suite = argv[0] logging.msg('performing regression: %s ...\n' % suite, 2) if valid_suite(suite): regression(suite, argv[1:]) else: logging.err(command_usage())
def issue(self): clients = [] ipt = self.input() for idx in range(len(ipt)): clients.append(Client(ipt[idx], self)) logging.msg('issuing requests for mysql\n') for i in range(len(clients)): clients[i].start() for i in range(len(clients)): clients[i].join()
def issue(self): clients = [] ipt, buf = self.input() for idx in range(len(ipt)): clients.append(Client(ipt[idx])) logging.msg('issuing requests for apache_bug_25520\n') for i in range(len(clients)): clients[i].start() for i in range(len(clients)): clients[i].join()
def verify(profiler, testcase): sinfo = static_info.StaticInfo() sinfo.load(profiler.knobs['sinfo_out']) iroot_db = iroot.iRootDB(sinfo) iroot_db.load(profiler.knobs['iroot_out']) for r in iroot_db.iroot_map.itervalues(): if r.idiom() == 4: logging.msg('idiom4 iroot should not be predicted\n') return False return True
def issue(self): clients = [] num_threads, client_indexes = self.input() for i in range(len(client_indexes)): clients.append(Client(client_indexes[i])) logging.msg('issueing requests for memcached_bug_127_training\n') for i in range(len(clients)): clients[i].start() for i in range(len(clients)): clients[i].join()
def issue(self): time.sleep(1) logging.msg('issuing requests for cnc_bug\n') del os.environ['CNC_SOCKET_HOST'] del os.environ['CNC_SCHEDULER'] os.environ['CNC_SOCKET_CLIENT'] = self.contact_string self.client = subprocess.Popen([self.ponger()]) self.client.wait() del os.environ['CNC_SOCKET_CLIENT'] self.retcode = self.server.wait() self.server = None self.client = None
def issue(self): clients = [] num_threads, client_indexes = self.input() for i in range(len(client_indexes)): clients.append(Client(client_indexes[i])) logging.msg('issuing requests for memcached_bug_127\n') self.mc = memcache.Client(['127.0.0.1:12345'], debug=0) self.mc.set('test', '0') for i in range(len(clients)): clients[i].start() for i in range(len(clients)): clients[i].join()
def __modify_memo_refine_candidate(options): if not os.path.exists(options.memo_in): return sinfo = static_info.StaticInfo() sinfo.load(options.sinfo_in) iroot_db = iroot.iRootDB(sinfo) iroot_db.load(options.iroot_in) memo_db = memo.Memo(sinfo, iroot_db) memo_db.load(options.memo_in) memo_db.refine_candidate() memo_db.save(options.memo_out) logging.msg('memo refine candidate done!\n')
def __modify_memo_mark_unexposed_failed(options): if not os.path.exists(options.memo_in): return sinfo = static_info.StaticInfo() sinfo.load(options.sinfo_in) iroot_db = iroot.iRootDB(sinfo) iroot_db.load(options.iroot_in) memo_db = memo.Memo(sinfo, iroot_db) memo_db.load(options.memo_in) memo_db.mark_unexposed_failed() memo_db.save(options.memo_out) logging.msg('memo mark unexposed failed done!\n')
def stop(self): p = psutil.Process(self.server.pid) while p.get_cpu_percent() > 5.0: time.sleep(1) time.sleep(1) stop_cmd = [] stop_cmd.append(self.bin()) stop_cmd.extend(['-k', 'stop']) logging.msg('stopping server for apache_bug_25520\n') subprocess.call(stop_cmd) self.server.wait() self.server = None
def start(self): uri_idx, num_calls = self.input_entry httperf_args = [] httperf_args.append(config.benchmark_home('httperf') + '/bin/httperf') httperf_args.append('--server=localhost') httperf_args.append('--port=8080') httperf_args.append('--uri=/test/%d.txt' % uri_idx) httperf_args.append('--num-calls=%d' % num_calls) httperf_args.append('--num-conns=1') logging.msg('client: uri_idx=%d, num_calls=%d\n' % (uri_idx, num_calls)) self.fnull = open(os.devnull, 'w') self.proc = subprocess.Popen(httperf_args, stdout=self.fnull, stderr=self.fnull)
def __modify_memo_input_change(options): if not os.path.exists(options.memo_in): return sinfo = static_info.StaticInfo() sinfo.load(options.sinfo_in) iroot_db = iroot.iRootDB(sinfo) iroot_db.load(options.iroot_in) memo_db = memo.Memo(sinfo, iroot_db) memo_db.load(options.memo_in) memo_db.clear_predicted_set() memo_db.clear_candidate_map() memo_db.save(options.memo_out) logging.msg('memo input change done!\n')
def verify(profiler, testcase): sinfo = static_info.StaticInfo() sinfo.load(profiler.knobs['sinfo_out']) iroot_db = iroot.iRootDB(sinfo) iroot_db.load(profiler.knobs['iroot_out']) if len(iroot_db.iroot_map) != 2: logging.msg('iroot_db size mismatch\n') return False for r in iroot_db.iroot_map.itervalues(): if not iroot_is_expected(r): logging.msg('iroot mismatch\n') return False return True
def verify(profiler, testcase): sinfo = static_info.StaticInfo() sinfo.load(profiler.knobs['sinfo_out']) iroot_db = iroot.iRootDB(sinfo) iroot_db.load(profiler.knobs['iroot_out']) if len(iroot_db.iroot_map) != 5: logging.msg('iroot_db size mismatch\n') return False for r in iroot_db.iroot_map.itervalues(): if not iroot_is_expected(r): logging.msg('iroot mismatch\n') return False return True
def start(self): logging.msg('starting server for cnc_bug\n') ipt = self.input() cmd = [] if self.prefix != None: cmd.extend(self.prefix) cmd.append(self.pinger()) cmd.extend(ipt) os.environ['CNC_SOCKET_HOST'] = '1' os.environ['CNC_SCHEDULER'] = 'TBB_QUEUE' self.server = subprocess.Popen(cmd, stdout=subprocess.PIPE) self.contact_string = self.wait_for_contact_string() logging.msg('contact string = %s\n' % self.contact_string)
def load(self, db_name): try: f = open(db_name, 'rb') self.proto.ParseFromString(f.read()) f.close() for image_proto in self.proto.image: image = Image(image_proto, self) self.image_map[image.id()] = image for inst_proto in self.proto.inst: inst = Inst(inst_proto, self) self.inst_map[inst.id()] = inst self.image_map[inst.image().id()].add_inst(inst) except IOError: logging.msg('static info not found\n')
def start(self): start_cmd = [] if self.prefix != None: start_cmd.extend(self.prefix) start_cmd.append(self.bin()) start_cmd.extend(['-k', 'start', '-D', 'ONE_PROCESS']) logging.msg('starting server for apache\n') self.server = subprocess.Popen(start_cmd) while not os.path.exists(self.pid_file()): time.sleep(1) p = psutil.Process(self.server.pid) while p.get_num_threads() != 4: time.sleep(1) time.sleep(1)
def start(self): num_threads, client_indexes = self.input() start_cmd = [] if self.prefix != None: start_cmd.extend(self.prefix) start_cmd.append(self.bin()) start_cmd.extend(['-p', '12345']) start_cmd.extend(['-t', str(num_threads)]) if os.getuid() == 0: start_cmd.extend(['-u', 'root']) logging.msg('starting server for memcached_bug_127_training\n') self.server = subprocess.Popen(start_cmd) p = psutil.Process(self.server.pid) while p.get_num_threads() < (num_threads + 2): time.sleep(1)
def start(self): start_cmd = [] if self.prefix != None: start_cmd.extend(self.prefix) start_cmd.append(self.bin()) start_cmd.extend(['-k', 'start', '-D', 'ONE_PROCESS']) ipt, buf = self.input() if buf == True: start_cmd.extend(['-f', self.conf_file()]) logging.msg('starting server for apache_bug_25520_training\n') self.server = subprocess.Popen(start_cmd) while not os.path.exists(self.pid_file()): time.sleep(1) p = psutil.Process(self.server.pid) while p.get_num_threads() != 4: time.sleep(1) time.sleep(1)
def verify(profiler, testcase): sinfo = static_info.StaticInfo() sinfo.load(profiler.knobs['sinfo_out']) iroot_db = iroot.iRootDB(sinfo) iroot_db.load(profiler.knobs['iroot_out']) num_idiom4_iroots = 0 for r in iroot_db.iroot_map.itervalues(): if r.idiom() == 4: num_idiom4_iroots += 1 if num_idiom4_iroots != 7: logging.msg('num idiom4 iroots mismatch\n') return False for r in iroot_db.iroot_map.itervalues(): if not iroot_is_expected(r): logging.msg('iroot mismatch\n') return False return True
def body(self): self.race_testcase.run() if self.race_testcase.is_fatal(): logging.msg('\n') logging.msg('---------------------------\n') self.race_testcase.log_stat() else: self.chess_testcase.run() logging.msg('\n') logging.msg('---------------------------\n') self.race_testcase.log_stat() self.chess_testcase.log_stat()
def body(self): self.profile_testcase.run() if self.profile_testcase.is_fatal(): logging.msg('\n') logging.msg('---------------------------\n') self.profile_testcase.log_stat() else: self.active_testcase.run() logging.msg('\n') logging.msg('---------------------------\n') self.profile_testcase.log_stat() self.active_testcase.log_stat()
def join(self): self.proc.wait() self.fnull.close() self.proc = None self.fnull = None logging.msg('client done\n')
def echo(suite, message): logging.msg('regression %s - %s\n' % (suite, message))
def log_stat(self): runs = len(self.test_history) used_time = self.used_time() logging.msg('%-15s %d\n' % ('race_runs', runs)) logging.msg('%-15s %f\n' % ('race_time', used_time))
def after_all_tests(self): if self.is_fatal(): logging.msg('race fatal error detected\n') else: logging.msg('race threshold reached\n')
def after_each_test(self): iteration = len(self.test_history) used_time = self.test_history[-1].used_time() logging.msg('=== race iteration %d done === (%f)\n' % (iteration, used_time))
def start(self): logging.msg('starting server for mysql\n') self.server = subprocess.Popen([self.mysqld_safe(), '--user=root']) self.wait_for_idle()