Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_profile.py @ 79675:c0a2294de787 2.7
Issue #16199: Backport 2to3 typo fix from 3.2.
| author | Chris Jerdonek <chris.jerdonek@gmail.com> |
|---|---|
| date | Thu, 11 Oct 2012 16:15:46 -0700 |
| parents | b36cb4602e21 |
| children |
| rev | line source |
|---|---|
|
20238
e7aca2a302cd
Hopefully fix the profiler right. Add a test suite that checks that
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 """Test suite for the profile module.""" |
|
e7aca2a302cd
Hopefully fix the profiler right. Add a test suite that checks that
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
3 import sys |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
4 import pstats |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
5 import unittest |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
6 from StringIO import StringIO |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
7 from test.test_support import run_unittest |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
8 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
9 import profile |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
10 from test.profilee import testfunc, timer |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
11 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
12 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
13 class ProfileTest(unittest.TestCase): |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
14 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
15 profilerclass = profile.Profile |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
16 methodnames = ['print_stats', 'print_callers', 'print_callees'] |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
17 expected_output = {} |
|
54460
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
18 expected_list_sort_output = ':0(sort)' |
|
20238
e7aca2a302cd
Hopefully fix the profiler right. Add a test suite that checks that
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
19 |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
20 @classmethod |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
21 def do_profiling(cls): |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
22 results = [] |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
23 prof = cls.profilerclass(timer, 0.001) |
|
46474
5c43159f5ad0
Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents:
45181
diff
changeset
|
24 start_timer = timer() |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
25 prof.runctx("testfunc()", globals(), locals()) |
|
46474
5c43159f5ad0
Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents:
45181
diff
changeset
|
26 results.append(timer() - start_timer) |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
27 for methodname in cls.methodnames: |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
28 s = StringIO() |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
29 stats = pstats.Stats(prof, stream=s) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
30 stats.strip_dirs().sort_stats("stdname") |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
31 getattr(stats, methodname)() |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
32 results.append(s.getvalue()) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
33 return results |
|
20240
5c4261e74478
Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents:
20238
diff
changeset
|
34 |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
35 def test_cprofile(self): |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
36 results = self.do_profiling() |
|
46474
5c43159f5ad0
Some tests did not pass on repeated calls (regrtest -R::)
Amaury Forgeot d'Arc <amauryfa@gmail.com>
parents:
45181
diff
changeset
|
37 self.assertEqual(results[0], 1000) |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
38 for i, method in enumerate(self.methodnames): |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
39 self.assertEqual(results[i+1], self.expected_output[method], |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
40 "Stats.%s output for %s doesn't fit expectation!" % |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
41 (method, self.profilerclass.__name__)) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
42 |
|
54460
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
43 def test_calling_conventions(self): |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
44 # Issue #5330: profile and cProfile wouldn't report C functions called |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
45 # with keyword arguments. We test all calling conventions. |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
46 stmts = [ |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
47 "[].sort()", |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
48 "[].sort(reverse=True)", |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
49 "[].sort(*(None, None, True))", |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
50 "[].sort(**dict(reverse=True))", |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
51 ] |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
52 for stmt in stmts: |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
53 s = StringIO() |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
54 prof = self.profilerclass(timer, 0.001) |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
55 prof.runctx(stmt, globals(), locals()) |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
56 stats = pstats.Stats(prof, stream=s) |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
57 stats.print_stats() |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
58 res = s.getvalue() |
|
58460
17891566a478
use assert[Not]In where appropriate
Ezio Melotti <ezio.melotti@gmail.com>
parents:
54458
diff
changeset
|
59 self.assertIn(self.expected_list_sort_output, res, |
|
54460
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
60 "Profiling {0!r} didn't report list.sort:\n{1}".format(stmt, res)) |
|
114354b1e0e5
Merged revisions 73064-73065 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
46474
diff
changeset
|
61 |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
62 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
63 def regenerate_expected_output(filename, cls): |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
64 filename = filename.rstrip('co') |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
65 print 'Regenerating %s...' % filename |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
66 results = cls.do_profiling() |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
67 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
68 newfile = [] |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
69 with open(filename, 'r') as f: |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
70 for line in f: |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
71 newfile.append(line) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
72 if line[:6] == '#--cut': |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
73 break |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
74 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
75 with open(filename, 'w') as f: |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
76 f.writelines(newfile) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
77 for i, method in enumerate(cls.methodnames): |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
78 f.write('%s.expected_output[%r] = """\\\n%s"""\n' % ( |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
79 cls.__name__, method, results[i+1])) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
80 f.write('\nif __name__ == "__main__":\n main()\n') |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
81 |
| 36459 | 82 |
| 83 def test_main(): | |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
84 run_unittest(ProfileTest) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
85 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
86 def main(): |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
87 if '-r' not in sys.argv: |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
88 test_main() |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
89 else: |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
90 regenerate_expected_output(__file__, ProfileTest) |
|
20238
e7aca2a302cd
Hopefully fix the profiler right. Add a test suite that checks that
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
91 |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
92 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
93 # Don't remove this comment. Everything below it is auto-generated. |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
94 #--cut-------------------------------------------------------------------------- |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
95 ProfileTest.expected_output['print_stats'] = """\ |
|
66300
bc9dc7e7f373
Fix buildbot failures - removing the CPU term in the seconds from the output.
Senthil Kumaran <orsenthil@gmail.com>
parents:
58817
diff
changeset
|
96 127 function calls (107 primitive calls) in 999.749 seconds |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
97 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
98 Ordered by: standard name |
|
20238
e7aca2a302cd
Hopefully fix the profiler right. Add a test suite that checks that
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
99 |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
100 ncalls tottime percall cumtime percall filename:lineno(function) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
101 4 -0.004 -0.001 -0.004 -0.001 :0(append) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
102 4 -0.004 -0.001 -0.004 -0.001 :0(exc_info) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
103 12 -0.024 -0.002 11.964 0.997 :0(hasattr) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
104 8 -0.008 -0.001 -0.008 -0.001 :0(range) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
105 1 0.000 0.000 0.000 0.000 :0(setprofile) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
106 1 -0.002 -0.002 999.751 999.751 <string>:1(<module>) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
107 0 0.000 0.000 profile:0(profiler) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
108 1 -0.002 -0.002 999.749 999.749 profile:0(testfunc()) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
109 28 27.972 0.999 27.972 0.999 profilee.py:110(__getattr__) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
110 1 269.996 269.996 999.753 999.753 profilee.py:25(testfunc) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
111 23/3 149.937 6.519 169.917 56.639 profilee.py:35(factorial) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
112 20 19.980 0.999 19.980 0.999 profilee.py:48(mul) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
113 2 39.986 19.993 599.814 299.907 profilee.py:55(helper) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
114 4 115.984 28.996 119.964 29.991 profilee.py:73(helper1) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
115 2 -0.006 -0.003 139.942 69.971 profilee.py:84(helper2_indirect) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
116 8 311.976 38.997 399.896 49.987 profilee.py:88(helper2) |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
117 8 63.968 7.996 79.944 9.993 profilee.py:98(subhelper) |
| 36459 | 118 |
| 119 | |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
120 """ |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
121 ProfileTest.expected_output['print_callers'] = """\ |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
122 Ordered by: standard name |
|
20238
e7aca2a302cd
Hopefully fix the profiler right. Add a test suite that checks that
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
123 |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
124 Function was called by... |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
125 :0(append) <- profilee.py:73(helper1)(4) 119.964 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
126 :0(exc_info) <- profilee.py:73(helper1)(4) 119.964 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
127 :0(hasattr) <- profilee.py:73(helper1)(4) 119.964 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
128 profilee.py:88(helper2)(8) 399.896 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
129 :0(range) <- profilee.py:98(subhelper)(8) 79.944 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
130 :0(setprofile) <- profile:0(testfunc())(1) 999.749 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
131 <string>:1(<module>) <- profile:0(testfunc())(1) 999.749 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
132 profile:0(profiler) <- |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
133 profile:0(testfunc()) <- profile:0(profiler)(1) 0.000 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
134 profilee.py:110(__getattr__) <- :0(hasattr)(12) 11.964 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
135 profilee.py:98(subhelper)(16) 79.944 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
136 profilee.py:25(testfunc) <- <string>:1(<module>)(1) 999.751 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
137 profilee.py:35(factorial) <- profilee.py:25(testfunc)(1) 999.753 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
138 profilee.py:35(factorial)(20) 169.917 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
139 profilee.py:84(helper2_indirect)(2) 139.942 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
140 profilee.py:48(mul) <- profilee.py:35(factorial)(20) 169.917 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
141 profilee.py:55(helper) <- profilee.py:25(testfunc)(2) 999.753 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
142 profilee.py:73(helper1) <- profilee.py:55(helper)(4) 599.814 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
143 profilee.py:84(helper2_indirect) <- profilee.py:55(helper)(2) 599.814 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
144 profilee.py:88(helper2) <- profilee.py:55(helper)(6) 599.814 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
145 profilee.py:84(helper2_indirect)(2) 139.942 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
146 profilee.py:98(subhelper) <- profilee.py:88(helper2)(8) 399.896 |
|
20238
e7aca2a302cd
Hopefully fix the profiler right. Add a test suite that checks that
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
147 |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
148 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
149 """ |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
150 ProfileTest.expected_output['print_callees'] = """\ |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
151 Ordered by: standard name |
| 36459 | 152 |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
153 Function called... |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
154 :0(append) -> |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
155 :0(exc_info) -> |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
156 :0(hasattr) -> profilee.py:110(__getattr__)(12) 27.972 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
157 :0(range) -> |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
158 :0(setprofile) -> |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
159 <string>:1(<module>) -> profilee.py:25(testfunc)(1) 999.753 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
160 profile:0(profiler) -> profile:0(testfunc())(1) 999.749 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
161 profile:0(testfunc()) -> :0(setprofile)(1) 0.000 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
162 <string>:1(<module>)(1) 999.751 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
163 profilee.py:110(__getattr__) -> |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
164 profilee.py:25(testfunc) -> profilee.py:35(factorial)(1) 169.917 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
165 profilee.py:55(helper)(2) 599.814 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
166 profilee.py:35(factorial) -> profilee.py:35(factorial)(20) 169.917 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
167 profilee.py:48(mul)(20) 19.980 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
168 profilee.py:48(mul) -> |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
169 profilee.py:55(helper) -> profilee.py:73(helper1)(4) 119.964 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
170 profilee.py:84(helper2_indirect)(2) 139.942 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
171 profilee.py:88(helper2)(6) 399.896 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
172 profilee.py:73(helper1) -> :0(append)(4) -0.004 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
173 :0(exc_info)(4) -0.004 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
174 :0(hasattr)(4) 11.964 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
175 profilee.py:84(helper2_indirect) -> profilee.py:35(factorial)(2) 169.917 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
176 profilee.py:88(helper2)(2) 399.896 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
177 profilee.py:88(helper2) -> :0(hasattr)(8) 11.964 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
178 profilee.py:98(subhelper)(8) 79.944 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
179 profilee.py:98(subhelper) -> :0(range)(8) -0.008 |
|
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
180 profilee.py:110(__getattr__)(16) 27.972 |
|
20238
e7aca2a302cd
Hopefully fix the profiler right. Add a test suite that checks that
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
181 |
|
e7aca2a302cd
Hopefully fix the profiler right. Add a test suite that checks that
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
182 |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
183 """ |
|
20238
e7aca2a302cd
Hopefully fix the profiler right. Add a test suite that checks that
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
184 |
|
e7aca2a302cd
Hopefully fix the profiler right. Add a test suite that checks that
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
185 if __name__ == "__main__": |
|
45181
77b371c6958c
* Use the same code to profile for test_profile and test_cprofile.
Georg Brandl <georg@python.org>
parents:
36459
diff
changeset
|
186 main() |
