def GetInputLatencyEvents(process, timeline_range):
  """Get input events' LatencyInfo from the process's trace buffer that are
     within the timeline_range.

  Input events dump their LatencyInfo into trace buffer as async trace event
  with name "InputLatency". The trace event has a memeber 'data' containing
  its latency history.

  """
  input_events = []
  if not process:
    return input_events
  for event in process.IterAllAsyncSlicesOfName('InputLatency'):
    if event.start >= timeline_range.min and event.end <= timeline_range.max:
      for ss in event.sub_slices:
        if 'data' in ss.args:
          input_events.append(ss)
  return input_events