Skip to content

Timings parsing

Matt Larsen edited this page Jan 19, 2021 · 2 revisions

This is an incomplete example, since I used it for a study, but its should be a good start.

import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import glob
import sys

file_list = glob.glob('*.csv')
print(file_list)

rank_dfs = []
for f in file_list:
  rank = f.split('_')[-1].split('.')[0]
  df = pd.read_csv(f, sep=' ', names=['cycle', 'name', 'time'])
  df['rank'] = int(rank)
  rank_dfs.append(df)

frame = pd.concat(rank_dfs)
print(frame)
#sys.exit(0)

max_rank = frame.groupby(['cycle', 'name'], as_index=False)['time'].max()
max_rank = max_rank.groupby(['cycle', 'name'], as_index=False)['time'].mean()

filter_list = ['exec_slice_scene',
               'exec_scene1',
               'exec_contour_scene',
               'slice_f1_slice',
               'velocity_mag_f1_contour',
               'velocity_mag_combine_composite_vector',
               'velocity_mag_magnitude_vector_magnitude']

# The filter time is determined my the rank that takes the longest
max_rank = max_rank[max_rank['name'].isin(filter_list)]

# map weird filter names to things that make more sense
name_map = {'exec_slice_scene' : 'render_slice',
             'exec_scene1' : 'render',
             'exec_contour_scene' : 'render_contour',
             'slice_f1_slice' : 'slice',
             'velocity_mag_f1_contour' : 'contour',
             'velocity_mag_combine_composite_vector' : 'composite_vector',
             'velocity_mag_magnitude_vector_magnitude' : 'vector_magnitde'}

max_rank['name'] = max_rank['name'].replace(name_map)

print(max_rank)
Clone this wiki locally