MCPcopy Create free account
hub / github.com/acl-dev/acl / get

Method get

lib_acl_cpp/samples/benchmark/wiredtiger/main.cpp:191–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189 }
190
191 void get(wdb_sess& sess, long long max) {
192 acl::string key, value;
193 long long i;
194 long long n, j = 0, k = max - 1;
195
196 struct timeval begin;
197 gettimeofday(&begin, NULL);
198
199 for (i = 0; i < max; i++) {
200 if (i % 2 == 0) {
201 key.format("key-%d-%lld", id_, j++);
202 } else {
203 key.format("key-%d-%lld", id_, k--);
204 }
205
206 bool ret = sess.get(key.c_str(), value);
207 if (!ret) {
208 printf("Get failed, key=%s\r\n", key.c_str());
209 break;
210 } else if (i < 10) {
211 printf("key=%s, value=%s\r\n",
212 key.c_str(), value.c_str());
213 }
214 n = ++__count;
215 if (i % __inter == 0) {
216 char buf[128];
217 snprintf(buf, sizeof(buf), "i=%lld, count=%lld, value=%s",
218 i, n, value.c_str());
219 acl::meter_time(__FILE__, __LINE__, buf);
220 }
221 }
222
223 struct timeval end;
224 gettimeofday(&end, NULL);
225 double spent = acl::stamp_sub(end, begin);
226 double speed = (i * 1000) / ( spent > 1 ? spent : 1);
227 printf("get over, n=%lld, spend=%.2f seconds, speed=%.2f\r\n",
228 i, spent / 1000, speed);
229 }
230
231 void del(wdb_sess& sess, long long max) {
232 acl::string key;

Callers

nothing calls this directly

Calls 6

meter_timeFunction · 0.85
gettimeofdayFunction · 0.50
stamp_subFunction · 0.50
formatMethod · 0.45
getMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected