def _CalcThroughput(samples):
  """Calculates the throughput in MiB/second.

  @type samples: sequence
  @param samples: List of samples, each consisting of a (timestamp, mbytes)
                  tuple
  @rtype: float or None
  @return: Throughput in MiB/second

  """
  if len(samples) < 2:
    # Can't calculate throughput
    return None

  (start_time, start_mbytes) = samples[0]
  (end_time, end_mbytes) = samples[-1]

  return (float(end_mbytes) - start_mbytes) / (float(end_time) - start_time)