]> git.siccegge.de Git - software/DIPE.git/blob - benchmark/benchPBC.cpp
benchmarks\~
[software/DIPE.git] / benchmark / benchPBC.cpp
1 #include <benchmark/benchmark.h>
2 #include <pbc/pbc.h>
3
4 void pbc_multiply_elements(benchmark::State& state) {
5 pairing_t pairing;
6 FILE *fp;
7
8 fp = fopen("../tests/a.param", "r");
9 if (fp == NULL) {
10 perror("Reading Pairing Parameters");
11 return;
12 }
13 char buffer[2<<16];
14 size_t count = fread(buffer, 1, 2<<16, fp);
15 pairing_init_set_buf(pairing, buffer, 2<<16);
16
17 element_t a, b, c;
18 element_init_G1(a, pairing);
19 element_init_G1(b, pairing);
20 element_init_G1(c, pairing);
21
22 element_random(a);
23 element_random(b);
24 for (auto _ : state) {
25 element_mul(c, a, b);
26 }
27 }
28
29
30
31
32
33 BENCHMARK(pbc_multiply_elements);
34
35 BENCHMARK_MAIN();