def main(args: List[str]):
    file_paths: List[str] = glob.glob("../input/*.log")
    result = ['start', 'end', 'diff']
    for file_path in file_paths:
        with open(file_path, 'r', encoding="utf-8_sig") as f:
            lines = f.readlines()
            analyze_time_logs(lines, result, int(args[0]))
    write_csv_file(result)
Пример #2
0
def analyze_vmstat_log(lines: List[str], is_output_excel: bool, filter_start_time: Optional, filter_end_time: Optional):
    vmstat_array2d: List[List[str]] = []
    analyze_vmstat_log_lines(lines, filter_start_time, filter_end_time, vmstat_array2d)
    header_labels = [''] + HEADER_LABELS
    view_line_graph_cpu_use(GRAPH_TITLE, vmstat_array2d)
    vmstat_array2d.append(['MAX:'] + create_max_value_row(vmstat_array2d))
    vmstat_array2d.append(['AVG:'] + create_average_value_row(vmstat_array2d))
    write_csv_file(OUTPUT_FILE_NAME, header_labels, vmstat_array2d)
    plt.show()
Пример #3
0
def analyze_free_logs(lines: List[str], is_output_excel, filter_start_time,
                      filter_end_time):
    free_array2d: List[List[str]] = []
    param_names: List[str] = [''] + analyze_free_params(lines[0])
    total: int = get_total_memory(lines)
    analyze_free_log_lines(lines, total, filter_start_time, filter_end_time,
                           free_array2d)
    view_line_graph(GRAPH_TITLE, total, param_names, free_array2d)
    free_array2d.append(['MAX:'] + create_max_value_row(free_array2d))
    free_array2d.append(['AVG:'] + create_average_value_row(free_array2d))
    write_csv_file(OUTPUT_FILE_NAME, param_names, free_array2d)
    plt.show()
Пример #4
0
def analyze_df_logs(lines: List[str], is_time_range_hour_option,
                    filter_start_time, filter_end_time):
    df_array2d: List[List[str]] = []
    filesystems: List[str] = []
    filesystem_total_sizes: List[str] = []
    get_filesystem_and_total_size(lines, filesystems, filesystem_total_sizes)
    analyze_df_log_lines(lines, filter_start_time, filter_end_time,
                         filesystems, df_array2d)
    for index in range(len(filesystems)):
        view_line_graph(GRAPH_TITLE, filesystems, df_array2d,
                        is_time_range_hour_option, index + 1)
    df_array2d.append(['TOTAL:'] + filesystem_total_sizes)
    df_array2d.append(['MAX:'] + create_max_value_row(df_array2d))
    df_array2d.append(['AVG:'] + create_average_value_row(df_array2d))
    write_csv_file(OUTPUT_FILE_NAME, filesystems, df_array2d)
    plt.show()
Пример #5
0
def analyze_iostat_log(lines, is_output_excel, is_view_graph,
                       filter_start_time, filter_end_time):
    dev_partition_names: List[str] = []
    read_iops_array2d: List[List[str]] = []
    write_iops_array2d: List[List[str]] = []
    analyze_iostat_log_lines(lines, filter_start_time, filter_end_time,
                             dev_partition_names, read_iops_array2d,
                             write_iops_array2d)
    dev_partition_names = [''] + dev_partition_names
    view_line_graph(dev_partition_names, read_iops_array2d, write_iops_array2d)
    read_iops_array2d.append(['MAX:'] +
                             create_max_value_row(read_iops_array2d))
    read_iops_array2d.append(['AVG:'] +
                             create_average_value_row(read_iops_array2d))
    write_iops_array2d.append(['MAX:'] +
                              create_max_value_row(write_iops_array2d))
    write_iops_array2d.append(['AVG:'] +
                              create_average_value_row(write_iops_array2d))
    write_csv_file(IOSTAT_READ_IO_FILE_NAME, dev_partition_names,
                   read_iops_array2d)
    write_csv_file(IOSTAT_WRITE_IO_FILE_NAME, dev_partition_names,
                   write_iops_array2d)
    plt.show()