def run_profiled(self, coeff_file=None, kgrid_tp="coarse", write_outputs=True):
profiler = cProfile.Profile()
profiler.runcall(lambda: self.run(coeff_file, kgrid_tp=kgrid_tp,
write_outputs=write_outputs))
stats = Stats(profiler, stream=STDOUT)
stats.strip_dirs()
stats.sort_stats('cumulative')
stats.print_stats(15) # only print the top 10 (10 slowest functions)
评论列表
文章目录