def get_latencies(data):
    """Get the list of frame latencies and draw latencies for a
    benchmark.
    """
    msgs = data['messages'][1:]  # Skip the first message as a "warmup."

    all_latencies = []
    all_draw_latencies = []
    for msg in msgs:
        # As a sanity check, we can get an average frame latency for the
        # entire message with:
        # avg_latency = msg['ms'] / msg['frames']

        all_latencies += msg['latencies']
        all_draw_latencies += msg['draw_latencies']

    # More sanity checking: we should have the same number of overall and
    # draw-call latencies, and the draw latency should always be less than the
    # overall latency.
    assert len(all_latencies) == len(all_draw_latencies)
    # print(data['fn'], file=sys.stderr)
    for l, dl in zip(all_latencies, all_draw_latencies):
        # print(l, dl, file=sys.stderr)
        assert dl <= l

    return all_latencies, all_draw_latencies