| 222 | } |
| 223 | |
| 224 | static void BM_Allocation(int iters, int arg) { |
| 225 | Allocator* a = cpu_allocator(); |
| 226 | // Exercise a few different allocation sizes |
| 227 | std::vector<int> sizes = {256, 4096, 16384, 524288, 512, 1048576}; |
| 228 | int size_index = 0; |
| 229 | |
| 230 | if (arg) EnableCPUAllocatorStats(true); |
| 231 | while (--iters > 0) { |
| 232 | int bytes = sizes[size_index++ % sizes.size()]; |
| 233 | void* p = a->AllocateRaw(1, bytes); |
| 234 | a->DeallocateRaw(p); |
| 235 | } |
| 236 | if (arg) EnableCPUAllocatorStats(false); |
| 237 | } |
| 238 | BENCHMARK(BM_Allocation)->Arg(0)->Arg(1); |
| 239 | |
| 240 | } // namespace tensorflow |
nothing calls this directly
no test coverage detected