本文整理汇总了Python中pympler.summary.print_方法的典型用法代码示例。如果您正苦于以下问题:Python summary.print_方法的具体用法?Python summary.print_怎么用?Python summary.print_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pympler.summary
的用法示例。
在下文中一共展示了summary.print_方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print_muppy_sumary
# 需要导入模块: from pympler import summary [as 别名]
# 或者: from pympler.summary import print_ [as 别名]
def print_muppy_sumary():
# http://pythonhosted.org/Pympler/index.html
try:
from pympler import muppy, summary
except ImportError:
print("WARNING: pympler not installed")
return
# from pympler.classtracker import ClassTracker
# from pympler.classtracker_stats import HtmlStats
global all_objects, obj_summary, class_tracker
if all_objects is None:
all_objects = muppy.get_objects()
obj_summary = summary.summarize(all_objects)
summary.print_(obj_summary)
# class_tracker = ClassTracker()
# class_tracker.track_class(FICSPlayer, trace=1)
# class_tracker.track_class(ICGameModel, resolution_level=2, trace=1)
else:
obj_summary2 = summary.summarize(muppy.get_objects())
diff = summary.get_diff(obj_summary, obj_summary2)
summary.print_(diff, limit=200)
# class_tracker.create_snapshot('usage')
# HtmlStats(tracker=class_tracker).create_html('profile.html')
示例2: print_summary
# 需要导入模块: from pympler import summary [as 别名]
# 或者: from pympler.summary import print_ [as 别名]
def print_summary():
"""Print a summary of all known objects."""
summary.print_(summary.summarize(get_objects()))
示例3: print_diff
# 需要导入模块: from pympler import summary [as 别名]
# 或者: from pympler.summary import print_ [as 别名]
def print_diff(self, summary1=None, summary2=None):
"""Compute diff between to summaries and print it.
If no summary is provided, the diff from the last to the current
summary is used. If summary1 is provided the diff from summary1
to the current summary is used. If summary1 and summary2 are
provided, the diff between these two is used.
"""
summary.print_(self.diff(summary1=summary1, summary2=summary2))
示例4: on_epoch_end
# 需要导入模块: from pympler import summary [as 别名]
# 或者: from pympler.summary import print_ [as 别名]
def on_epoch_end(self, epoch, log={}):
x = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
web_browser_debug = True
print(x)
if x > 40000:
if web_browser_debug:
if epoch==0:
start_in_background()
tr = tracker.SummaryTracker()
tr.print_diff()
else:
global memlist
all_objects = muppy.get_objects(include_frames=True)
# print(len(all_objects))
sum1 = summary.summarize(all_objects)
memlist.append(sum1)
summary.print_(sum1)
if len(memlist) > 1:
# compare with last - prints the difference per epoch
diff = summary.get_diff(memlist[-2], memlist[-1])
summary.print_(diff)
my_types = muppy.filter(all_objects, Type=types.ClassType)
for t in my_types:
print(t)
#########################################################