MCPcopy Create free account
hub / github.com/apache/brpc / fill_position_hint_map

Function fill_position_hint_map

test/flat_map_unittest.cpp:607–627  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

605typedef butil::FlatMap<uint64_t, uint64_t> PositionHintMap;
606
607static void fill_position_hint_map(PositionHintMap* map,
608 std::vector<uint64_t>* keys) {
609 srand(time(NULL));
610 const size_t N = 5;
611 if (!map->initialized()) {
612 ASSERT_EQ(0, map->init(N * 3 / 2, 80));
613 }
614
615 keys->reserve(N);
616 keys->clear();
617 map->clear();
618 for (size_t i = 0; i < N; ++i) {
619 uint64_t key = rand();
620 if (map->seek(key)) {
621 continue;
622 }
623 keys->push_back(key);
624 (*map)[key] = i;
625 }
626 LOG(INFO) << map->bucket_info() << ", size=" << map->size();
627}
628
629struct CountOnPause {
630 CountOnPause() : num_paused(0) {}

Callers 1

TEST_FFunction · 0.85

Calls 8

initializedMethod · 0.45
initMethod · 0.45
reserveMethod · 0.45
clearMethod · 0.45
seekMethod · 0.45
push_backMethod · 0.45
bucket_infoMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected