本文整理匯總了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)
#########################################################