本文整理汇总了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();
}
}
示例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));
}
}
示例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();
}
}
示例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());
}
示例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();
}
}
示例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);
}
}
示例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);
}
示例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");
}
示例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);
}
}
示例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());
}
示例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());
}
}
示例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));
}
}
示例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);
}
}
}
示例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);
示例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());
}