• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include <algorithm>
10 
11 #include "common.h"
12 
13 namespace {
14 template <class ValueType, class Order>
15 struct PushHeap {
16   size_t Quantity;
17 
run__anona01c3d200111::PushHeap18   void run(benchmark::State& state) const {
19     runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
20       for (auto I = Copy.begin(), E = Copy.end(); I != E; ++I) {
21         std::push_heap(Copy.begin(), I + 1);
22       }
23     });
24   }
25 
skip__anona01c3d200111::PushHeap26   bool skip() const { return Order() == ::Order::Heap; }
27 
name__anona01c3d200111::PushHeap28   std::string name() const {
29     return "BM_PushHeap" + ValueType::name() + Order::name() + "_" + std::to_string(Quantity);
30   };
31 };
32 } // namespace
33 
main(int argc,char ** argv)34 int main(int argc, char** argv) {
35   benchmark::Initialize(&argc, argv);
36   if (benchmark::ReportUnrecognizedArguments(argc, argv))
37     return 1;
38   makeCartesianProductBenchmark<PushHeap, AllValueTypes, AllOrders>(Quantities);
39   benchmark::RunSpecifiedBenchmarks();
40 }
41