MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / HandleClientBenGet

Function HandleClientBenGet

src/cmd/fedb.cc:3365–3400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3363}
3364
3365void HandleClientBenGet(std::vector<std::string>& parts, // NOLINT
3366 ::fedb::client::TabletClient* client) {
3367 try {
3368 uint32_t tid = boost::lexical_cast<uint32_t>(parts[1]);
3369 uint32_t pid = boost::lexical_cast<uint32_t>(parts[2]);
3370 uint64_t key_num = 1000000;
3371 if (parts.size() >= 4) {
3372 key_num = ::boost::lexical_cast<uint64_t>(parts[3]);
3373 }
3374 uint32_t times = 10000;
3375 if (parts.size() >= 5) {
3376 times = ::boost::lexical_cast<uint32_t>(parts[4]);
3377 }
3378 int num = 100;
3379 if (parts.size() >= 6) {
3380 num = ::boost::lexical_cast<int>(parts[5]);
3381 }
3382 std::string value;
3383 uint64_t base = 100000000;
3384 std::random_device rd;
3385 std::default_random_engine engine(rd());
3386 std::uniform_int_distribution<> dis(1, key_num);
3387 std::string msg;
3388 while (num > 0) {
3389 for (uint32_t i = 0; i < times; i++) {
3390 std::string key = std::to_string(base + dis(engine));
3391 uint64_t ts = 0;
3392 client->Get(tid, pid, key, 0, value, ts, msg);
3393 }
3394 client->ShowTp();
3395 num--;
3396 }
3397 } catch (boost::bad_lexical_cast& e) {
3398 std::cout << "put argument error!" << std::endl;
3399 }
3400}
3401
3402// the input format like put 1 1 key time value
3403void HandleClientPut(const std::vector<std::string>& parts,

Callers 1

StartClientFunction · 0.85

Calls 4

to_stringFunction · 0.85
ShowTpMethod · 0.80
sizeMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected