本文整理汇总了Python中_lsprof.Profiler方法的典型用法代码示例。如果您正苦于以下问题:Python _lsprof.Profiler方法的具体用法?Python _lsprof.Profiler怎么用?Python _lsprof.Profiler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_lsprof
的用法示例。
在下文中一共展示了_lsprof.Profiler方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_bad_counter_during_dealloc
# 需要导入模块: import _lsprof [as 别名]
# 或者: from _lsprof import Profiler [as 别名]
def test_bad_counter_during_dealloc(self):
import _lsprof
# Must use a file as StringIO doesn't trigger the bug.
orig_stderr = sys.stderr
try:
with open(TESTFN, 'w') as file:
sys.stderr = file
try:
obj = _lsprof.Profiler(lambda: int)
obj.enable()
obj = _lsprof.Profiler(1)
obj.disable()
obj.clear()
finally:
sys.stderr = orig_stderr
finally:
unlink(TESTFN)
示例2: help
# 需要导入模块: import _lsprof [as 别名]
# 或者: from _lsprof import Profiler [as 别名]
def help():
print "Documentation for the profile/cProfile modules can be found "
print "in the Python Library Reference, section 'The Python Profiler'."
# ____________________________________________________________
示例3: test_bad_counter_during_dealloc
# 需要导入模块: import _lsprof [as 别名]
# 或者: from _lsprof import Profiler [as 别名]
def test_bad_counter_during_dealloc(self):
import _lsprof
# Must use a file as StringIO doesn't trigger the bug.
sys.stderr = open(TESTFN, 'w')
try:
obj = _lsprof.Profiler(lambda: int)
obj.enable()
obj = _lsprof.Profiler(1)
obj.disable()
finally:
sys.stderr = sys.__stderr__
unlink(TESTFN)
示例4: test_bad_counter_during_dealloc
# 需要导入模块: import _lsprof [as 别名]
# 或者: from _lsprof import Profiler [as 别名]
def test_bad_counter_during_dealloc():
import _lsprof
# Must use a file as StringIO doesn't trigger the bug.
sys.stderr = open(test.test_support.TESTFN, 'w')
try:
obj = _lsprof.Profiler(lambda: int)
obj.enable()
obj = _lsprof.Profiler(1)
obj.disable()
finally:
sys.stderr = sys.__stderr__
test.test_support.unlink(test.test_support.TESTFN)
示例5: profile
# 需要导入模块: import _lsprof [as 别名]
# 或者: from _lsprof import Profiler [as 别名]
def profile(f, *args, **kwds):
"""XXX docstring"""
p = Profiler()
p.enable(subcalls=True, builtins=True)
try:
f(*args, **kwds)
finally:
p.disable()
return Stats(p.getstats())