def load_idleness(log_file_name):
    log_lines = rslog.parse_log_file(log_file_name,
                                     ["pdu_send", "pdu_receive"])

    send_count = 0
    receive_count = 0
    node_dict = {}
    min_time = 100000000
    max_time = 0

    line_no = 0
    for log_line in log_lines:
        line_no += 1

        time = log_line[0]
        event_name = log_line[3]
        node_name = log_line[1]

        if event_name == "pdu_send":
            send_count += 1

        elif event_name == "pdu_receive":
            receive_count += 1

        if (time < min_time):
            min_time = time

        if (time > max_time):
            max_time = time

        node_dict[node_name] = True

    return (len(node_dict.keys()), max_time - min_time + 1, send_count,
            receive_count)
Beispiel #2
0
def load_idleness(log_file_name):
    log_lines = rslog.parse_log_file(log_file_name, ["pdu_send", "pdu_receive"])
    
    send_count = 0
    receive_count = 0
    node_dict = {}
    min_time = 100000000
    max_time = 0
    
    line_no = 0
    for log_line in log_lines:
        line_no += 1
        
        time = log_line[0]
        event_name = log_line[3]
        node_name = log_line[1]

        if event_name == "pdu_send":
            send_count += 1
            
        elif event_name == "pdu_receive":
            receive_count += 1
            
        if (time < min_time):
            min_time = time
        
        if (time > max_time):
            max_time = time
            
        node_dict[node_name] = True
    
    return (len(node_dict.keys()), max_time - min_time + 1, send_count, receive_count)
def load_convergence(log_file_name):
    log_lines = rslog.parse_log_file(log_file_name, ["trickle_i_timeout"])
    
    converg_list = []
    
    line_no = 0
    for log_line in log_lines:
        line_no += 1

        time = log_line[0]
        converg = log_line[4][1][1][12]
        
        converg_list.append((time, converg))

    return converg_list
def load_overhead(log_file_name):
    log_lines = rslog.parse_log_file(log_file_name,
                                     ["pdu_send", "pdu_receive"])

    send_count = 0
    receive_count = 0
    node_dict = {}
    min_time = 100000000
    max_time = 0

    line_no = 0
    for log_line in log_lines:
        line_no += 1

        time = log_line[0]
        event_name = log_line[3]
        node_name = log_line[1]
        dis_count = log_line[4][1][1][5]
        dio_count = log_line[4][1][1][6]
        dao_count = log_line[4][1][1][7]

        if event_name == "pdu_send":
            send_count += 1

        elif event_name == "pdu_receive":
            receive_count += 1

        if (time < min_time):
            min_time = time

        if (time > max_time):
            max_time = time

        node_dict[node_name] = (dis_count, dio_count, dao_count)

    dis_count = 0
    dio_count = 0
    dao_count = 0
    for node in node_dict:
        dis_count += node_dict[node][0]
        dio_count += node_dict[node][1]
        dao_count += node_dict[node][2]

    return (len(node_dict.keys()), max_time - min_time + 1, send_count,
            dis_count, dio_count, dao_count)
def load_rank_delay(log_file_name):
    log_lines = rslog.parse_log_file(
        log_file_name, ["ping_request", "ping_reply", "ping_timeout"])

    rank_delay_list = []
    ping_dict = {}

    line_no = 0
    for log_line in log_lines:
        line_no += 1

        time = log_line[0]
        event_name = log_line[3]
        src = log_line[4][0][1][4]
        dst = log_line[4][2][1]
        seq_num = log_line[4][3][1]
        rank = log_line[4][0][1][6]

        if event_name == "ping_request":
            ping_dict[src + dst + str(seq_num)] = (time, rank)

        elif event_name == "ping_reply":
            if ping_dict.has_key(dst + src + str(seq_num)):
                (req_time, rank) = ping_dict[dst + src + str(seq_num)]
                delay = time - req_time
                rank_delay_list.append((rank, delay))
                print("line_no = %d, rank = %d, delay = %d" %
                      (line_no, rank, delay))

                del (ping_dict[dst + src + str(seq_num)])

            else:  # reply came too late
                pass
                #print("unexpected ping reply encountered (@%d : %s -> %s)" % (time, src, dst))

        elif event_name == "ping_timeout":
            if ping_dict.has_key(dst + src + str(seq_num)):
                del (ping_dict[dst + src + str(seq_num)])

            else:  #
                pass

    return rank_delay_list
def load_overhead(log_file_name):
    log_lines = rslog.parse_log_file(log_file_name, ["pdu_send", "pdu_receive"])
    
    send_count = 0
    receive_count = 0
    node_dict = {}
    min_time = 100000000
    max_time = 0
    
    line_no = 0
    for log_line in log_lines:
        line_no += 1
        
        time = log_line[0]
        event_name = log_line[3]
        node_name = log_line[1]
        dis_count = log_line[4][1][1][5]
        dio_count = log_line[4][1][1][6]
        dao_count = log_line[4][1][1][7]

        if event_name == "pdu_send":
            send_count += 1
            
        elif event_name == "pdu_receive":
            receive_count += 1
            
        if (time < min_time):
            min_time = time
        
        if (time > max_time):
            max_time = time
            
        node_dict[node_name] = (dis_count, dio_count, dao_count)
    
    dis_count = 0
    dio_count = 0
    dao_count = 0
    for node in node_dict:
        dis_count += node_dict[node][0]
        dio_count += node_dict[node][1]
        dao_count += node_dict[node][2]
    
    return (len(node_dict.keys()), max_time - min_time + 1, send_count, dis_count, dio_count, dao_count)
Beispiel #7
0
def load_rank_delay(log_file_name):
    log_lines = rslog.parse_log_file(log_file_name, ["ping_request", "ping_reply", "ping_timeout"])
    
    rank_delay_list = []
    ping_dict = {}
    
    line_no = 0
    for log_line in log_lines:
        line_no += 1

        time = log_line[0]
        event_name = log_line[3]
        src = log_line[4][0][1][4]
        dst = log_line[4][2][1]
        seq_num = log_line[4][3][1]
        rank = log_line[4][0][1][6]

        if event_name == "ping_request":
            ping_dict[src + dst + str(seq_num)] = (time, rank)
        
        elif event_name == "ping_reply":
            if ping_dict.has_key(dst + src + str(seq_num)):
                (req_time, rank) = ping_dict[dst + src + str(seq_num)]
                delay = time - req_time
                rank_delay_list.append((rank, delay))
                print("line_no = %d, rank = %d, delay = %d" % (line_no, rank, delay))
                
                del(ping_dict[dst + src + str(seq_num)])
            
            else: # reply came too late
                pass
                #print("unexpected ping reply encountered (@%d : %s -> %s)" % (time, src, dst))
        
        elif event_name == "ping_timeout":
            if ping_dict.has_key(dst + src + str(seq_num)):
                del(ping_dict[dst + src + str(seq_num)])
            
            else: # 
                pass
            
    return rank_delay_list