当前位置: 首页>>代码示例>>C++>>正文


C++ State::KeepRunning方法代码示例

本文整理汇总了C++中benchmark::State::KeepRunning方法的典型用法代码示例。如果您正苦于以下问题:C++ State::KeepRunning方法的具体用法?C++ State::KeepRunning怎么用?C++ State::KeepRunning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在benchmark::State的用法示例。


在下文中一共展示了State::KeepRunning方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BM_Find

static void BM_Find(benchmark::State& st, Container c, GenInputs gen) {
    auto in = gen(st.range(0));
    c.insert(in.begin(), in.end());
    benchmark::DoNotOptimize(&(*c.begin()));
    const auto end = in.data() + in.size();
    while (st.KeepRunning()) {
        for (auto it = in.data(); it != end; ++it) {
            benchmark::DoNotOptimize(&(*c.find(*it)));
        }
        benchmark::ClobberMemory();
    }
}
开发者ID:markus-oberhumer,项目名称:libcxx,代码行数:12,代码来源:ContainerBenchmarks.hpp

示例2: bm_rank

static void bm_rank(benchmark::State& state) {
  const auto br = gen_binary_relation(/*max_size=*/1'000'000,
                                      /*max_object=*/object_id(100'000),
                                      /*max_label=*/label_id(state.range(0)));

  while (state.KeepRunning()) {
    auto const max_object = gen_object(br);
    auto const max_label = gen_label(br);

    DoNotOptimize(br.rank(max_object, max_label));
  }
}
开发者ID:dieram3,项目名称:binrel_wt,代码行数:12,代码来源:binary_relation.bench.cpp

示例3: BM_InsertValueRehash

void BM_InsertValueRehash(benchmark::State& st, Container c, GenInputs gen) {
    auto in = gen(st.range(0));
    const auto end = in.end();
    while (st.KeepRunning()) {
        c.clear();
        c.rehash(16);
        for (auto it = in.begin(); it != end; ++it) {
            benchmark::DoNotOptimize(&(*c.insert(*it).first));
        }
        benchmark::ClobberMemory();
    }
}
开发者ID:markus-oberhumer,项目名称:libcxx,代码行数:12,代码来源:ContainerBenchmarks.hpp

示例4: NOLINT

void BM_SymplecticRungeKuttaNyströmIntegratorSolveHarmonicOscillator3D(
    benchmark::State& state) {  // NOLINT(runtime/references)
  Length q_error;
  Speed v_error;
  while (state.KeepRunning()) {
    SolveHarmonicOscillatorAndComputeError3D(state, q_error, v_error,
                                             integrator());
  }
  std::stringstream ss;
  ss << q_error << ", " << v_error;
  state.SetLabel(ss.str());
}
开发者ID:mkalte666,项目名称:Principia,代码行数:12,代码来源:symplectic_runge_kutta_nyström_integrator.cpp

示例5: BM_lookupEventFormat

/*
 *	Measure the time it takes for android_lookupEventFormat_len
 */
static void BM_lookupEventFormat(benchmark::State& state) {
  prechargeEventMap();

  std::unordered_set<uint32_t>::const_iterator it = set.begin();

  while (state.KeepRunning()) {
    size_t len;
    android_lookupEventFormat_len(map, &len, (*it));
    ++it;
    if (it == set.end()) it = set.begin();
  }
}
开发者ID:android,项目名称:platform_system_core,代码行数:15,代码来源:liblog_benchmark.cpp

示例6: API_renderStill_reuse_map_switch_styles

static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) {
    RenderBenchmark bench;
    HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.fileSource, bench.threadPool };
    Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.fileSource, bench.threadPool, MapMode::Still };
    
    while (state.KeepRunning()) {
        prepare(map, { "{}" });
        frontend.render(map);
        prepare(map);
        frontend.render(map);
    }
}
开发者ID:iosphere,项目名称:mapbox-gl-native,代码行数:12,代码来源:render.benchmark.cpp

示例7: AUDIT_handleReply

static void AUDIT_handleReply(benchmark::State& state) {
  auto reply = getMockReply(kBenchmarkMessages[0]);

  while (state.KeepRunning()) {
    auto ec = std::make_shared<AuditEventContext>();

    // Perform the parsing.
    handleAuditReply(reply, ec);
  }

  free((void*)reply.message);
}
开发者ID:Centurion89,项目名称:osquery,代码行数:12,代码来源:audit_benchmarks.cpp

示例8: DATABASE_store_large

