當前位置: 首頁>>代碼示例>>Python>>正文


Python guppy.hpy方法代碼示例

本文整理匯總了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) 
開發者ID:zhuyifei1999,項目名稱:guppy3,代碼行數:22,代碼來源:Remote.py

示例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) 
開發者ID:zhuyifei1999,項目名稱:guppy3,代碼行數:19,代碼來源:Remote.py

示例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 
開發者ID:wistbean,項目名稱:learn_python3_spider,代碼行數:21,代碼來源:telnet.py

示例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 
開發者ID:AutohomeRadar,項目名稱:Windows-Agent,代碼行數:7,代碼來源:http.py

示例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() 
開發者ID:ga4gh,項目名稱:ga4gh-server,代碼行數:7,代碼來源:server_benchmark.py

示例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'] 
開發者ID:zhuyifei1999,項目名稱:guppy3,代碼行數:12,代碼來源:Remote.py

示例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 
開發者ID:zhuyifei1999,項目名稱:guppy3,代碼行數:11,代碼來源:Remote.py

示例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__')") 
開發者ID:zhuyifei1999,項目名稱:guppy3,代碼行數:16,代碼來源:test_ER.py

示例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() 
開發者ID:HIPS,項目名稱:Kayak,代碼行數:13,代碼來源:check_MemoryUse.py

示例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) 
開發者ID:openthread,項目名稱:pyspinel,代碼行數:9,代碼來源:spinel-cli.py

示例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 
開發者ID:Runbook,項目名稱:runbook,代碼行數:13,代碼來源:runbook_profiler.py


注:本文中的guppy.hpy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。