138889Sjdp//===----------------------------------------------------------------------===//
278828Sobrien//
338889Sjdp// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
438889Sjdp// See https://llvm.org/LICENSE.txt for license information.
538889Sjdp// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
638889Sjdp//
738889Sjdp//===----------------------------------------------------------------------===//
838889Sjdp
938889Sjdp#include <algorithm>
1038889Sjdp
1138889Sjdp#include "common.h"
1238889Sjdp
1338889Sjdpnamespace {
1438889Sjdptemplate <class ValueType, class Order>
1538889Sjdpstruct MakeThenSortHeap {
1638889Sjdp  size_t Quantity;
1738889Sjdp
1838889Sjdp  void run(benchmark::State& state) const {
19218822Sdim    runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements,
2038889Sjdp                             [](auto& Copy) {
2138889Sjdp                               std::make_heap(Copy.begin(), Copy.end());
2238889Sjdp                               std::sort_heap(Copy.begin(), Copy.end());
2338889Sjdp                             });
2438889Sjdp  }
2538889Sjdp
2660484Sobrien  std::string name() const {
2738889Sjdp    return "BM_MakeThenSortHeap" + ValueType::name() + Order::name() + "_" +
2860484Sobrien           std::to_string(Quantity);
2977298Sobrien  };
3060484Sobrien};
3160484Sobrien} // namespace
3260484Sobrien
3360484Sobrienint main(int argc, char** argv) {
3460484Sobrien  benchmark::Initialize(&argc, argv);
3577298Sobrien  if (benchmark::ReportUnrecognizedArguments(argc, argv))
3660484Sobrien    return 1;
3738889Sjdp  makeCartesianProductBenchmark<MakeThenSortHeap, AllValueTypes, AllOrders>(Quantities);
3838889Sjdp  benchmark::RunSpecifiedBenchmarks();
3938889Sjdp}
4038889Sjdp