Ignore:
Timestamp:
07/19/15 15:05:42 (9 years ago)
Author:
tim
Message:

.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/nanownlib/__init__.py

    r11 r13  
    176176    my_ip = getLocalIP(target_ip, target_port)
    177177    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,
    179179                             target_ip, "%d" % target_port, output_file, '0'])
    180180
     
    256256        suspect += 'R' # reordered received packets
    257257   
    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 
    262258    last_sent_ack = None
    263259    try:
    264         last_sent_ack = min(((p['observed'],p) for p in packets
    265                              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]
    266262       
    267263    except Exception as e:
    268264        sys.stderr.write("WARN: Could not find last_sent_ack.\n")
    269265
     266    packet_rtt = last_rcvd['observed'] - last_sent['observed']
    270267    tsval_rtt = None
    271268    if None not in (timestamp_precision, last_sent_ack):
    272269        tsval_rtt = int(round((last_rcvd['tsval'] - last_sent_ack['tsval'])*timestamp_precision))
    273270
     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       
    274275    return {'packet_rtt':packet_rtt,
    275276            'tsval_rtt':tsval_rtt,
     
    279280
    280281
    281 # trimean and mad for each dist of differences
     282# septasummary and mad for each dist of differences
    282283def evaluateTrim(db, unusual_case, strim, rtrim):
    283284    cursor = db.conn.cursor()
     
    292293      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
    293294    """
    294 
     295    #TODO: check for "N" in suspect field and return a flag
     296   
    295297    params = {"strim":strim,"rtrim":rtrim,"unusual_case":unusual_case}
    296298    cursor.execute(query, params)
    297299    differences = [row[0] for row in cursor]
    298300   
    299     return ubersummary(differences),mad(differences)
     301    return septasummary(differences),mad(differences)
    300302
    301303
     
    362364    for strim in range(0,num_sent):
    363365        for rtrim in range(0,num_rcvd):
     366            #print(strim,rtrim)
    364367            if strim == 0 and rtrim == 0:
    365368                continue # no point in doing 0,0 again
Note: See TracChangeset for help on using the changeset viewer.