MCPcopy Create free account
hub / github.com/baidu/tera / Init

Method Init

src/tera_test_main.cc:62–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60 public:
61 KeySet() : key_num_(0) {}
62 void Init(const uint32_t key_num) {
63 key_num_ = key_num;
64
65 // gen row keys
66 while (keys_.size() < key_num) {
67 std::stringstream ss;
68 ss << ((uint64_t)rand()) * ((uint64_t)rand()) << "abcdefghijklmnopqrstuvwxyz";
69 std::string key = ss.str();
70 keys_[key] = 0;
71 keys_stat_[key] = false;
72 }
73 CHECK(keys_.size() == key_num);
74 srand(get_micros() % 1000000);
75
76 // fill key index_
77 std::map<std::string, uint64_t>::iterator it = keys_.begin();
78 index_.clear();
79 for (; it != keys_.end(); ++it) {
80 index_.push_back(&(it->first));
81 }
82
83 // fill column families
84 SplitString(FLAGS_column_families, ",", &cfs_);
85 CHECK(cfs_.size() > 0);
86 }
87
88 std::string RandKey() {
89 MutexLock l(&mu_);

Callers 1

RWConsistencyTestFunction · 0.45

Calls 5

push_backMethod · 0.80
get_microsFunction · 0.50
SplitStringFunction · 0.50
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected