diff --git a/manticore/core/executor.py b/manticore/core/executor.py index c47b9af..7b0c828 100644 --- a/manticore/core/executor.py +++ b/manticore/core/executor.py @@ -87,6 +87,15 @@ class ProfilingResults(object): elif func_file.endswith('solver.py') and 'setstate' not in func_name and 'getstate' not in func_name and 'ckl' not in func_name: self.solver_time += func_time + def __str__(self): + return '\n'.join([ "Total time: {} seconds".format(self.time_elapsed), + "Total instructions executed: {}".format(self.instructions_executed), + "Average instructions per second: {}".format(self.instructions_executed / self.time_elapsed), + "Time spent loading states: {} seconds".format(self.loading_time), + "Time spent saving states: {} seconds".format(self.saving_time), + "Time spent in solver: {} seconds".format(self.solver_time)]) + + class Executor(object): ''' The executor guides the execution of a single state, handles state forking diff --git a/manticore/utils/helpers.py b/manticore/utils/helpers.py index 4babfdd..51697f4 100644 --- a/manticore/utils/helpers.py +++ b/manticore/utils/helpers.py @@ -40,4 +40,3 @@ class memoized(object): def __get__(self, obj, objtype): '''Support instance methods.''' return functools.partial(self.__call__, obj) - diff --git a/scripts/benchmark.py b/scripts/benchmark.py index 169d53a..b5ca048 100644 --- a/scripts/benchmark.py +++ b/scripts/benchmark.py @@ -2,12 +2,8 @@ from manticore import Manticore from sys import argv, exit def display(results): - print " Total time: {} seconds".format(results.time_elapsed) - print " Total instructions executed: {}".format(results.instructions_executed) - print " Average instructions per second: {}".format(results.instructions_executed / results.time_elapsed) - print " Time spent loading states: {} seconds".format(results.loading_time) - print " Time spent saving states: {} seconds".format(results.saving_time) - print " Time spent in solver: {} seconds".format(results.solver_time) + for line in str(results).split('\n'): + print " " + line def benchmark(program): print "[*] Benchmarking program \"{}\"".format(program)