本文整理汇总了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] = [[], [], [], []]