当前位置: 首页>>代码示例>>Python>>正文


Python objgraph.show_growth方法代码示例

本文整理汇总了Python中objgraph.show_growth方法的典型用法代码示例。如果您正苦于以下问题:Python objgraph.show_growth方法的具体用法?Python objgraph.show_growth怎么用?Python objgraph.show_growth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在objgraph的用法示例。


在下文中一共展示了objgraph.show_growth方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: trace_memory_start

# 需要导入模块: import objgraph [as 别名]
# 或者: from objgraph import show_growth [as 别名]
def trace_memory_start(self):
        """ Starts measuring memory consumption """

        self.trace_memory_clean_caches()

        objgraph.show_growth(limit=30)

        gc.collect()
        self._memory_start = self.worker.get_memory()["total"] 
开发者ID:pricingassistant,项目名称:mrq,代码行数:11,代码来源:job.py

示例2: fix_missing_history

# 需要导入模块: import objgraph [as 别名]
# 或者: from objgraph import show_growth [as 别名]
def fix_missing_history(self):

		with db.session_context() as sess:
			self.qlog.info("Querying for DB items without any history")
			end = sess.execute("""
				SELECT
					t1.url
				FROM
					web_pages t1
				LEFT JOIN
					web_pages_version t2 ON t2.url = t1.url
				WHERE
					t2.url IS NULL

				""")
			end = [tmp[0] for tmp in end]
			self.log.info("Found %s rows missing history content!", len(end))

			loop = 0
			remaining = len(end)
			for urlset in batch(end, 50):
				self.tickle_rows(sess, urlset)
				sess.expire_all()

				remaining = remaining - len(urlset)
				self.log.info("Processed %s of %s (%s%%)", len(end)-remaining, len(end), 100-((remaining/len(end)) * 100) )

				print("Growth:")
				growth = objgraph.show_growth(limit=10)
				print(growth) 
开发者ID:fake-name,项目名称:ReadableWebProxy,代码行数:32,代码来源:Consolidate.py

示例3: print_memory_growth_statistics

# 需要导入模块: import objgraph [as 别名]
# 或者: from objgraph import show_growth [as 别名]
def print_memory_growth_statistics(interval_sec=10.0, set_pdb_trace_every=math.inf):
    num_iters = 0
    import objgraph
    while True:
        num_iters += 1
        await anyio.sleep(interval_sec)
        objgraph.show_growth()
        if num_iters == set_pdb_trace_every:
            pdb.set_trace()
            num_iters = 0 
开发者ID:standy66,项目名称:purerpc,代码行数:12,代码来源:utils.py

示例4: show_growth

# 需要导入模块: import objgraph [as 别名]
# 或者: from objgraph import show_growth [as 别名]
def show_growth():
    """- Print object growth data to the console"""
    if objgraph is None:
        return "objgraph not installed"
    objgraph.show_growth(limit=10)
    return "Printed to console" 
开发者ID:TotallyNotRobots,项目名称:CloudBot,代码行数:8,代码来源:profiling.py

示例5: meminfo

# 需要导入模块: import objgraph [as 别名]
# 或者: from objgraph import show_growth [as 别名]
def meminfo(ctx, **_):
    mem_info = StringIO()
    objgraph.show_most_common_types(file=mem_info)
    await util.say(ctx.channel, "```%s```" % mem_info.getvalue())
    mem_info = StringIO()
    objgraph.show_growth(file=mem_info)
    await util.say(ctx.channel, "```%s```" % mem_info.getvalue()) 
开发者ID:MacDue,项目名称:DueUtil,代码行数:9,代码来源:misc.py

示例6: cmd_objgraph

# 需要导入模块: import objgraph [as 别名]
# 或者: from objgraph import show_growth [as 别名]
def cmd_objgraph(self, channel, func='most_common_types()'):
        import objgraph

        await self.send_typing(channel)

        if func == 'growth':
            f = StringIO()
            objgraph.show_growth(limit=10, file=f)
            f.seek(0)
            data = f.read()
            f.close()

        elif func == 'leaks':
            f = StringIO()
            objgraph.show_most_common_types(objects=objgraph.get_leaking_objects(), file=f)
            f.seek(0)
            data = f.read()
            f.close()

        elif func == 'leakstats':
            data = objgraph.typestats(objects=objgraph.get_leaking_objects())

        else:
            data = eval('objgraph.' + func)

        return Response(data, codeblock='py') 
开发者ID:helionmusic,项目名称:rhinobot_heroku,代码行数:28,代码来源:bot.py

示例7: dump_objgraph

# 需要导入模块: import objgraph [as 别名]
# 或者: from objgraph import show_growth [as 别名]
def dump_objgraph(self):
        """ This is a debugging method designed to be called from the datagram
        port. It helps us debug a memory 'leak' """
        import gc
        gc.collect()
        import objgraph
        print "Dumping object growth ****"
        objgraph.show_growth(limit=100)
        print "****" 
开发者ID:simplecrypto,项目名称:powerpool,代码行数:11,代码来源:main.py

示例8: trace_memory_stop

# 需要导入模块: import objgraph [as 别名]
# 或者: from objgraph import show_growth [as 别名]
def trace_memory_stop(self):
        """ Stops measuring memory consumption """

        self.trace_memory_clean_caches()

        objgraph.show_growth(limit=30)

        trace_type = context.get_current_config()["trace_memory_type"]
        if trace_type:

            filename = '%s/%s-%s.png' % (
                context.get_current_config()["trace_memory_output_dir"],
                trace_type,
                self.id)

            chain = objgraph.find_backref_chain(
                random.choice(
                    objgraph.by_type(trace_type)
                ),
                objgraph.is_proper_module
            )
            objgraph.show_chain(chain, filename=filename)
            del filename
            del chain

        gc.collect()
        self._memory_stop = self.worker.get_memory()["total"]

        diff = self._memory_stop - self._memory_start

        context.log.debug("Memory diff for job %s : %s" % (self.id, diff))

        # We need to update it later than the results, we need them off memory
        # already.
        self.collection.update(
            {"_id": self.id},
            {"$set": {
                "memory_diff": diff
            }},
            w=1
        ) 
开发者ID:pricingassistant,项目名称:mrq,代码行数:43,代码来源:job.py

示例9: show_growth

# 需要导入模块: import objgraph [as 别名]
# 或者: from objgraph import show_growth [as 别名]
def show_growth():
    if objgraph is None:
        return "objgraph not installed"
    objgraph.show_growth(limit=10)
    return "Printed to console" 
开发者ID:CloudBotIRC,项目名称:CloudBot,代码行数:7,代码来源:profiling.py

示例10: start_debug_shell

# 需要导入模块: import objgraph [as 别名]
# 或者: from objgraph import show_growth [as 别名]
def start_debug_shell(d=None, port=9000):
    # Add a manhole shell
    import twisted.manhole.telnet
    f = twisted.manhole.telnet.ShellFactory()
    f.namespace['_'] = d
    try:
        import objgraph
        f.namespace['g'] = objgraph.show_growth
    except Exception:
        pass
    return reactor.listenTCP(port, f, interface='127.0.0.1') 
开发者ID:ldecicco,项目名称:tapas,代码行数:13,代码来源:util.py


注:本文中的objgraph.show_growth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。