MCPcopy Create free account
hub / github.com/couchbase/forestdb / reader_thread

Function reader_thread

tests/bench/fdb_bench.cc:343–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341}
342
343void *reader_thread(void *args){
344 TEST_INIT();
345
346 thread_context *ctx= (thread_context*)args;
347 fdb_kvs_handle *db = ctx->handle;
348 fdb_iterator *iterator;
349 fdb_doc *rdoc = NULL;
350 ts_nsec latency = 0;
351 float a_latency1 = 0.0, a_latency2 = 0.0;
352 int samples = 0;
353
354 latency = timed_fdb_iterator_init(db, &iterator);
355 ctx->latency1 = latency;
356
357 // repeat until fail
358 do {
359 // sum time of all gets
360 latency = timed_fdb_iterator_get(iterator, &rdoc);
361 fdb_doc_free(rdoc);
362 rdoc = NULL;
363 if(latency == ERR_NS){ break; }
364 a_latency1 += latency;
365
366 // sum time of calls to next
367 latency = timed_fdb_iterator_next(iterator);
368 if(latency == ERR_NS){ break; }
369 a_latency2 += latency;
370
371 samples++;
372
373 } while (latency != ERR_NS);
374
375 a_latency1 = a_latency1/samples;
376 a_latency2 = a_latency2/samples;
377
378 // get latency
379 ctx->avg_latency1 = a_latency1;
380 // seek latency
381 ctx->avg_latency2 = a_latency2;
382 // close latency
383 latency = timed_fdb_iterator_close(iterator);
384 ctx->latency2 = latency;
385
386 return NULL;
387}
388
389
390void single_file_single_kvs(int n_threads){

Callers

nothing calls this directly

Calls 4

timed_fdb_iterator_initFunction · 0.85
timed_fdb_iterator_getFunction · 0.85
timed_fdb_iterator_nextFunction · 0.85
timed_fdb_iterator_closeFunction · 0.85

Tested by

no test coverage detected