Ejemplo n.º 1
0
def mem_error(real_time_logfile, sim_time_logfile, real_mem_logfile, sim_mem_logfile):
    real_time_log = log_parse.read_timelog(real_time_logfile, skip_header=False)
    real_mem_log = log_parse.read_atop_log(real_mem_logfile)

    dirty_origin = real_mem_log["dirty_data"][0]
    cache_origin = real_mem_log["cache"][0]

    real_dirty_amt = [amt for amt in get_atop_mem_prop(real_time_log, real_mem_log, "dirty_data")]
    real_cache_amt = [amt for amt in get_atop_mem_prop(real_time_log, real_mem_log, "cache")]

    # print(dirty_origin)
    print("real:")
    print(get_atop_mem_prop(real_time_log, real_mem_log, "dirty_data"))
    # print(real_mem_log["dirty_data"])

    sim_time_log = log_parse.read_timelog(sim_time_logfile)
    sim_mem_log = log_parse.read_sim_log(sim_mem_logfile)

    sim_dirty_amt = get_sim_mem_prop(sim_time_log, sim_mem_log, "dirty_data")
    sim_cache_amt = get_sim_mem_prop(sim_time_log, sim_mem_log, "cache")

    print("sim:")
    print(sim_dirty_amt)

    dirty_err = [abs(sim - real) / real for real, sim in zip(real_dirty_amt, sim_dirty_amt)]
    cache_err = [abs(sim - real) / real for real, sim in zip(real_cache_amt, sim_cache_amt)]

    return dirty_err, cache_err
Ejemplo n.º 2
0
def plot(atop_log_file, timestamps_file, collectl_log_file, input_size):
    atop_log = log_parse.read_atop_log(atop_log_file,
                                       dirty_ratio=0.4,
                                       dirty_bg_ratio=0.1)
    timestamps = log_parse.read_timelog(timestamps_file, skip_header=False)
    # timestamps = None

    figure = plt.figure()
    plt.tight_layout()
    ax1 = figure.add_subplot(2, 1, 1)
    ax2 = figure.add_subplot(2, 1, 2, sharex=ax1)

    ax1.set_ylim(top=280000, bottom=-10000)
    ax1.set_xlim(left=0, right=700)
    mem_plot(ax1, atop_log, timestamps, input_size)

    collectl_plot(ax2, collectl_log_file, timestamps)

    plt.show()
Ejemplo n.º 3
0
def real_subplot(subplot_ax,
                 real_time_file,
                 real_mem_file,
                 xmin,
                 xmax,
                 ymin,
                 ymax,
                 bar_alpha=0.2,
                 line_alpha=1,
                 linestyle=".-",
                 linewidth=2,
                 cond_text=None):
    timestamps = log_parse.read_timelog(real_time_file, skip_header=False)
    atop_log = log_parse.read_atop_log(real_mem_file,
                                       dirty_ratio=0.4,
                                       dirty_bg_ratio=0.1)
    dirty_data = np.array(atop_log["total"])
    intervals = len(dirty_data)
    time = np.arange(0, intervals)

    start = timestamps[0][1]

    for i in range(len(timestamps)):
        if timestamps[i][0] == "read":
            subplot_ax.axvspan(xmin=timestamps[i][1] - start,
                               xmax=timestamps[i][2] - start,
                               color="k",
                               alpha=0.1,
                               label="Read" if i == 0 else "")
        else:
            subplot_ax.axvspan(xmin=timestamps[i - 1][2] - start,
                               xmax=timestamps[i][1] - start,
                               color="k",
                               alpha=0.25,
                               label="Computation" if i == 1 else "")
            subplot_ax.axvspan(xmin=timestamps[i][1] - start,
                               xmax=timestamps[i][2] - start,
                               color="k",
                               alpha=0.4,
                               label="write" if i == 1 else "")

    # app_cache = list(np.array(app_mem) + np.array(cache_used))
    subplot_ax.plot(time,
                    atop_log["total"],
                    color='black',
                    linewidth=linewidth,
                    label="Total memory",
                    alpha=line_alpha)
    subplot_ax.plot(time,
                    atop_log["dirty_ratio"],
                    color='black',
                    linewidth=linewidth,
                    linestyle=":",
                    label="dirty_ratio",
                    alpha=line_alpha)
    subplot_ax.plot(time,
                    atop_log["used_mem"],
                    color='#72190E',
                    linewidth=linewidth,
                    linestyle=linestyle,
                    label="Used memory",
                    alpha=line_alpha)
    subplot_ax.plot(time,
                    atop_log["cache"],
                    color='#DC050C',
                    linewidth=linewidth,
                    linestyle=linestyle,
                    label="Cache",
                    alpha=line_alpha)
    subplot_ax.plot(time,
                    atop_log["dirty_data"],
                    color='#F4A736',
                    linewidth=linewidth,
                    linestyle=linestyle,
                    label="Dirty data",
                    alpha=line_alpha)