Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60568-60598,60600-60616 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60568 | christian.heimes | 2008-02-04 19:48:38 +0100 (Mon, 04 Feb 2008) | 1 line
Increase debugging to investige failing tests on some build bots
........
r60570 | christian.heimes | 2008-02-04 20:30:05 +0100 (Mon, 04 Feb 2008) | 1 line
Small adjustments for test compact freelist test. It's no passing on Windows as well.
........
r60573 | amaury.forgeotdarc | 2008-02-04 21:53:14 +0100 (Mon, 04 Feb 2008) | 2 lines
Correct quotes in NEWS file
........
r60575 | amaury.forgeotdarc | 2008-02-04 22:45:05 +0100 (Mon, 04 Feb 2008) | 13 lines
#1750076: Debugger did not step on every iteration of a while statement.
The mapping between bytecode offsets and source lines (lnotab) did not contain
an entry for the beginning of the loop.
Now it does, and the lnotab can be a bit larger:
in particular, several statements on the same line generate several entries.
However, this does not bother the settrace function, which will trigger only
one 'line' event.
The lnotab seems to be exactly the same as with python2.4.
........
r60584 | amaury.forgeotdarc | 2008-02-05 01:26:21 +0100 (Tue, 05 Feb 2008) | 3 lines
Change r60575 broke test_compile:
there is no need to emit co_lnotab item when both offsets are zeros.
........
r60587 | skip.montanaro | 2008-02-05 03:32:16 +0100 (Tue, 05 Feb 2008) | 1 line
sync with most recent version from python-mode sf project
........
r60588 | lars.gustaebel | 2008-02-05 12:51:40 +0100 (Tue, 05 Feb 2008) | 5 lines
Issue #2004: Use mode 0700 for temporary directories and default
permissions for missing directories.
(will backport to 2.5)
........
r60590 | georg.brandl | 2008-02-05 13:01:24 +0100 (Tue, 05 Feb 2008) | 2 lines
Convert external links to internal links. Fixes #2010.
........
r60592 | marc-andre.lemburg | 2008-02-05 15:50:40 +0100 (Tue, 05 Feb 2008) | 3 lines
Keep distutils Python 2.1 compatible (or even Python 2.4 in this case).
........
r60593 | andrew.kuchling | 2008-02-05 17:06:57 +0100 (Tue, 05 Feb 2008) | 5 lines
Update PEP URL.
(This code is duplicated between pydoc and DocXMLRPCServer; maybe it
should be refactored as a GHOP project.)
2.5.2 backport candidate.
........
r60596 | guido.van.rossum | 2008-02-05 18:32:15 +0100 (Tue, 05 Feb 2008) | 2 lines
In the experimental 'Scanner' feature, the group count was set wrong.
........
r60602 | facundo.batista | 2008-02-05 20:03:32 +0100 (Tue, 05 Feb 2008) | 3 lines
Issue 1951. Converts wave test cases to unittest.
........
r60603 | georg.brandl | 2008-02-05 20:07:10 +0100 (Tue, 05 Feb 2008) | 2 lines
Actually run the test.
........
r60604 | skip.montanaro | 2008-02-05 20:24:30 +0100 (Tue, 05 Feb 2008) | 2 lines
correct object name
........
r60605 | georg.brandl | 2008-02-05 20:58:17 +0100 (Tue, 05 Feb 2008) | 7 lines
* Use the same code to profile for test_profile and test_cprofile.
* Convert both to unittest.
* Use the same unit testing code.
* Include the expected output in both test files.
* Make it possible to regenerate the expected output by running
the file as a script with an '-r' argument.
........
r60613 | raymond.hettinger | 2008-02-06 02:49:00 +0100 (Wed, 06 Feb 2008) | 1 line
Sync-up with Py3k work.
........
r60614 | christian.heimes | 2008-02-06 13:44:34 +0100 (Wed, 06 Feb 2008) | 1 line
Limit free list of method and builtin function objects to 256 entries each.
........
r60616 | christian.heimes | 2008-02-06 14:33:44 +0100 (Wed, 06 Feb 2008) | 7 lines
Unified naming convention for free lists and their limits. All free lists
in Object/ are named ``free_list``, the counter ``numfree`` and the upper
limit is a macro ``PyName_MAXFREELIST`` inside an #ifndef block.
The chances should make it easier to adjust Python for platforms with
less memory, e.g. mobile phones.
........
2008-02-06 10:31:34 -04:00
|
|
|
"""
|
|
|
|
Input for test_profile.py and test_cprofile.py.
|
|
|
|
|
|
|
|
IMPORTANT: This stuff is touchy. If you modify anything above the
|
|
|
|
test class you'll have to regenerate the stats by running the two
|
|
|
|
test files.
|
|
|
|
|
|
|
|
*ALL* NUMBERS in the expected output are relevant. If you change
|
|
|
|
the formatting of pstats, please don't just regenerate the expected
|
|
|
|
output without checking very carefully that not a single number has
|
|
|
|
changed.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
# In order to have reproducible time, we simulate a timer in the global
|
|
|
|
# variable 'TICKS', which represents simulated time in milliseconds.
|
|
|
|
# (We can't use a helper function increment the timer since it would be
|
|
|
|
# included in the profile and would appear to consume all the time.)
|
|
|
|
TICKS = 42000
|
|
|
|
|
|
|
|
def timer():
|
|
|
|
return TICKS
|
|
|
|
|
|
|
|
def testfunc():
|
|
|
|
# 1 call
|
|
|
|
# 1000 ticks total: 270 ticks local, 730 ticks in subfunctions
|
|
|
|
global TICKS
|
|
|
|
TICKS += 99
|
|
|
|
helper() # 300
|
|
|
|
helper() # 300
|
|
|
|
TICKS += 171
|
|
|
|
factorial(14) # 130
|
|
|
|
|
|
|
|
def factorial(n):
|
|
|
|
# 23 calls total
|
|
|
|
# 170 ticks total, 150 ticks local
|
|
|
|
# 3 primitive calls, 130, 20 and 20 ticks total
|
|
|
|
# including 116, 17, 17 ticks local
|
|
|
|
global TICKS
|
|
|
|
if n > 0:
|
|
|
|
TICKS += n
|
|
|
|
return mul(n, factorial(n-1))
|
|
|
|
else:
|
|
|
|
TICKS += 11
|
|
|
|
return 1
|
|
|
|
|
|
|
|
def mul(a, b):
|
|
|
|
# 20 calls
|
|
|
|
# 1 tick, local
|
|
|
|
global TICKS
|
|
|
|
TICKS += 1
|
|
|
|
return a * b
|
|
|
|
|
|
|
|
def helper():
|
|
|
|
# 2 calls
|
|
|
|
# 300 ticks total: 20 ticks local, 260 ticks in subfunctions
|
|
|
|
global TICKS
|
|
|
|
TICKS += 1
|
|
|
|
helper1() # 30
|
|
|
|
TICKS += 2
|
|
|
|
helper1() # 30
|
|
|
|
TICKS += 6
|
|
|
|
helper2() # 50
|
|
|
|
TICKS += 3
|
|
|
|
helper2() # 50
|
|
|
|
TICKS += 2
|
|
|
|
helper2() # 50
|
|
|
|
TICKS += 5
|
|
|
|
helper2_indirect() # 70
|
|
|
|
TICKS += 1
|
|
|
|
|
|
|
|
def helper1():
|
|
|
|
# 4 calls
|
|
|
|
# 30 ticks total: 29 ticks local, 1 tick in subfunctions
|
|
|
|
global TICKS
|
|
|
|
TICKS += 10
|
|
|
|
hasattr(C(), "foo") # 1
|
|
|
|
TICKS += 19
|
|
|
|
lst = []
|
|
|
|
lst.append(42) # 0
|
2023-04-06 07:08:25 -03:00
|
|
|
sys.exception() # 0
|
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60568-60598,60600-60616 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60568 | christian.heimes | 2008-02-04 19:48:38 +0100 (Mon, 04 Feb 2008) | 1 line
Increase debugging to investige failing tests on some build bots
........
r60570 | christian.heimes | 2008-02-04 20:30:05 +0100 (Mon, 04 Feb 2008) | 1 line
Small adjustments for test compact freelist test. It's no passing on Windows as well.
........
r60573 | amaury.forgeotdarc | 2008-02-04 21:53:14 +0100 (Mon, 04 Feb 2008) | 2 lines
Correct quotes in NEWS file
........
r60575 | amaury.forgeotdarc | 2008-02-04 22:45:05 +0100 (Mon, 04 Feb 2008) | 13 lines
#1750076: Debugger did not step on every iteration of a while statement.
The mapping between bytecode offsets and source lines (lnotab) did not contain
an entry for the beginning of the loop.
Now it does, and the lnotab can be a bit larger:
in particular, several statements on the same line generate several entries.
However, this does not bother the settrace function, which will trigger only
one 'line' event.
The lnotab seems to be exactly the same as with python2.4.
........
r60584 | amaury.forgeotdarc | 2008-02-05 01:26:21 +0100 (Tue, 05 Feb 2008) | 3 lines
Change r60575 broke test_compile:
there is no need to emit co_lnotab item when both offsets are zeros.
........
r60587 | skip.montanaro | 2008-02-05 03:32:16 +0100 (Tue, 05 Feb 2008) | 1 line
sync with most recent version from python-mode sf project
........
r60588 | lars.gustaebel | 2008-02-05 12:51:40 +0100 (Tue, 05 Feb 2008) | 5 lines
Issue #2004: Use mode 0700 for temporary directories and default
permissions for missing directories.
(will backport to 2.5)
........
r60590 | georg.brandl | 2008-02-05 13:01:24 +0100 (Tue, 05 Feb 2008) | 2 lines
Convert external links to internal links. Fixes #2010.
........
r60592 | marc-andre.lemburg | 2008-02-05 15:50:40 +0100 (Tue, 05 Feb 2008) | 3 lines
Keep distutils Python 2.1 compatible (or even Python 2.4 in this case).
........
r60593 | andrew.kuchling | 2008-02-05 17:06:57 +0100 (Tue, 05 Feb 2008) | 5 lines
Update PEP URL.
(This code is duplicated between pydoc and DocXMLRPCServer; maybe it
should be refactored as a GHOP project.)
2.5.2 backport candidate.
........
r60596 | guido.van.rossum | 2008-02-05 18:32:15 +0100 (Tue, 05 Feb 2008) | 2 lines
In the experimental 'Scanner' feature, the group count was set wrong.
........
r60602 | facundo.batista | 2008-02-05 20:03:32 +0100 (Tue, 05 Feb 2008) | 3 lines
Issue 1951. Converts wave test cases to unittest.
........
r60603 | georg.brandl | 2008-02-05 20:07:10 +0100 (Tue, 05 Feb 2008) | 2 lines
Actually run the test.
........
r60604 | skip.montanaro | 2008-02-05 20:24:30 +0100 (Tue, 05 Feb 2008) | 2 lines
correct object name
........
r60605 | georg.brandl | 2008-02-05 20:58:17 +0100 (Tue, 05 Feb 2008) | 7 lines
* Use the same code to profile for test_profile and test_cprofile.
* Convert both to unittest.
* Use the same unit testing code.
* Include the expected output in both test files.
* Make it possible to regenerate the expected output by running
the file as a script with an '-r' argument.
........
r60613 | raymond.hettinger | 2008-02-06 02:49:00 +0100 (Wed, 06 Feb 2008) | 1 line
Sync-up with Py3k work.
........
r60614 | christian.heimes | 2008-02-06 13:44:34 +0100 (Wed, 06 Feb 2008) | 1 line
Limit free list of method and builtin function objects to 256 entries each.
........
r60616 | christian.heimes | 2008-02-06 14:33:44 +0100 (Wed, 06 Feb 2008) | 7 lines
Unified naming convention for free lists and their limits. All free lists
in Object/ are named ``free_list``, the counter ``numfree`` and the upper
limit is a macro ``PyName_MAXFREELIST`` inside an #ifndef block.
The chances should make it easier to adjust Python for platforms with
less memory, e.g. mobile phones.
........
2008-02-06 10:31:34 -04:00
|
|
|
|
|
|
|
def helper2_indirect():
|
|
|
|
helper2() # 50
|
|
|
|
factorial(3) # 20
|
|
|
|
|
|
|
|
def helper2():
|
|
|
|
# 8 calls
|
|
|
|
# 50 ticks local: 39 ticks local, 11 ticks in subfunctions
|
|
|
|
global TICKS
|
|
|
|
TICKS += 11
|
|
|
|
hasattr(C(), "bar") # 1
|
|
|
|
TICKS += 13
|
|
|
|
subhelper() # 10
|
|
|
|
TICKS += 15
|
|
|
|
|
|
|
|
def subhelper():
|
|
|
|
# 8 calls
|
|
|
|
# 10 ticks total: 8 ticks local, 2 ticks in subfunctions
|
|
|
|
global TICKS
|
|
|
|
TICKS += 2
|
|
|
|
for i in range(2): # 0
|
|
|
|
try:
|
|
|
|
C().foo # 1 x 2
|
|
|
|
except AttributeError:
|
|
|
|
TICKS += 3 # 3 x 2
|
|
|
|
|
|
|
|
class C:
|
|
|
|
def __getattr__(self, name):
|
|
|
|
# 28 calls
|
|
|
|
# 1 tick, local
|
|
|
|
global TICKS
|
|
|
|
TICKS += 1
|
|
|
|
raise AttributeError
|