MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / run_benchmark

Function run_benchmark

crypto/secp256k1/libsecp256k1/src/bench.h:33–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33void run_benchmark(char *name, void (*benchmark)(void*), void (*setup)(void*), void (*teardown)(void*), void* data, int count, int iter) {
34 int i;
35 double min = HUGE_VAL;
36 double sum = 0.0;
37 double max = 0.0;
38 for (i = 0; i < count; i++) {
39 double begin, total;
40 if (setup != NULL) {
41 setup(data);
42 }
43 begin = gettimedouble();
44 benchmark(data);
45 total = gettimedouble() - begin;
46 if (teardown != NULL) {
47 teardown(data);
48 }
49 if (total < min) {
50 min = total;
51 }
52 if (total > max) {
53 max = total;
54 }
55 sum += total;
56 }
57 printf("%s: min ", name);
58 print_number(min * 1000000.0 / iter);
59 printf("us / avg ");
60 print_number((sum / count) * 1000000.0 / iter);
61 printf("us / max ");
62 print_number(max * 1000000.0 / iter);
63 printf("us\n");
64}
65
66#endif

Callers 6

mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 4

gettimedoubleFunction · 0.85
print_numberFunction · 0.85
setupFunction · 0.50
teardownFunction · 0.50

Tested by

no test coverage detected