MCPcopy Create free account
hub / github.com/couchbase/fleece / dump

Method dump

Fleece/Support/StringTable.cc:227–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225
226
227 void StringTable::dump() const noexcept {
228 ssize_t totalDistance = 0;
229 std::vector<size_t> distanceCounts(_maxDistance+1);
230 for (size_t i = 0; i < _size; ++i) {
231 printf("%4zd: ", i);
232 if (_hashes[i] != hash_t::Empty) {
233 key_t key = _entries[i].first;
234 size_t index = indexOfHash(hashCode(key));
235 ssize_t distance = (i - (int)index + _size) & _sizeMask;
236 totalDistance += distance;
237 ++distanceCounts[distance];
238 printf("(%2zd) '%.*s'\n", distance, FMTSLICE(key));
239 } else {
240 printf("--\n");
241 }
242 }
243 printf(">> Capacity %zd, using %zu (%.0f%%)\n",
244 _size, _count, _count/(double)_size*100.0);
245 printf(">> Average key distance = %.2f, max = %zd\n",
246 totalDistance/(double)count(), _maxDistance);
247 for (size_t i = 0; i <= _maxDistance; ++i)
248 printf("\t%2zd: %zd\n", i, distanceCounts[i]);
249 }
250
251}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected