1 """Test suite for the profile module."""
5 # In order to have reproducible time, we simulate a timer in the global
6 # variable 'ticks', which represents simulated time in milliseconds.
7 # (We can't use a helper function increment the timer since it would be
8 # included in the profile and would appear to consume all the time.)
14 prof
= profile
.Profile(timer
)
15 prof
.runctx("testfunc()", globals(), globals())
23 # 1000 ticks total: 400 ticks local, 600 ticks in subfunctions
32 # 300 ticks total: 40 ticks local, 260 ticks in subfunctions
50 # 30 ticks total: 29 ticks local, 1 tick in subfunctions
58 # 50 ticks local: 39 ticks local, 11 ticks in subfunctions
61 hasattr(C(), "bar") # 1
68 # 10 ticks total: 8 ticks local, 2 ticks in subfunctions
74 except AttributeError:
78 def __getattr__(self
, name
):
85 if __name__
== "__main__":