def run(self, entryFunc, inputFile): args = {'EntryFunc': [entryFunc], 'input': [inputFile]} for name in args: self.args[name] = args[name] talos = Talos(self.args) countCases = {} for f in talos.RetCheckedFunc: #print f + ':' if f in self.sensitive_funcs: for BB in talos.RetCheckedFunc[f]: #print '\t', talos.get_name_for_BB(BB) if BB not in talos.ControlBBs: continue for edge in talos.ControlBBs[BB]: for B in talos.ControlBBs[BB][edge]: if B in talos.Callees: #print talos.Callees[B] in self.nsp_sp_funcs: if talos.Callees[B] in self.nsp_sp_funcs: #print '\t\t', talos.get_name_for_BB(B), talos.BB2CallerName(B), talos.BB2CalleeName(B) caller = talos.BB2CallerName(B) if caller in countCases: countCases[caller] += 1 else: countCases[caller] = 1 for f in countCases: print f, countCases[f]
def run_talos(prof, name): t = Talos(profile=prof, firefox=firefox, talos_dir='talos') results = [] for i in range(0, cycles): time.sleep(20) results.append(t.run_ts(cycles=1)[0]) rawWriter.writerow([name] + results) raw_file.flush() average = int(round(reduce(lambda x, y: int(x)+int(y), results) / cycles)) resultsWriter.writerow([name, average]) results_file.flush()
def test_addon_perf(): firefox = FirefoxRunner(binary='firefox/firefox') profile = Profile() profile.initialize(runner=firefox) t = Talos(profile=profile, firefox=firefox, talos_dir='talos') results = [] cycles = 10 for i in range(0, cycles): #time.sleep(10) results.append(t.run_ts(cycles=1)[0]) print results