def loadDataframe(mean_file): mean_ps = PerformanceStatistics(mean_file, index_col='layout') mean_df = mean_ps.getDataFrame() mean_df['walk_cycles'] = mean_ps.getWalkDuration() mean_df['cpu-cycles'] = mean_ps.getRuntime() df = mean_df[['walk_cycles', 'cpu-cycles']] return df
def loadDataframe(mean_file): mean_ps = PerformanceStatistics(mean_file) mean_df = mean_ps.getDataFrame() mean_df['walk_cycles'] = mean_ps.getWalkDuration() mean_df['cpu-cycles'] = mean_ps.getRuntime() mean_df['stlb_misses'] = mean_ps.getStlbMisses() mean_df['stlb_hits'] = mean_ps.getStlbHits() df = mean_df[['walk_cycles', 'stlb_misses', 'stlb_hits', 'cpu-cycles']] return df
def testSimpleInputFile(self): test_file = os.path.dirname(sys.argv[0]) + '/performance_statistics_test_data.csv' test_benchmark = 'my_gups/1GB' ps = PerformanceStatistics(test_file, 'benchmark') self.assertListEqual(ps.getIndexColumn().tolist(), ['my_gups/16GB', 'my_gups/1GB', 'my_gups/4GB']) self.assertEqual(ps.getWalkDuration(test_benchmark), 42850778964.0) self.assertEqual(ps.getStlbMisses(test_benchmark), 554443700.0) self.assertEqual(ps.getRuntime(test_benchmark), 31148327321.0)
def loadDataframe(mean_file, output): mean_ps = PerformanceStatistics(mean_file) mean_df = mean_ps.getDataFrame() mean_df['cpu-cycles'] = mean_ps.getRuntime() mean_df['walk_cycles'] = mean_ps.getWalkDuration() mean_df['stlb_hits'] = mean_ps.getStlbHits() mean_df['stlb_misses'] = mean_ps.getStlbMisses() df = mean_df[['layout', 'walk_cycles', 'stlb_hits', 'stlb_misses', 'cpu-cycles']] # drop duplicated rows important_columns = list(df.columns) important_columns.remove('layout') #df.drop_duplicates(inplace=True, subset=important_columns) df = df.drop_duplicates(subset=important_columns) df.to_csv(output) return df
def readSingle(mean_file, std_file, y_metric, x_metric): if x_metric == 'tlb_misses': metric_func = PerformanceStatistics.getStlbMisses elif x_metric == 'walk_cycles': metric_func = PerformanceStatistics.getWalkDuration else: raise Exception('Unknown x-metric: ' + x_metric) mean_ps = PerformanceStatistics(mean_file, 'layout') mean_df = mean_ps.getDataFrame() mean_df[x_metric] = metric_func(mean_ps) mean_df = mean_df[[x_metric, y_metric]] std_df = pd.DataFrame() if std_file: std_ps = PerformanceStatistics(std_file, 'layout') std_df = std_ps.getDataFrame() std_df[y_metric + '_std'] = std_df[y_metric] std_df[x_metric + '_std'] = metric_func(std_ps) std_df = std_df[[x_metric + '_std', y_metric + '_std']] output_df = pd.concat([mean_df, std_df], axis='columns') output_df.sort_values(x_metric, inplace=True) return output_df