def nginx_graph(df: pd.DataFrame, metric: str) -> Any: plot_col = ["system"] thru_ylabel = None width = None if metric == "lat": plot_col.append("lat_avg(ms)") width = 0.25 elif metric == "thru": plot_col.append("req_sec_tot") width = 0.3 plot_df = df[plot_col] groups = len(set((list(plot_df["system"].values)))) plot_df = apply_aliases(plot_df) g = catplot(data=plot_df, x=plot_df.columns[0], y=plot_df.columns[1], kind="bar", order=systems_order(plot_df), height=2.5, legend=False, palette=None, color="black" # aspect=1.2, ) apply_to_graphs(g.ax, False, -1, width) if metric == "thru": thru_ylabel = g.ax.get_yticklabels() thru_ylabel = [str(int(int(x.get_text()))) for x in thru_ylabel] thru_ylabel[0] = "0" g.ax.set_yticklabels(thru_ylabel) return g
def syscalls_perf_graph(df: pd.DataFrame) -> Any: df2 = df[(df.data_size == 32) & (df.threads == 8)] df2 = df2.assign( time_per_syscall=10e6 * df2.total_time / (df2.packets_per_thread * df2.threads) ) g = catplot( data=apply_aliases(df2), x=column_alias("system"), y=column_alias("time_per_syscall"), order=systems_order(df2), kind="bar", height=2.5, # aspect=1.2, color=color, palette=None, ) # change_width(g.ax, 0.405) # g.ax.set_xlabel("") # g.ax.set_ylabel(g.ax.get_ylabel(), fontsize=8) # g.ax.set_xticklabels(g.ax.get_xmajorticklabels(), fontsize=8) # g.ax.set_yticklabels(g.ax.get_ymajorticklabels(), fontsize=8) # g.ax.grid(which="major") apply_to_graphs(g.ax, False, -1, 0.28) return g
def sqlite_graph(df: pd.DataFrame) -> Any: plot_df = df df = df[df.columns[2]] df = df.map(apply_sqlite_rows) plot_df.update(df) plot_df["sqlite-op-type"] = plot_df["sqlite-op-type"].map({ "5000 INSERTs into table with no index": "Insert", "5000 UPDATES of individual rows": "Update", "5000 DELETEs of individual rows": "Delete", }) groups = len(set((list(plot_df["system"].values)))) plot_df = apply_aliases(plot_df) g = catplot( data=plot_df, x=plot_df.columns[0], y=plot_df.columns[2], kind="bar", height=2.5, # aspect=0.8, order=systems_order(plot_df), hue="Operation", legend=False, palette=["darkgrey", "gray", "black"], ) apply_to_graphs(g.ax, True, 3, 0.285) g.ax.legend(frameon=False) return g
def fio_read_write_graph(df: pd.DataFrame) -> Any: df = pd.melt( df, id_vars=["system", "job"], value_vars=["read-bw", "write-bw"], var_name="operation", value_name="disk-throughput", ) df = df.groupby(["system", "operation"]).sum().reset_index() df["disk-throughput"] /= 1024 g = catplot( data=apply_aliases(df), x=column_alias("system"), y=column_alias("disk-throughput"), hue=column_alias("operation"), order=systems_order(df), kind="bar", height=2.5, palette=palette, legend=False, # aspect=1.2, ) # change_width(g.ax, 0.405) # g.ax.set_xlabel("") # g.ax.legend(loc="center", bbox_to_anchor=(0.5, 1.05), ncol=2, frameon=False) apply_to_graphs(g.ax, True, 2, 0.285) # g.ax.grid(which="major") return g
def mysql_throughput_graph(df: pd.DataFrame) -> Any: df = df[["system", "SQL statistics transactions", "General statistics total time"]] df["General statistics total time"] = df["General statistics total time"].apply( lambda x: float(x.replace("s", "")) ) df["mysql-throughput"] = ( df["SQL statistics transactions"] / df["General statistics total time"] ) df = apply_aliases(df) g = catplot( data=df, x=column_alias("system"), y=column_alias("mysql-throughput"), kind="bar", height=2.5, # aspect=1.2, color=color, palette=None, order=systems_order(df), ) apply_to_graphs(g.ax, False, -1, 0.285) return g
def mysql_latency_graph(df: pd.DataFrame) -> Any: groups = len(set((list(df["system"].values)))) g = catplot( data=apply_aliases(df), x=column_alias("system"), y=column_alias("Latency (ms) avg"), kind="bar", height=2.5, # aspect=1.2, color=color, palette=None, order=systems_order(df), ) apply_to_graphs(g.ax, False, -1, 0.285) return g
def iperf_graph(df: pd.DataFrame) -> Any: df = df[df["direction"] == "send"] df["iperf-throughput"] = df["bytes"] / df["seconds"] * 8 / 1e9 g = catplot( data=apply_aliases(df), x=column_alias("system"), order=systems_order(df), y=column_alias("iperf-throughput"), kind="bar", height=2.5, # aspect=1.2, color=color, palette=None, ) # change_width(g.ax, 0.405) # g.ax.set_xlabel("") apply_to_graphs(g.ax, False, -1, 0.285) # g.ax.grid(which="major") return g
def redis_graph(df: pd.DataFrame, metric: str) -> Any: df_flag = None hue = None col_name = None legend = False color = None palette = None n_cols = None thru_ylabel = None width = None if metric == "thru": df_flag = df["metric"] == "Throughput(ops/sec)" col_name = "Throughput(ops/sec)" width = 0.285 legend = False elif metric == "lat": df_flag = (df["metric"] == "AverageLatency(us)") & (df["operation"] != "[CLEANUP]") col_name = "AverageLatency(us)" hue = "operation" legend = True width = 0.285 plot_df = df[df_flag] groups = len(set((list(plot_df["system"].values)))) plot_df = plot_df.drop(["metric"], axis=1) plot_df = plot_df.rename(columns={"value": col_name}) plot_df = apply_aliases(plot_df) if hue is None: color = "black" palette = None else: palette = ["grey", "black"] n_cols = 2 g = catplot( data=plot_df, x=plot_df.columns[0], y=plot_df.columns[-1], hue=hue, kind="bar", height=2.5, order=systems_order(plot_df), # aspect=1.2, legend=False, palette=palette, color=color, ) apply_to_graphs(g.ax, legend, n_cols, width) g.ax.legend(ncol=2, loc="upper center", bbox_to_anchor=(0.5, 1.05), frameon=False) if metric == "thru": thru_ylabel = g.ax.get_yticklabels() thru_ylabel = [ str(float(float(x.get_text()) / 1000)) + "k" for x in thru_ylabel ] thru_ylabel[0] = "0" thru_ylabel = [x.replace(".0k", "k") for x in thru_ylabel] g.ax.set_yticklabels(thru_ylabel) return g