Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-04 05:19:05

0001 #include <benchmark/benchmark.h>
0002 #include <cstring>
0003 static void BM_memcpy(benchmark::State& state) {
0004   char* src = new char[state.range(0)];
0005   char* dst = new char[state.range(0)];
0006   memset(src, 'x', state.range(0));
0007   for (auto _ : state)
0008     memcpy(dst, src, state.range(0));
0009   state.SetBytesProcessed(int64_t(state.iterations()) * int64_t(state.range(0)));
0010   delete[] src;
0011   delete[] dst;
0012 }
0013 BENCHMARK(BM_memcpy)->Arg(8)->Arg(64)->Arg(512)->Arg(1 << 10)->Arg(8 << 10);