Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:59

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()) *
0010                           int64_t(state.range(0)));
0011   delete[] src;
0012   delete[] dst;
0013 }
0014 BENCHMARK(BM_memcpy)->Arg(8)->Arg(64)->Arg(512)->Arg(1<<10)->Arg(8<<10);