|
5 | 5 | #include <sys/types.h> |
6 | 6 |
|
7 | 7 | #include <alpaka/core/Common.hpp> |
| 8 | +#include <cstdint> |
8 | 9 | #include <string> |
9 | 10 |
|
10 | 11 | #include "nlohmann/json.hpp" |
@@ -121,10 +122,8 @@ TEST_CASE("Single size malloc") { |
121 | 122 |
|
122 | 123 | namespace setups::mallocFreeManySize { |
123 | 124 |
|
124 | | - std::vector<std::uint32_t> ALLOCATION_SIZES |
125 | | - = {16U, 256U, 1024U, 16U, 16U, 256U, 16U, 1024U, 1024U}; |
126 | 125 | struct MallocFreeRecipe { |
127 | | - std::vector<std::uint32_t> sizes{ALLOCATION_SIZES}; |
| 126 | + const std::array<std::uint32_t, 9> sizes{16U, 256U, 1024U, 16U, 16U, 256U, 16U, 1024U, 1024U}; |
128 | 127 | std::uint32_t currentIndex{0U}; |
129 | 128 | void* currentPointer{nullptr}; |
130 | 129 |
|
@@ -155,29 +154,17 @@ namespace setups::mallocFreeManySize { |
155 | 154 |
|
156 | 155 | auto makeInstructionDetails() { return InstructionDetails<MallocFreeRecipe>{}; } |
157 | 156 |
|
158 | | - namespace detail { |
159 | | - template <typename T> T unique(T const& values) { |
160 | | - // It's a pity but the following are algorithms and not "adaptors", so the pipe operator |
161 | | - // doesn't work. |
162 | | - T tmp = values; |
163 | | - std::ranges::sort(tmp); |
164 | | - const auto [new_end, old_end] = std::ranges::unique(tmp); |
165 | | - return {std::begin(tmp), new_end}; |
166 | | - } |
167 | | - } // namespace detail |
168 | | - |
169 | 157 | auto composeSetup() { |
170 | 158 | return composeSetup("mallocFreeManySize", makeExecutionDetails(), makeInstructionDetails(), |
171 | 159 | {{"what it does", |
172 | 160 | "This setup runs through a given vector of allocation sizes, allocating " |
173 | 161 | "and deallocating each size one after another."}, |
174 | | - {"number of allocations", ALLOCATION_SIZES.size()}, |
175 | | - {"available allocation sizes [bytes]", detail::unique(ALLOCATION_SIZES)}}); |
| 162 | + {"number of allocations", MallocFreeRecipe{}.sizes.size()}}); |
176 | 163 | } |
177 | 164 |
|
178 | 165 | } // namespace setups::mallocFreeManySize |
179 | 166 |
|
180 | 167 | TEST_CASE("Malloc free many size") { |
181 | 168 | auto setup = setups::mallocFreeManySize::composeSetup(); |
182 | | - auto benchmarkReports = runBenchmarks(setup); |
| 169 | + auto benchmarkReports = kitgenbench::runBenchmarks(setup); |
183 | 170 | } |
0 commit comments