static void DATABASE_store_large(benchmark::State& state) {
  // Serialize the example result set into a string.
  std::string content;
  auto qd = getExampleQueryData(20, 100);
  serializeQueryDataJSON(qd, content);

  while (state.KeepRunning()) {
    setDatabaseValue(kPersistentSettings, "benchmark", content);
  }
  // All benchmarks will share a single database handle.
  deleteDatabaseValue(kPersistentSettings, "benchmark");
}
开发者ID:PoppySeedPlehzr,项目名称:osquery,代码行数:12,代码来源:database_benchmarks.cpp

示例9: while

static void Base58Encode(benchmark::State& state)
{
    unsigned char buff[32] = {
        17, 79, 8, 99, 150, 189, 208, 162, 22, 23, 203, 163, 36, 58, 147,
        227, 139, 2, 215, 100, 91, 38, 11, 141, 253, 40, 117, 21, 16, 90,
        200, 24
    };
    unsigned char* b = buff;
    while (state.KeepRunning()) {
        EncodeBase58(b, b + 32);
    }
}
开发者ID:CryptAxe,项目名称:bitcoin,代码行数:12,代码来源:base58.cpp

示例10: root

static
void
literal(::benchmark::State& state) {
    root_logger_t root({});
    logger_facade<root_logger_t> logger(root);

    while (state.KeepRunning()) {
        logger.log(0, "[::] - esafronov [10/Oct/2000:13:55:36 -0700] 'GET /porn.png HTTP/1.0' 200 2326");
    }

    state.SetItemsProcessed(state.iterations());
}
开发者ID:3Hren,项目名称:blackhole,代码行数:12,代码来源:logger.cpp

示例11: while

static void Base58Encode(benchmark::State& state)
{
    static const std::array<unsigned char, 32> buff = {
        {
            17, 79, 8, 99, 150, 189, 208, 162, 22, 23, 203, 163, 36, 58, 147,
            227, 139, 2, 215, 100, 91, 38, 11, 141, 253, 40, 117, 21, 16, 90,
            200, 24
        }
    };
    while (state.KeepRunning()) {
        EncodeBase58(buff.data(), buff.data() + buff.size());
    }
}
开发者ID:994920256,项目名称:bitcoin,代码行数:13,代码来源:base58.cpp

示例12: bm_nth_element_obj_maj

static void bm_nth_element_obj_maj(benchmark::State& state) {
  const auto br = gen_binary_relation(/*max_size=*/1'000'000,
                                      /*max_object=*/object_id(100'000),
                                      /*max_label=*/label_id(state.range(0)));

  while (state.KeepRunning()) {
    auto obj_start = gen_object(br);
    auto lab_range = gen_label_range(br);

    DoNotOptimize(br.nth_element(obj_start, lab_range.first, lab_range.second,
                                 42, brwt::obj_major));
  }
}
开发者ID:dieram3,项目名称:binrel_wt,代码行数:13,代码来源:binary_relation.bench.cpp

示例13: PrevectorResize

static void PrevectorResize(benchmark::State& state)
{
    while (state.KeepRunning()) {
        prevector<28, T> t0;
        prevector<28, T> t1;
        for (auto x = 0; x < 1000; ++x) {
            t0.resize(28);
            t0.resize(0);
            t1.resize(29);
            t1.resize(0);
        }
    }
}
开发者ID:994920256,项目名称:bitcoin,代码行数:13,代码来源:prevector.cpp

示例14: Parse_Filter

static void Parse_Filter(benchmark::State& state) {
    while (state.KeepRunning()) {
        parse(R"FILTER(["==", "foo", "bar"])FILTER");
    }
}

static void Parse_EvaluateFilter(benchmark::State& state) {
    const style::Filter filter = parse(R"FILTER(["==", "foo", "bar"])FILTER");
    const PropertyMap properties = { { "foo", std::string("bar") } };

    while (state.KeepRunning()) {
        filter(FeatureType::Unknown, {}, [&] (const std::string& key) -> optional<Value> {
            auto it = properties.find(key);
            if (it == properties.end())
                return {};
            return it->second;
        });
    }
}

BENCHMARK(Parse_Filter);
BENCHMARK(Parse_EvaluateFilter);
开发者ID:Budroid,项目名称:mapbox-gl-native,代码行数:22,代码来源:filter.benchmark.cpp

示例15: BM_DecodePi

void BM_DecodePi(benchmark::State& state) {  // NOLINT(runtime/references)
  bool correct = true;
  state.PauseTiming();
  std::vector<uint8_t> input_digits = Digits();
  std::vector<uint8_t> expected_bytes = Bytes();
  state.ResumeTiming();
  while (state.KeepRunning()) {
    HexDecode(&state, &correct, input_digits, expected_bytes);
  }
  std::stringstream ss;
  ss << correct;
  state.SetLabel(ss.str());
}
开发者ID:d235j,项目名称:Principia,代码行数:13,代码来源:hexadecimal.cpp


注:本文中的benchmark::State::KeepRunning方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。