MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / UpdateVectorStatistics

Method UpdateVectorStatistics

include/vk_mem_alloc.h:12855–12874  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12853}
12854
12855void VmaDefragmentationContext_T::UpdateVectorStatistics(VmaBlockVector& vector, StateBalanced& state)
12856{
12857 size_t allocCount = 0;
12858 size_t freeCount = 0;
12859 state.avgFreeSize = 0;
12860 state.avgAllocSize = 0;
12861
12862 for (size_t i = 0; i < vector.GetBlockCount(); ++i)
12863 {
12864 VmaBlockMetadata* metadata = vector.GetBlock(i)->m_pMetadata;
12865
12866 allocCount += metadata->GetAllocationCount();
12867 freeCount += metadata->GetFreeRegionsCount();
12868 state.avgFreeSize += metadata->GetSumFreeSize();
12869 state.avgAllocSize += metadata->GetSize();
12870 }
12871
12872 state.avgAllocSize = (state.avgAllocSize - state.avgFreeSize) / allocCount;
12873 state.avgFreeSize /= freeCount;
12874}
12875
12876bool VmaDefragmentationContext_T::MoveDataToFreeBlocks(VmaSuballocationType currentType,
12877 VmaBlockVector& vector, size_t firstFreeBlock,

Callers

nothing calls this directly

Calls 6

GetBlockCountMethod · 0.80
GetBlockMethod · 0.45
GetAllocationCountMethod · 0.45
GetFreeRegionsCountMethod · 0.45
GetSumFreeSizeMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected