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

Function sequential_set

tests/bench/fdb_bench.cc:147–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145
146
147void sequential_set(bool walflush){
148
149 TEST_INIT();
150
151 int i, n = NDOCS;
152 ts_nsec latency, latency_tot = 0, latency_tot2 = 0;
153 float latency_avg = 0;
154 char keybuf[256], metabuf[256], bodybuf[512];
155
156 fdb_file_handle *fhandle;
157 fdb_status status;
158 fdb_kvs_handle *kv, *snap_kv;
159 fdb_doc *doc = NULL;
160 fdb_iterator *iterator;
161
162 printf("\nBENCH-SEQUENTIAL_SET-WALFLUSH-%d \n", walflush);
163
164 // setup
165 setup_db(&fhandle, &kv);
166 str_gen(bodybuf, 64);
167
168 // create
169 for (i=0;i<n;++i){
170 sprintf(keybuf, "key%d", i);
171 sprintf(metabuf, "meta%d", i);
172 fdb_doc_create(&doc, (void*)keybuf, strlen(keybuf),
173 (void*)metabuf, strlen(metabuf), (void*)bodybuf, strlen(bodybuf));
174 status = fdb_set(kv, doc);
175 TEST_CHK(status == FDB_RESULT_SUCCESS);
176 fdb_doc_free(doc);
177 doc = NULL;
178 }
179
180
181 // commit
182 status = fdb_commit(fhandle, FDB_COMMIT_MANUAL_WAL_FLUSH);
183 TEST_CHK(status == FDB_RESULT_SUCCESS);
184
185 // create an iterator for full range
186 latency = timed_fdb_iterator_init(kv, &iterator);
187 print_stat(ST_ITR_INIT, latency);
188
189 for (i=0;i<n;++i){
190
191 // sum time of all gets
192 latency = timed_fdb_iterator_get(iterator, &doc);
193 if(latency == ERR_NS){ break; }
194 latency_tot += latency;
195
196 // sum time of calls to next
197 latency = timed_fdb_iterator_next(iterator);
198 if(latency == ERR_NS){ break; }
199 latency_tot2 += latency;
200
201 fdb_doc_free(doc);
202 doc = NULL;
203 }
204

Callers 1

mainFunction · 0.85

Calls 12

setup_dbFunction · 0.85
str_genFunction · 0.85
timed_fdb_iterator_initFunction · 0.85
print_statFunction · 0.85
timed_fdb_iterator_getFunction · 0.85
timed_fdb_iterator_nextFunction · 0.85
timed_fdb_iterator_closeFunction · 0.85
timed_fdb_deleteFunction · 0.85
print_statsFunction · 0.85
timed_fdb_kvs_closeFunction · 0.85
timed_fdb_closeFunction · 0.85
timed_fdb_shutdownFunction · 0.85

Tested by

no test coverage detected