Bitcoin Core  27.99.0
P2P Digital Currency
Classes | Static Public Member Functions | List of all members
PoolResourceTester Class Reference

Helper to get access to private parts of PoolResource. More...

#include <poolresourcetester.h>

Classes

struct  PtrAndBytes
 

Static Public Member Functions

template<std::size_t MAX_BLOCK_SIZE_BYTES, std::size_t ALIGN_BYTES>
static std::vector< std::size_t > FreeListSizes (const PoolResource< MAX_BLOCK_SIZE_BYTES, ALIGN_BYTES > &resource)
 Extracts the number of elements per freelist. More...
 
template<std::size_t MAX_BLOCK_SIZE_BYTES, std::size_t ALIGN_BYTES>
static std::size_t AvailableMemoryFromChunk (const PoolResource< MAX_BLOCK_SIZE_BYTES, ALIGN_BYTES > &resource)
 How many bytes are still available from the last allocated chunk. More...
 
template<std::size_t MAX_BLOCK_SIZE_BYTES, std::size_t ALIGN_BYTES>
static void CheckAllDataAccountedFor (const PoolResource< MAX_BLOCK_SIZE_BYTES, ALIGN_BYTES > &resource)
 Once all blocks are given back to the resource, tests that the freelists are consistent: More...
 

Detailed Description

Helper to get access to private parts of PoolResource.

Used in unit tests and in the fuzzer

Definition at line 19 of file poolresourcetester.h.

Member Function Documentation

◆ AvailableMemoryFromChunk()

template<std::size_t MAX_BLOCK_SIZE_BYTES, std::size_t ALIGN_BYTES>
static std::size_t PoolResourceTester::AvailableMemoryFromChunk ( const PoolResource< MAX_BLOCK_SIZE_BYTES, ALIGN_BYTES > &  resource)
inlinestatic

How many bytes are still available from the last allocated chunk.

Definition at line 62 of file poolresourcetester.h.

Here is the caller graph for this function:

◆ CheckAllDataAccountedFor()

template<std::size_t MAX_BLOCK_SIZE_BYTES, std::size_t ALIGN_BYTES>
static void PoolResourceTester::CheckAllDataAccountedFor ( const PoolResource< MAX_BLOCK_SIZE_BYTES, ALIGN_BYTES > &  resource)
inlinestatic

Once all blocks are given back to the resource, tests that the freelists are consistent:

  • All data in the freelists must come from the chunks
  • Memory doesn't overlap
  • Each byte in the chunks can be accounted for in either the freelist or as available bytes.

Definition at line 75 of file poolresourcetester.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FreeListSizes()

template<std::size_t MAX_BLOCK_SIZE_BYTES, std::size_t ALIGN_BYTES>
static std::vector<std::size_t> PoolResourceTester::FreeListSizes ( const PoolResource< MAX_BLOCK_SIZE_BYTES, ALIGN_BYTES > &  resource)
inlinestatic

Extracts the number of elements per freelist.

Definition at line 44 of file poolresourcetester.h.

Here is the caller graph for this function:

The documentation for this class was generated from the following file: