MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / BM_Allocation

Function BM_Allocation

tensorflow/core/framework/allocator_test.cc:224–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

222}
223
224static 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}
238BENCHMARK(BM_Allocation)->Arg(0)->Arg(1);
239
240} // namespace tensorflow

Callers

nothing calls this directly

Calls 5

cpu_allocatorFunction · 0.85
EnableCPUAllocatorStatsFunction · 0.85
sizeMethod · 0.45
AllocateRawMethod · 0.45
DeallocateRawMethod · 0.45

Tested by

no test coverage detected