def profile_execute(self, pstat_file=None):
pr = cProfile.Profile()
pr.enable()
exec_node_group(self)
pr.disable()
if pstat_file is not None:
pr.dump_stats(pstat_file)
s = io.StringIO()
sortby = 'cumulative'
ps = pstats.Stats(pr, stream=s)
ps.strip_dirs()
ps.sort_stats(sortby)
ps.print_stats()
text_name = self.name + " Profile"
if text_name in bpy.data.texts:
text = bpy.data.texts[text_name]
else:
text = bpy.data.texts.new(text_name)
text.from_string(s.getvalue())
评论列表
文章目录