本文整理汇总了Python中_hotshot.profiler方法的典型用法代码示例。如果您正苦于以下问题:Python _hotshot.profiler方法的具体用法?Python _hotshot.profiler怎么用?Python _hotshot.profiler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_hotshot
的用法示例。
在下文中一共展示了_hotshot.profiler方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import _hotshot [as 别名]
# 或者: from _hotshot import profiler [as 别名]
def __init__(self, logfn, lineevents=0, linetimings=1):
self.lineevents = lineevents and 1 or 0
self.linetimings = (linetimings and lineevents) and 1 or 0
self._prof = p = _hotshot.profiler(
logfn, self.lineevents, self.linetimings)
# Attempt to avoid confusing results caused by the presence of
# Python wrappers around these functions, but only if we can
# be sure the methods have not been overridden or extended.
if self.__class__ is Profile:
self.close = p.close
self.start = p.start
self.stop = p.stop
self.addinfo = p.addinfo
示例2: close
# 需要导入模块: import _hotshot [as 别名]
# 或者: from _hotshot import profiler [as 别名]
def close(self):
"""Close the logfile and terminate the profiler."""
self._prof.close()
示例3: fileno
# 需要导入模块: import _hotshot [as 别名]
# 或者: from _hotshot import profiler [as 别名]
def fileno(self):
"""Return the file descriptor of the profiler's log file."""
return self._prof.fileno()
示例4: start
# 需要导入模块: import _hotshot [as 别名]
# 或者: from _hotshot import profiler [as 别名]
def start(self):
"""Start the profiler."""
self._prof.start()
示例5: stop
# 需要导入模块: import _hotshot [as 别名]
# 或者: from _hotshot import profiler [as 别名]
def stop(self):
"""Stop the profiler."""
self._prof.stop()