std::vector GetSortedOperationIndex()

in e2e-examples/gcs/benchmark/print_result.cc [43:56]


std::vector<size_t> GetSortedOperationIndex(
    std::vector<RunnerWatcher::Operation>& operations) {
  std::vector<size_t> indexes;
  for (size_t i = 0, i_max = operations.size(); i < i_max; i++) {
    if (operations[i].status.ok()) {
      indexes.push_back(i);
    }
  }
  // Sorted by throughput in an ascending order
  std::sort(indexes.begin(), indexes.end(), [&operations](size_t a, size_t b) {
    return operations[a].elapsed_time > operations[b].elapsed_time;
  });
  return indexes;
}