2 Input for test_profile.py and test_cprofile.py.
4 IMPORTANT: This stuff is touchy. If you modify anything above the
5 test class you'll have to regenerate the stats by running the two
8 *ALL* NUMBERS in the expected output are relevant. If you change
9 the formatting of pstats, please don't just regenerate the expected
10 output without checking very carefully that not a single number has
16 # In order to have reproducible time, we simulate a timer in the global
17 # variable 'TICKS', which represents simulated time in milliseconds.
18 # (We can't use a helper function increment the timer since it would be
19 # included in the profile and would appear to consume all the time.)
27 # 1000 ticks total: 270 ticks local, 730 ticks in subfunctions
37 # 170 ticks total, 150 ticks local
38 # 3 primitive calls, 130, 20 and 20 ticks total
39 # including 116, 17, 17 ticks local
43 return mul(n
, factorial(n
-1))
57 # 300 ticks total: 20 ticks local, 260 ticks in subfunctions
70 helper2_indirect() # 70
75 # 30 ticks total: 29 ticks local, 1 tick in subfunctions
78 hasattr(C(), "foo") # 1
84 def helper2_indirect():
90 # 50 ticks local: 39 ticks local, 11 ticks in subfunctions
93 hasattr(C(), "bar") # 1
100 # 10 ticks total: 8 ticks local, 2 ticks in subfunctions
103 for i
in range(2): # 0
106 except AttributeError:
110 def __getattr__(self
, name
):