提交 5b24c9e5 authored 作者: Olivier Breuleux's avatar Olivier Breuleux

compatibility fix

上级 38f533d5
...@@ -149,7 +149,6 @@ class PerformLinker(Linker): ...@@ -149,7 +149,6 @@ class PerformLinker(Linker):
from collections import defaultdict
import time import time
class Stats: class Stats:
...@@ -180,12 +179,11 @@ class Profiler: ...@@ -180,12 +179,11 @@ class Profiler:
listed in ignore will not be timed. listed in ignore will not be timed.
""" """
self.ignore = ignore self.ignore = ignore
self.stats = defaultdict(Stats) self.stats = {}
self.started = {}
self.by_class = by_class self.by_class = by_class
def profile_env(self, f, env): def profile_env(self, f, env):
stats = self.stats['TOTAL'] stats = self.stats.setdefault('TOTAL', Stats())
n, t = stats.inc_ncalls, stats.inc_time n, t = stats.inc_ncalls, stats.inc_time
failed = False failed = False
...@@ -208,7 +206,7 @@ class Profiler: ...@@ -208,7 +206,7 @@ class Profiler:
entry = op.__class__ entry = op.__class__
else: else:
entry = op entry = op
stats = self.stats[entry] stats = self.stats.setdefault(entry, Stats())
n, t = stats.inc_ncalls, stats.inc_time n, t = stats.inc_ncalls, stats.inc_time
failed = False failed = False
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论