コード例 #1
0
 def test_profiling_data(self):
     p = Profiler()
     self.m.verbosity(0)
     self.m.register_plugin(p)
     self.m.run()
     profile_path = os.path.join(self.m.workspace, "profiling.bin")
     with open(profile_path, "wb") as f:
         p.save_profiling_data(f)
     self.assertTrue(os.path.exists(profile_path))
     self.assertTrue(os.path.getsize(profile_path) > 0)
コード例 #2
0
def profile(program, sort="cumulative"):
    print(f'[*] Profiling program "{program}"')

    m = Manticore(program)
    profiler = Profiler()
    m.register_plugin(profiler)
    m.run()
    m.finalize()

    stats = profiler.get_profiling_data()
    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()