MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / approxSize

Method approxSize

src/common/classes/tree.h:249–266  ·  view source on GitHub ↗

Compute approximate memory consumption for tree in bytes

Source from the content-addressed store, hash-verified

247
248 // Compute approximate memory consumption for tree in bytes
249 size_t approxSize() const
250 {
251 if (!root)
252 return 0;
253
254 if (level == 0)
255 return sizeof(ItemList);
256
257 // Tree is large. Roughly estimate memory consumption using number
258 // of items in root list and depth of the tree. Approach to approximation
259 // is the same as in approxCount() routine above
260 size_t bytes_per_node = sizeof(ItemList);
261 for (int i = 1; i < level; i++)
262 bytes_per_node *= NODE_COUNT * 3 / 5;
263
264 fb_assert(bytes_per_node);
265 return root.nodes->getCount() * bytes_per_node;
266 }
267
268 void append(const BePlusTree& from)
269 {

Callers 1

isLargeMethod · 0.45

Calls 1

getCountMethod · 0.45

Tested by

no test coverage detected