Move pretty printing into helpers (#299)
* move pretty printing into helpers * switch to using __str__
This commit is contained in:
parent
aa798c652e
commit
1f8c4e18c6
@ -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
|
||||
|
||||
@ -40,4 +40,3 @@ class memoized(object):
|
||||
def __get__(self, obj, objtype):
|
||||
'''Support instance methods.'''
|
||||
return functools.partial(self.__call__, obj)
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user