def get_aggregated_experiment_statistics(self, type='timer', name='run', dbms_filter=[], warmup=0, cooldown=0, factor_base='Mean', query_aggregate='Mean', total_aggregate='Mean'): if query_aggregate is not None: df = self.get_aggregated_query_statistics(type, name, dbms_filter, warmup, cooldown, factor_base, query_aggregate) if df.empty: return df df_stat = evaluator.addStatistics(df, drop_nan=False, drop_measures=True) return pd.DataFrame(df_stat[total_aggregate]).rename( columns={total_aggregate: "total_" + type + "_" + name}) else: df_measures = {} for numQuery in self.get_experiment_queries_successful()[0]: df1, df2 = self.get_measures_and_statistics( numQuery + 1, type=type, name=name, dbms_filter=dbms_filter, warmup=warmup, cooldown=cooldown, factor_base=factor_base) df_measures[numQuery + 1] = (df1.copy()) #print(df_measures) n = len(df1.columns) #print(n) df_result = pd.DataFrame() for i in range(0, n): df_tmp = pd.DataFrame() for q, df in df_measures.items(): #print(df[i]) df_tmp.insert(loc=len(df_tmp.columns), column=q, value=df[i]) #print(df_tmp) df_tmp = evaluator.dfSubRows(df_tmp, dbms_filter) df_stat = evaluator.addStatistics(df_tmp, drop_nan=False, drop_measures=True) #print(df_stat[total_aggregate]) df_result.insert(loc=len(df_result.columns), column=i, value=df_stat[total_aggregate]) #print(df_result) return df_result
def get_measures_and_statistics(self, numQuery, type='timer', name='run', dbms_filter=[], warmup=0, cooldown=0, factor_base='Mean'): if type == 'timer': df = self.get_timer(numQuery, name, warmup=warmup, cooldown=cooldown) df = evaluator.dfSubRows(df, dbms_filter) df_stat = evaluator.addStatistics(df, drop_nan=False, drop_measures=True) elif type == 'monitoring': df = self.get_hardware_metrics(numQuery, name, warmup=warmup, cooldown=cooldown) df = evaluator.dfSubRows(df, dbms_filter) df = self.dfCleanMonitoring(df) # remove extension interval #df = df_cleaned #df_cleaned = self.dfCleanMonitoring(df.copy()) #df_stat = evaluator.addStatistics(df_cleaned, drop_nan=False, drop_measures=True) df_stat = evaluator.addStatistics(df, drop_nan=False, drop_measures=True) elif type == 'latency': df = self.get_lat(numQuery, name, warmup=warmup, cooldown=cooldown) df = evaluator.dfSubRows(df, dbms_filter) df_stat = evaluator.addStatistics(df, drop_nan=False, drop_measures=True) elif type == 'throughput': df = self.get_tp(numQuery, name, warmup=warmup, cooldown=cooldown) df = evaluator.dfSubRows(df, dbms_filter) df_stat = evaluator.addStatistics(df, drop_nan=False, drop_measures=True) else: print("Unknown type") return None, None if df_stat.empty: print("No data") return df, df_stat if len(factor_base) > 0: df_stat = evaluator.addFactor(df_stat, factor_base) return df, df_stat
def get_aggregated_by_connection(self, dataframe, list_connections=[], connection_aggregate='Mean'): df_stats = pd.DataFrame() if len(list_connections) > 0: for i, l2 in list_connections.items(): df = pd.DataFrame() for c in l2: df.insert(len(df.columns), column=c, value=dataframe.loc[c]) df = evaluator.addStatistics(df) df_stats.insert(len(df_stats.columns), column=i, value=df[connection_aggregate]) else: df_stats = evaluator.addStatistics(dataframe.T, drop_measures=True) df_stats = pd.DataFrame(df_stats[connection_aggregate]) return df_stats.T
def plot_measures(self, dataframe, connection_colors): print(evaluator.addStatistics(dataframe) ['Mean']) # little affected by window print(evaluator.addStatistics(dataframe) ['Median']) # much affected by window print(evaluator.addStatistics( dataframe, drop_measures=True)) # variation and max drops df_nums = df_get_number_of_measures(dataframe) # total CPU in unit CPU-seconds print(dataframe.mean(axis=1) * df_nums) fig = go.Figure() for i in range(len(dataframe.index)): t = fig.add_trace( go.Scatter(x=dataframe.T.index, y=dataframe.iloc[i], name=dataframe.index[i], line=dict( color=connection_colors[dataframe.index[i]], width=1))) n = fig.update_layout(yaxis=dict(range=[0, dataframe.max().max()])) fig.show()