代码拉取完成,页面将自动刷新
同步操作将从 三个小小道/Rosetta 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import sys
def load_flow(fname, load_time=0, load_length=1, load_direction=1, no_neg=False, offset=1460, compress=True):
'''
load_time = 0 means don't load packet timestamp (the return value will be a list of ±length)
load_length = 0 means masking the packet length to ±1
no_neg, offset: add lengths with offset to ensure that they are all non-negative numbers
'''
flow = []
try:
f = open(fname, "r")
lines = f.readlines()
f.close()
if len(lines) == 0:
print("Empty cell:", fname)
sys.exit(-1)
start_time = float(lines[0].split('\t')[0])
for li in lines:
li = li.split("\t")
p = int(li[1])
if load_direction == 0:
p = p if p >= 0 else -p
if load_direction == 1 and no_neg:
p += offset
if compress:
p = p // 10
if load_length == 0:
p = 1 if p > 0 else -1
if load_time == 0:
flow.append(p)
else:
t = float(li[0])
flow.append((t - start_time, p))
except:
print ("Could not load", fname)
sys.exit(-1)
return flow
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。