Changeset 13 for trunk/lib/nanownlib/__init__.py
- Timestamp:
- 07/19/15 15:05:42 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/nanownlib/__init__.py
r11 r13 176 176 my_ip = getLocalIP(target_ip, target_port) 177 177 my_iface = getIfaceForIP(my_ip) 178 return subprocess.Popen(['chrt', '-r', '99', ' ./bin/csamp', my_iface, my_ip,178 return subprocess.Popen(['chrt', '-r', '99', 'nanown-csamp', my_iface, my_ip, 179 179 target_ip, "%d" % target_port, output_file, '0']) 180 180 … … 256 256 suspect += 'R' # reordered received packets 257 257 258 packet_rtt = last_rcvd['observed'] - last_sent['observed']259 if packet_rtt < 0:260 sys.stderr.write("WARN: Negative packet_rtt. last_rcvd=%s,last_sent=%s\n" % (last_rcvd, last_sent))261 262 258 last_sent_ack = None 263 259 try: 264 last_sent_ack = min(((p[' observed'],p) for p in packets265 if p['sent']==0 and p['payload_len']+last_sent['tcpseq'] ==p['tcpack']))[1]260 last_sent_ack = min(((p['tcpack'],p['observed'],p) for p in packets 261 if p['sent']==0 and p['payload_len']+last_sent['tcpseq']>=p['tcpack']))[2] 266 262 267 263 except Exception as e: 268 264 sys.stderr.write("WARN: Could not find last_sent_ack.\n") 269 265 266 packet_rtt = last_rcvd['observed'] - last_sent['observed'] 270 267 tsval_rtt = None 271 268 if None not in (timestamp_precision, last_sent_ack): 272 269 tsval_rtt = int(round((last_rcvd['tsval'] - last_sent_ack['tsval'])*timestamp_precision)) 273 270 271 if packet_rtt < 0 or (tsval_rtt != None and tsval_rtt < 0): 272 #sys.stderr.write("WARN: Negative packet or tsval RTT. last_rcvd=%s,last_sent=%s\n" % (last_rcvd, last_sent)) 273 suspect += 'N' 274 274 275 return {'packet_rtt':packet_rtt, 275 276 'tsval_rtt':tsval_rtt, … … 279 280 280 281 281 # trimeanand mad for each dist of differences282 # septasummary and mad for each dist of differences 282 283 def evaluateTrim(db, unusual_case, strim, rtrim): 283 284 cursor = db.conn.cursor() … … 292 293 FROM (SELECT probes.sample s,packet_rtt FROM probes,trim_analysis WHERE sent_trimmed=:strim AND rcvd_trimmed=:rtrim AND trim_analysis.probe_id=probes.id AND probes.test_case=:unusual_case AND probes.type in ('train','test')) u 293 294 """ 294 295 #TODO: check for "N" in suspect field and return a flag 296 295 297 params = {"strim":strim,"rtrim":rtrim,"unusual_case":unusual_case} 296 298 cursor.execute(query, params) 297 299 differences = [row[0] for row in cursor] 298 300 299 return ubersummary(differences),mad(differences)301 return septasummary(differences),mad(differences) 300 302 301 303 … … 362 364 for strim in range(0,num_sent): 363 365 for rtrim in range(0,num_rcvd): 366 #print(strim,rtrim) 364 367 if strim == 0 and rtrim == 0: 365 368 continue # no point in doing 0,0 again
Note: See TracChangeset
for help on using the changeset viewer.