本文整理汇总了Python中guppy.hpy方法的典型用法代码示例。如果您正苦于以下问题:Python guppy.hpy方法的具体用法?Python guppy.hpy怎么用?Python guppy.hpy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类guppy
的用法示例。
在下文中一共展示了guppy.hpy方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: help_int
# 需要导入模块: import guppy [as 别名]
# 或者: from guppy import hpy [as 别名]
def help_int(self):
print("""int
-----
Interactive console.
Bring up a Python console in the Remote Control interpreter.
This console will initially have access to a heapy constructor, named
hpy, and a ready-made instance, named hp, and the target (see also the
reset command). Other things may be imported as needed.
After returning to the Annex (by q) or to the Monitor (by . or
<Ctrl-C>), the data in the interactive console will remain there - and
will be available till the next time the console is entered. But the
data may be cleared and reset to the initial state - a new heapy
instance will be created - by the 'reset' command of Annex.
It should be noted that the interpreter thread under investigation is
executing in parallell with the remote control interpreter. So there
may be some problems to do with that if both are executing at the same
time. This has to be dealt with for each case specifically.""", file=self.stdout)
示例2: help_reset
# 需要导入模块: import guppy [as 别名]
# 或者: from guppy import hpy [as 别名]
def help_reset(self):
print("""reset
-----
Reset things to an initial state.
This resets the state of the interactive console data only, for now.
It is reinitialized to contain the following:
hpy --- from guppy import hpy
hp --- hp = hpy()
target --- a reference to some data in the target interpreter
h --- h = hp; h is a shorthand for hp
(The hpy function is modified here from the normal one so
it sets some options to make it be concerned with the target
interpreter heap under investigation rather than the current one.)
""", file=self.stdout)
示例3: _get_telnet_vars
# 需要导入模块: import guppy [as 别名]
# 或者: from guppy import hpy [as 别名]
def _get_telnet_vars(self):
# Note: if you add entries here also update topics/telnetconsole.rst
telnet_vars = {
'engine': self.crawler.engine,
'spider': self.crawler.engine.spider,
'slot': self.crawler.engine.slot,
'crawler': self.crawler,
'extensions': self.crawler.extensions,
'stats': self.crawler.stats,
'settings': self.crawler.settings,
'est': lambda: print_engine_status(self.crawler.engine),
'p': pprint.pprint,
'prefs': print_live_refs,
'hpy': hpy,
'help': "This is Scrapy telnet console. For more info see: "
"https://docs.scrapy.org/en/latest/topics/telnetconsole.html",
}
self.crawler.signals.send_catch_log(update_telnet_vars, telnet_vars=telnet_vars)
return telnet_vars
示例4: memory_usage
# 需要导入模块: import guppy [as 别名]
# 或者: from guppy import hpy [as 别名]
def memory_usage():
logging.info("fuck")
h = hpy()
result = str(h.heap()).replace("\n", "<br>")
return result
示例5: __init__
# 需要导入模块: import guppy [as 别名]
# 或者: from guppy import hpy [as 别名]
def __init__(self, registryDb):
repo = datarepo.SqlDataRepository(registryDb)
repo.open(datarepo.MODE_READ)
super(HeapProfilerBackend, self).__init__(repo)
self.profiler = guppy.hpy()
示例6: do_reset
# 需要导入模块: import guppy [as 别名]
# 或者: from guppy import hpy [as 别名]
def do_reset(self, arg):
self.intlocals.clear()
self.intlocals.update(
{'hpy': self.hpy,
'hp': self.hpy(),
'target': self.target
})
# Set shorthand h, it is so commonly used
# and the instance name now used in README example etc
self.intlocals['h'] = self.intlocals['hp']
示例7: hpy
# 需要导入模块: import guppy [as 别名]
# 或者: from guppy import hpy [as 别名]
def hpy(self, *args, **kwds):
from guppy import hpy
hp = hpy(*args, **kwds)
hp.View.is_hiding_calling_interpreter = 1
hp.View.target = self.target
self.target._hiding_tag_ = hp._hiding_tag_
self.target.close._hiding_tag_ = hp._hiding_tag_
hp.reprefix = 'hp.'
return hp
示例8: test_4
# 需要导入模块: import guppy [as 别名]
# 或者: from guppy import hpy [as 别名]
def test_4(self):
' Test of via '
# Esp. representation, construction
class C:
pass
c = C()
hp = self.heapy.Use
isod = hp.iso(c.__dict__)
x = isod.by('Via').kind
self.aseq(repr(x), "hpy().Via('.__dict__')")
示例9: check_NodeMemory
# 需要导入模块: import guppy [as 别名]
# 或者: from guppy import hpy [as 别名]
def check_NodeMemory():
# Not a test. Useful for checking how much memory a node uses.
np_A = npr.randn(5,6)
A = kayak.Parameter(np_A)
N = int(1e4)
h = hpy()
h.setref()
for i in xrange(N):
A = kayak.Identity(A)
print "Created 10,000 objects"
print h.heap()
示例10: do_debugmem
# 需要导入模块: import guppy [as 别名]
# 或者: from guppy import hpy [as 别名]
def do_debugmem(self, _line):
""" Profile python memory usage. """
from guppy import hpy
heap_stats = hpy()
print(heap_stats.heap())
print()
print(heap_stats.heap().byrcs)
示例11: __call__
# 需要导入模块: import guppy [as 别名]
# 或者: from guppy import hpy [as 别名]
def __call__(self, func):
@wraps(func)
def wrapper(*args, **kwargs):
gc.disable()
start = hpy().heap().size
res = func(*args, **kwargs)
end = hpy().heap().size
gc.enable()
mem_log(name=func.__name__, totmembytes=end , memdiffbytes=(end-start), args=self.arg_extractor(*args, **kwargs))
return res
return wrapper