| 5077 | } |
| 5078 | |
| 5079 | static void BenchmarkAlgorithms(FILE* file) |
| 5080 | { |
| 5081 | wprintf(L"Benchmark algorithms\n"); |
| 5082 | |
| 5083 | if(file) |
| 5084 | { |
| 5085 | fprintf(file, |
| 5086 | "Code,Time," |
| 5087 | "Algorithm,Empty,Allocation strategy,Free order," |
| 5088 | "Allocation time (s),Deallocation time (s)\n"); |
| 5089 | } |
| 5090 | |
| 5091 | uint32_t freeOrderCount = 1; |
| 5092 | if(ConfigType >= CONFIG_TYPE::CONFIG_TYPE_LARGE) |
| 5093 | freeOrderCount = 3; |
| 5094 | else if(ConfigType >= CONFIG_TYPE::CONFIG_TYPE_SMALL) |
| 5095 | freeOrderCount = 2; |
| 5096 | |
| 5097 | const uint32_t emptyCount = ConfigType >= CONFIG_TYPE::CONFIG_TYPE_SMALL ? 2 : 1; |
| 5098 | const uint32_t allocStrategyCount = GetAllocationStrategyCount(); |
| 5099 | |
| 5100 | for(uint32_t freeOrderIndex = 0; freeOrderIndex < freeOrderCount; ++freeOrderIndex) |
| 5101 | { |
| 5102 | FREE_ORDER freeOrder = FREE_ORDER::COUNT; |
| 5103 | switch(freeOrderIndex) |
| 5104 | { |
| 5105 | case 0: freeOrder = FREE_ORDER::BACKWARD; break; |
| 5106 | case 1: freeOrder = FREE_ORDER::FORWARD; break; |
| 5107 | case 2: freeOrder = FREE_ORDER::RANDOM; break; |
| 5108 | default: assert(0); |
| 5109 | } |
| 5110 | |
| 5111 | for(uint32_t emptyIndex = 0; emptyIndex < emptyCount; ++emptyIndex) |
| 5112 | { |
| 5113 | for(uint32_t algorithmIndex = 0; algorithmIndex < 2; ++algorithmIndex) |
| 5114 | { |
| 5115 | uint32_t algorithm = 0; |
| 5116 | switch(algorithmIndex) |
| 5117 | { |
| 5118 | case 0: |
| 5119 | break; |
| 5120 | case 1: |
| 5121 | algorithm = VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT; |
| 5122 | break; |
| 5123 | default: |
| 5124 | assert(0); |
| 5125 | } |
| 5126 | |
| 5127 | uint32_t currAllocStrategyCount = algorithm != 0 ? 1 : allocStrategyCount; |
| 5128 | for(uint32_t allocStrategyIndex = 0; allocStrategyIndex < currAllocStrategyCount; ++allocStrategyIndex) |
| 5129 | { |
| 5130 | VmaAllocatorCreateFlags strategy = 0; |
| 5131 | if(currAllocStrategyCount > 1) |
| 5132 | { |
| 5133 | switch(allocStrategyIndex) |
| 5134 | { |
| 5135 | case 0: strategy = VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT; break; |
| 5136 | case 1: strategy = VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT; break; |
no test coverage detected