我发现您可以执行以下操作:
prof = cProfile.Profile()retval = prof.runcall(self.method_actual, *args, **kwargs)prof.dump_stats(datafn)
缺点是它没有记录。

我发现您可以执行以下操作:
prof = cProfile.Profile()retval = prof.runcall(self.method_actual, *args, **kwargs)prof.dump_stats(datafn)
缺点是它没有记录。