MCPcopy Create free account
hub / github.com/ElementsProject/elements / ReadRandom

Method ReadRandom

src/leveldb/benchmarks/db_bench.cc:767–783  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

765 }
766
767 void ReadRandom(ThreadState* thread) {
768 ReadOptions options;
769 std::string value;
770 int found = 0;
771 for (int i = 0; i < reads_; i++) {
772 char key[100];
773 const int k = thread->rand.Next() % FLAGS_num;
774 snprintf(key, sizeof(key), "%016d", k);
775 if (db_->Get(options, key, &value).ok()) {
776 found++;
777 }
778 thread->stats.FinishedSingleOp();
779 }
780 char msg[100];
781 snprintf(msg, sizeof(msg), "(%d of %d found)", found, num_);
782 thread->stats.AddMessage(msg);
783 }
784
785 void ReadMissing(ThreadState* thread) {
786 ReadOptions options;

Callers

nothing calls this directly

Calls 4

AddMessageMethod · 0.80
NextMethod · 0.45
GetMethod · 0.45
FinishedSingleOpMethod · 0.45

Tested by

no test coverage detected