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


Python Trace.events[round_no]方法代码示例

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


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

示例1: remove_users

# 需要导入模块: from trace import Trace [as 别名]
# 或者: from trace.Trace import events[round_no] [as 别名]
                for ap, prob in system.access_point[pos][channel].iteritems():
                    server_access_numbers[ap][channel] += system.viewers[pos][channel] * prob
        for leaving_user in trace.events[round_no][3]:
            position, channel_id, access_id = trace.viewers[leaving_user]
            del trace.viewers[leaving_user]
            leaving_users[position][access_id] += 1
            system.viewers[position][channel_id] -= 1
            server_access_numbers[access_id][channel_id] -= 1
        remove_users(leaving_users, topology, system)
        shrink_delivery_tree(server_access_numbers, trace.events[round_no][1], topology, system)
        print "Leaving user removed!"

        # Add new channels
        for channel in trace.events[round_no][0]:
            system.channels[channel]['src'] = topology.get_nearest_server(trace.channels[channel])
            system.channels[channel]['sites'] = []
        print "New channels prepared!"

        algo = Multicast(topology, trace, system, round_no)
        # Compute deliver tree and access points for current trace. The results should be stored in system
        channels_with_new_delivery_tree, new_delivery_tree = algo.compute(incremental=True)
        print "Algorithm computation complete!"
        # Update network status based on updated system
        failed_access, failed_deliver = update_network_status(topology, trace, system, round_no,
                                                              channels_with_new_delivery_tree,
                                                              new_delivery_tree, incremental=True)
        print failed_access, failed_deliver, len(channels_with_new_delivery_tree)

        # Remove expiring events
        trace.events[round_no] = [[], [], [], []]
开发者ID:cabeggar,项目名称:simlive,代码行数:32,代码来源:main.py


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