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


Python tracker.SummaryTracker方法代码示例

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


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

示例1: memorytrack

# 需要导入模块: from pympler import tracker [as 别名]
# 或者: from pympler.tracker import SummaryTracker [as 别名]
def memorytrack(func):
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        from pympler import tracker
        tr = tracker.SummaryTracker()
        func(*args, **kwargs)
        tr.print_diff()
    return wrapper 
开发者ID:lrq3000,项目名称:pyFileFixity,代码行数:10,代码来源:debug.py

示例2: __init__

# 需要导入模块: from pympler import tracker [as 别名]
# 或者: from pympler.tracker import SummaryTracker [as 别名]
def __init__(self, initial_snapshot_name='Bootstrap'):
    self._current_snapshot_name = initial_snapshot_name
    self._diff_snapshot = False
    self._tracker = tracker.SummaryTracker() 
开发者ID:luci,项目名称:recipes-py,代码行数:6,代码来源:engine.py

示例3: slave

# 需要导入模块: from pympler import tracker [as 别名]
# 或者: from pympler.tracker import SummaryTracker [as 别名]
def slave():

  new_model = make_model()
  
  while 1:
    #print('waiting for packet')
    packet = comm.recv(source=0)
    #comm.Recv(packet, source=0)
    current_env_name = packet['current_env_name']
    packet = packet['result']
    

    assert(len(packet) == SOLUTION_PACKET_SIZE)
    solutions = decode_solution_packet(packet)
    results = []
    #tracker2 = SummaryTracker()
    
    new_model.make_env(current_env_name)
    #tracker2.print_diff()

    for solution in solutions:
      worker_id, jobidx, seed, train_mode, max_len, weights = solution
      assert (train_mode == 1 or train_mode == 0), str(train_mode)
      
      worker_id = int(worker_id)
      possible_error = "work_id = " + str(worker_id) + " rank = " + str(rank)
      assert worker_id == rank, possible_error
      jobidx = int(jobidx)
      seed = int(seed)
    
      fitness, timesteps = worker(weights, seed, max_len, new_model, train_mode)
     
      results.append([worker_id, jobidx, fitness, timesteps])

    new_model.env.close()

    result_packet = encode_result_packet(results)
    assert len(result_packet) == RESULT_PACKET_SIZE
    comm.Send(result_packet, dest=0)
    #print('slave: completed solutions') 
开发者ID:llSourcell,项目名称:world_models,代码行数:42,代码来源:05_train_controller.py

示例4: startmemorytracker

# 需要导入模块: from pympler import tracker [as 别名]
# 或者: from pympler.tracker import SummaryTracker [as 别名]
def startmemorytracker():
    from pympler import tracker
    tr = tracker.SummaryTracker()
    return tr 
开发者ID:lrq3000,项目名称:pyFileFixity,代码行数:6,代码来源:debug.py

示例5: on_epoch_end

# 需要导入模块: from pympler import tracker [as 别名]
# 或者: from pympler.tracker import SummaryTracker [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)


    ######################################################### 
开发者ID:robmsmt,项目名称:KerasDeepSpeech,代码行数:31,代码来源:utils.py

示例6: __init__

# 需要导入模块: from pympler import tracker [as 别名]
# 或者: from pympler.tracker import SummaryTracker [as 别名]
def __init__(self, capture_interval=10, *args, **kwargs):
        # type: (int, Any, Any) -> None
        """
        :param capture_interval: How often to capture memory usage snapshot.
        :type capture_interval: ``int``
        """
        super(PeriodicMemorySummaryCaptureThread, self).__init__(
            name="PeriodicMemorySummaryCaptureThread"
        )

        self._capture_interval = capture_interval

        self._profiling_data = []  # type: List[Dict[str, Any]]
        self._tracker = tracker.SummaryTracker() 
开发者ID:scalyr,项目名称:scalyr-agent-2,代码行数:16,代码来源:profiler.py

示例7: dump_objs

# 需要导入模块: from pympler import tracker [as 别名]
# 或者: from pympler.tracker import SummaryTracker [as 别名]
def dump_objs():
	global TRACKER
	if TRACKER is None:
		TRACKER = tracker.SummaryTracker()

	with open("obj_log.txt", "a") as fp:
		fp.write("Memory at {}\n".format(str(datetime.datetime.now())))
		try:
			all_objects = muppy.get_objects()
			sum1 = summary.summarize(all_objects)
			str_sum  = summary.format_(sum1)

			fp.write("Summary:\n")
			for line in str_sum:
				fp.write("	{}\n".format(line))
		except Exception:
			err = traceback.format_exc()
			fp.write("Error: \n")
			fp.write(err)

		try:
			str_diff = TRACKER.format_diff()
			fp.write("Diff:\n")
			for line in str_diff:
				fp.write("	{}\n".format(line))
		except Exception:
			err = traceback.format_exc()
			fp.write("Error: \n")
			fp.write(err)

		fp.write("\n") 
开发者ID:fake-name,项目名称:IntraArchiveDeduplicator,代码行数:33,代码来源:server.py


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