def sim(df, percentile):
    df = df[(df.chain == 16)]
    df = df[(df.method != 'executeContract')]
    key = ['blockHeight', 'crankNum', 'vatID', 'deliveryNum', 'compute']
    df = df.groupby(key)[['dur']].aggregate(['count', 'mean', 'median', 'sum'])
    return df
    df = df[['blockHeight', 'crankNum', 'vatID', 'deliveryNum', 'compute']].sort_values(['blockHeight', 'crankNum', 'vatID', 'deliveryNum']).drop_duplicates()
    threshold = df.compute.quantile(percentile)
    df['running'] = df.compute.cumsum()
    df['sim_block'] = (df.running / threshold).round()
    return df.reset_index(drop=True)
def sim(df, percentile):
    df = df[(df.chain == 16)]
    df = df[(df.method != 'executeContract')]
    key = ['blockHeight', 'crankNum', 'vatID', 'deliveryNum', 'compute']
    df = df.groupby(key)[['dur']].aggregate(['count', 'mean', 'median', 'sum'])
    return df
    df = df[['blockHeight', 'crankNum', 'vatID', 'deliveryNum', 'compute']].sort_values(['blockHeight', 'crankNum', 'vatID', 'deliveryNum']).drop_duplicates()
    threshold = df.compute.quantile(percentile)
    df['running'] = df.compute.cumsum()
    df['sim_block'] = (df.running / threshold).round()
    return df.reset_index(drop=True)