MCPcopy Create free account
hub / github.com/apple/foundationdb / bench_encrypt

Function bench_encrypt

flowbench/BenchEncrypt.cpp:42–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42static void bench_encrypt(benchmark::State& state) {
43 auto bytes = state.range(0);
44 auto chunks = state.range(1);
45 auto chunkSize = bytes / chunks;
46 StreamCipherKey::initializeGlobalRandomTestKey();
47 auto key = StreamCipherKey::getGlobalCipherKey();
48 auto iv = getRandomIV();
49 auto data = getKey(bytes);
50 while (state.KeepRunning()) {
51 for (int chunk = 0; chunk < chunks; ++chunk) {
52 benchmark::DoNotOptimize(encrypt(key, iv, data.begin() + chunk * chunkSize, chunkSize));
53 }
54 }
55 state.SetBytesProcessed(bytes * static_cast<long>(state.iterations()));
56}
57
58static void bench_decrypt(benchmark::State& state) {
59 auto bytes = state.range(0);

Callers

nothing calls this directly

Calls 5

getRandomIVFunction · 0.85
encryptFunction · 0.85
getKeyFunction · 0.70
rangeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected