| 
														
															@@ -25,87 +25,121 @@ nodelogs.sort(key=lambda filename : int(filename[1:-4])) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 # Pass 1: For each sender and receiver, make a list of each message 
														 | 
														
														 | 
														
															 # Pass 1: For each sender and receiver, make a list of each message 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 # queued from that sender to receiver, noting its queue start time, 
														 | 
														
														 | 
														
															 # queued from that sender to receiver, noting its queue start time, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-# queue end time, size, and type 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+# queue end time, size, and type.  Also gather all timestamp labels for 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+# each node 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 queued_messages = {} 
														 | 
														
														 | 
														
															 queued_messages = {} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+labels = {} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 min_ts = None 
														 | 
														
														 | 
														
															 min_ts = None 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+max_ts = None 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 for nodelog in nodelogs: 
														 | 
														
														 | 
														
															 for nodelog in nodelogs: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     node = nodelog[:-4] 
														 | 
														
														 | 
														
															     node = nodelog[:-4] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    labels[node] = [] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     with open(nodelog) as logf: 
														 | 
														
														 | 
														
															     with open(nodelog) as logf: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         queueing = {} 
														 | 
														
														 | 
														
															         queueing = {} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         for logline in logf: 
														 | 
														
														 | 
														
															         for logline in logf: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             logline = logline.rstrip() 
														 | 
														
														 | 
														
															             logline = logline.rstrip() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if "RTE" in logline: 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                if "queueing" in logline: 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    matches = re.match( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        r'(\d+\.\d+): RTE queueing (\d+) bytes to (\S+)', 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        logline) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    [ts, size, recv] = matches.groups() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    assert(recv not in queueing) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    tsf = float(ts) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    queueing[recv] = \ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        { 'queue_start': tsf, 'size': size } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    if min_ts is None or min_ts > tsf: 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        min_ts = tsf 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                if "queued" in logline: 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    matches = re.match( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        r'(\d+\.\d+): RTE queued (\d+) bytes to (\S+)', 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        logline) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    [ts, size, recv] = matches.groups() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    assert(recv in queueing) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    assert(queueing[recv]['size'] == size) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    if (node, recv) not in queued_messages: 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        queued_messages[(node, recv)] = [] 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    msg = { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        'queue_start': queueing[recv]['queue_start'], 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        'queue_end': float(ts), 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        'size': size, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        'type': 'RTE', 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    queued_messages[(node, recv)].append(msg) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    del queueing[recv] 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if matches := re.match( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    r'(\d+\.\d+): RTE queueing (\d+) bytes to (\S+)', 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    logline): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                [ts, size, recv] = matches.groups() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                assert(recv not in queueing) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                tsf = float(ts) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                queueing[recv] = \ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    { 'queue_start': tsf, 'size': size } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if min_ts is None or min_ts > tsf: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    min_ts = tsf 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            elif matches := re.match( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    r'(\d+\.\d+): RTE queued (\d+) bytes to (\S+)', 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    logline): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                [ts, size, recv] = matches.groups() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                assert(recv in queueing) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                assert(queueing[recv]['size'] == size) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if (node, recv) not in queued_messages: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    queued_messages[(node, recv)] = [] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                msg = { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    'queue_start': queueing[recv]['queue_start'], 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    'queue_end': float(ts), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    'size': size, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    'type': 'RTE', 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                queued_messages[(node, recv)].append(msg) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                del queueing[recv] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            elif matches := re.match( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    r'(\d+\.\d+): Epoch \d+ (start|complete)', 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    logline): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                [ts, typ] = matches.groups() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                tsf = float(ts) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if typ == 'start': 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    typ = 'S' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                elif typ == 'complete': 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    typ = 'F' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                labels[node].append((tsf, typ)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if max_ts is None or max_ts < tsf: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    max_ts = tsf 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            elif matches := re.match( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    r'(\d+\.\d+): Round (.*) complete', 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    logline): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                [ts, rnd] = matches.groups() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                tsf = float(ts) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if rnd == '11': 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    rnd = 'A' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                elif rnd == '12': 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    rnd = 'B' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                elif rnd == '13': 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    rnd = 'C' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                labels[node].append((tsf, rnd)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if max_ts is None or max_ts < tsf: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    max_ts = tsf 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            elif matches := re.match( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    r'(\d+\.\d+): (Begin|End) Waksman networks precompute', 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    logline): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                [ts, typ] = matches.groups() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                tsf = float(ts) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if typ == 'Begin': 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    typ = 'P' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                elif typ == 'End': 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    typ = 'W' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                labels[node].append((tsf, typ)) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if max_ts is None or max_ts < tsf: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    max_ts = tsf 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 # Pass 2: For each sender and receiver, note the receive start time and 
														 | 
														
														 | 
														
															 # Pass 2: For each sender and receiver, note the receive start time and 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 # receive end time for each message in the queued_messages list 
														 | 
														
														 | 
														
															 # receive end time for each message in the queued_messages list 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 messages = {} 
														 | 
														
														 | 
														
															 messages = {} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-max_ts = None 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 for nodelog in nodelogs: 
														 | 
														
														 | 
														
															 for nodelog in nodelogs: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     node = nodelog[:-4] 
														 | 
														
														 | 
														
															     node = nodelog[:-4] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     with open(nodelog) as logf: 
														 | 
														
														 | 
														
															     with open(nodelog) as logf: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         receiving = {} 
														 | 
														
														 | 
														
															         receiving = {} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         for logline in logf: 
														 | 
														
														 | 
														
															         for logline in logf: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             logline = logline.rstrip() 
														 | 
														
														 | 
														
															             logline = logline.rstrip() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            if "RTE" in logline: 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                if "receiving" in logline: 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    matches = re.match( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        r'(\d+\.\d+): RTE receiving (\d+) bytes from (\S+)', 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        logline) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    [ts, size, snd] = matches.groups() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    assert(snd not in receiving) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    receiving[snd] = \ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        { 'recv_start': float(ts), 'size': size } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                if "received" in logline: 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    matches = re.match( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        r'(\d+\.\d+): RTE received (\d+) bytes from (\S+)', 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        logline) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    [ts, size, snd] = matches.groups() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    assert(snd in receiving) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    assert(receiving[snd]['size'] == size) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    assert(queued_messages[(snd, node)][0]['size'] == size) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    tsf = float(ts) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    if (snd, node) not in messages: 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        messages[(snd, node)] = [] 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    msg = queued_messages[(snd, node)].pop(0) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    msg['recv_start'] = receiving[snd]['recv_start'] 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    msg['recv_end'] = tsf 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    if max_ts is None or max_ts < tsf: 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                        max_ts = tsf 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    messages[(snd, node)].append(msg) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-                    del receiving[snd] 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if matches := re.match( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    r'(\d+\.\d+): RTE receiving (\d+) bytes from (\S+)', 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    logline): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                [ts, size, snd] = matches.groups() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                assert(snd not in receiving) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                receiving[snd] = \ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    { 'recv_start': float(ts), 'size': size } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            elif matches := re.match( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    r'(\d+\.\d+): RTE received (\d+) bytes from (\S+)', 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    logline): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                [ts, size, snd] = matches.groups() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                assert(snd in receiving) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                assert(receiving[snd]['size'] == size) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                assert(queued_messages[(snd, node)][0]['size'] == size) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                tsf = float(ts) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if (snd, node) not in messages: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    messages[(snd, node)] = [] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                msg = queued_messages[(snd, node)].pop(0) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                msg['recv_start'] = receiving[snd]['recv_start'] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                msg['recv_end'] = tsf 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                if max_ts is None or max_ts < tsf: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                    max_ts = tsf 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                messages[(snd, node)].append(msg) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                del receiving[snd] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 # Write a latex file that draws the messages 
														 | 
														
														 | 
														
															 # Write a latex file that draws the messages 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -115,10 +149,14 @@ timescale = 2 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 # Nodescale (cm between nodes) 
														 | 
														
														 | 
														
															 # Nodescale (cm between nodes) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 nodescale = 1 
														 | 
														
														 | 
														
															 nodescale = 1 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+# Seconds between time label ticks 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+time_tick = 1 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 with open("trace.tex", "w") as tf: 
														 | 
														
														 | 
														
															 with open("trace.tex", "w") as tf: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     print(r'''\documentclass{article} 
														 | 
														
														 | 
														
															     print(r'''\documentclass{article} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 \usepackage[paperwidth=%fcm,paperheight=%fcm,margin=1cm]{geometry} 
														 | 
														
														 | 
														
															 \usepackage[paperwidth=%fcm,paperheight=%fcm,margin=1cm]{geometry} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 \usepackage{tikz} 
														 | 
														
														 | 
														
															 \usepackage{tikz} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+\usepackage{times} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 \setlength\parindent{0pt} 
														 | 
														
														 | 
														
															 \setlength\parindent{0pt} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 \pagestyle{empty} 
														 | 
														
														 | 
														
															 \pagestyle{empty} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 \begin{document} 
														 | 
														
														 | 
														
															 \begin{document} 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -127,19 +165,31 @@ with open("trace.tex", "w") as tf: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     nodenum = 0 
														 | 
														
														 | 
														
															     nodenum = 0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     nodepos = {} 
														 | 
														
														 | 
														
															     nodepos = {} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    print(r'''\draw[thick] (0,0) -- ++(%lf,0);''' % 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        ((max_ts-min_ts)*timescale), file=tf) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    ts=0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    while ts<(max_ts-min_ts): 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        print(r'''\draw [thick] (%lf,.1) node [anchor=south] { %s } -- ++(0,-.1);''' % 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            (ts*timescale, str(ts)), file=tf) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        ts+=time_tick 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     for nodelog in nodelogs: 
														 | 
														
														 | 
														
															     for nodelog in nodelogs: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         node = nodelog[:-4] 
														 | 
														
														 | 
														
															         node = nodelog[:-4] 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         nodenum += 1 
														 | 
														
														 | 
														
															         nodenum += 1 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         nodepos[node] = -nodenum * nodescale 
														 | 
														
														 | 
														
															         nodepos[node] = -nodenum * nodescale 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        print(r'''\node [anchor=east] at (0,%f) { %s }; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-\draw[thick] (0,%f) -- ++(%f,0);''' % 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        print(r'''\node [anchor=east] at (0,%lf) { %s }; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+\draw[thick] (0,%lf) -- ++(%lf,0);''' % 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             (nodepos[node], node, nodepos[node], 
														 | 
														
														 | 
														
															             (nodepos[node], node, nodepos[node], 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             (max_ts-min_ts)*timescale), file=tf) 
														 | 
														
														 | 
														
															             (max_ts-min_ts)*timescale), file=tf) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     for (snd,recv) in messages: 
														 | 
														
														 | 
														
															     for (snd,recv) in messages: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         for msg in messages[(snd,recv)]: 
														 | 
														
														 | 
														
															         for msg in messages[(snd,recv)]: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            print(msg) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            print(r'''\fill [fill=%s,fill opacity=.2] (%f,%f) -- (%f,%f) -- (%f,%f) -- (%f,%f) -- cycle;''' % 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            print(r'''%% %s %s %s %lf %lf %lf %lf''' % (snd, recv, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                msg['size'], msg['queue_start'], msg['queue_end'], 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                msg['recv_start'], msg['recv_end']), file=tf) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            print(r'''\fill [fill=%s,fill opacity=.2] (%lf,%lf) -- 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            (%lf,%lf) -- (%lf,%lf) -- (%lf,%lf) -- cycle;''' % 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 ('black', 
														 | 
														
														 | 
														
															                 ('black', 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 (msg['queue_start']-min_ts)*timescale, nodepos[snd], 
														 | 
														
														 | 
														
															                 (msg['queue_start']-min_ts)*timescale, nodepos[snd], 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 (msg['queue_end']-min_ts)*timescale, nodepos[snd], 
														 | 
														
														 | 
														
															                 (msg['queue_end']-min_ts)*timescale, nodepos[snd], 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -147,6 +197,13 @@ with open("trace.tex", "w") as tf: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 (msg['recv_start']-min_ts)*timescale, nodepos[recv]), 
														 | 
														
														 | 
														
															                 (msg['recv_start']-min_ts)*timescale, nodepos[recv]), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                 file=tf) 
														 | 
														
														 | 
														
															                 file=tf) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    for node in labels: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        for (ts,label) in labels[node]: 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            print(r'''%% %lf''' % ts, file=tf) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            print(r'''\draw [thick] (%lf,%lf) node [anchor=south] { %s } -- ++(0,-.1);''' % 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                ((ts-min_ts)*timescale, nodepos[node]+.1, label), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                file=tf) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     print(r'''\end{tikzpicture} 
														 | 
														
														 | 
														
															     print(r'''\end{tikzpicture} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 \end{document}''', file=tf) 
														 | 
														
														 | 
														
															 \end{document}''', file=tf) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 |