mirror of
https://github.com/trailofbits/manticore.git
synced 2026-10-12 02:23:44 +00:00
* Add black to CI tests I'd rather have blackening be an optional check, but this will work for now * Yep, messed up Travis Again, sorry about the commit spam * Bump accepted line length to 120 Going to auto-format at 100 but will allow 20% overruns * Blacken * Cap line length at 100 rip my undisciplined coding habits * update black on the fly if necessary * Ignore CC errors * Only check modified files * Only python files * Re-blacken post merge * Re-Blacken * Fix deleted files * Explicitly invoke python The +x must not have gotten commited * Forgot to blacken again Hoisted on my own petard * Re-blacken
40 lines
887 B
Python
40 lines
887 B
Python
"""
|
|
Script used to profile Manticore runs.
|
|
"""
|
|
|
|
from __future__ import print_function
|
|
|
|
from sys import argv, exit
|
|
|
|
from manticore.native import Manticore
|
|
|
|
|
|
def profile(program, sort="cumulative"):
|
|
print(f'[*] Profiling program "{program}"')
|
|
|
|
m = Manticore(program)
|
|
m.run(should_profile=True)
|
|
|
|
stats = m.get_profiling_stats()
|
|
print(f"[*] Loaded profiling data.")
|
|
|
|
if stats is None:
|
|
print(f"[*] Failed to collect stats for program {program}")
|
|
return
|
|
|
|
stats.sort_stats(sort)
|
|
|
|
stats.print_stats()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if len(argv) != 2:
|
|
print(f"usage: python {argv[0]} PROGRAM [SORT_METHOD]")
|
|
print("The default SORT_METHOD is cumulative")
|
|
print(
|
|
"SORT_METHODs can be seen on https://docs.python.org/3/library/profile.html#pstats.Stats.sort_stats"
|
|
)
|
|
exit()
|
|
|
|
profile(argv[1])
|