def extract_split_timing_info(fn):
    """
    Group lines by benchmark iteration, starting from migrad until
    after the forks have been terminated.
    """
    with open(fn, 'r') as fh:
        lines = fh.read().splitlines()

    bm_iterations = []

    start_indices = []
    end_indices = []
    for ix, line in enumerate(lines):
        if 'start migrad' in line:
            if lines[ix - 1] == 'start migrad':  # sometimes 'start migrad' appears twice
                start_indices.pop()
            start_indices.append(ix)
        elif line[:11] == 'terminate: ':
            end_indices.append(ix)

    if len(start_indices) != len(end_indices):
        raise Exception("Number of start and end indices unequal!")

    for ix in range(len(start_indices)):
        bm_iterations.append(lines[start_indices[ix] + 1:end_indices[ix] + 1])

    return bm_iterations