Changeset 11 for trunk/lib/nanownlib/__init__.py
- Timestamp:
- 07/16/15 20:40:01 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/nanownlib/__init__.py
r10 r11 220 220 if p['sent']==1 and (seen[key]['observed'] > p['observed']): #earliest sent 221 221 seen[key] = p 222 suspect += 's' 222 suspect += 's' # duplicated sent packets 223 223 continue 224 224 if p['sent']==0 and (seen[key]['observed'] > p['observed']): #earliest rcvd 225 225 seen[key] = p 226 suspect += 'r' 226 suspect += 'r' # duplicated received packets 227 227 continue 228 228 … … 236 236 suspect,packets = removeDuplicatePackets(packets) 237 237 238 sort_key = lambda d: (d['tcpseq'],d['observed']) 238 sort_key = lambda d: (d['observed'],d['tcpseq']) 239 alt_key = lambda d: (d['tcpseq'],d['observed']) 239 240 sent = sorted((p for p in packets if p['sent']==1 and p['payload_len']>0), key=sort_key) 240 241 rcvd = sorted((p for p in packets if p['sent']==0 and p['payload_len']>0), key=sort_key) 241 242 alt_key = lambda d: (d['observed'],d['tcpseq'])243 242 rcvd_alt = sorted((p for p in packets if p['sent']==0 and p['payload_len']>0), key=alt_key) 244 243 245 244 s_off = trim_sent 246 245 if s_off >= len(sent): 246 suspect += 'd' # dropped packet? 247 247 s_off = -1 248 248 last_sent = sent[s_off] 249 249 250 250 r_off = len(rcvd) - trim_rcvd - 1 251 if r_off <= 0: 251 if r_off < 0: 252 suspect += 'd' # dropped packet? 252 253 r_off = 0 253 254 last_rcvd = rcvd[r_off] 254 255 if last_rcvd != rcvd_alt[r_off]: 255 suspect += 'R' 256 suspect += 'R' # reordered received packets 256 257 257 258 packet_rtt = last_rcvd['observed'] - last_sent['observed'] … … 263 264 last_sent_ack = min(((p['observed'],p) for p in packets 264 265 if p['sent']==0 and p['payload_len']+last_sent['tcpseq']==p['tcpack']))[1] 266 265 267 except Exception as e: 266 268 sys.stderr.write("WARN: Could not find last_sent_ack.\n") … … 301 303 def analyzeProbes(db): 302 304 db.conn.execute("CREATE INDEX IF NOT EXISTS packets_probe ON packets (probe_id)") 305 db.conn.commit() 306 303 307 pcursor = db.conn.cursor() 304 db.conn.commit()305 306 308 pcursor.execute("SELECT tcpts_mean FROM meta") 307 309 try: … … 346 348 db.addTrimAnalyses([analysis]) 347 349 except Exception as e: 348 traceback.print_exc()350 #traceback.print_exc() 349 351 sys.stderr.write("WARN: couldn't find enough packets for probe_id=%s\n" % probe_id) 350 352 … … 367 369 analysis['probe_id'] = probe_id 368 370 except Exception as e: 369 print(e)370 sys.stderr.write("WARN: couldn't find enough packets for probe_id=%s\n" % p id)371 #traceback.print_exc() 372 sys.stderr.write("WARN: couldn't find enough packets for probe_id=%s\n" % probe_id) 371 373 372 374 db.addTrimAnalyses([analysis])
Note: See TracChangeset
for help on using the changeset viewer.