| 1 |
|
| 2 | #include <stdlib.h>
|
| 3 | #include "../tests.h"
|
| 4 |
|
| 5 | #define BENCH_RUNS 999999
|
| 6 |
|
| 7 | static volatile int cnt;
|
| 8 |
|
| 9 | static void brstack_bar(void) {
|
| 10 | }
|
| 11 |
|
| 12 | static void brstack_foo(void) {
|
| 13 | brstack_bar();
|
| 14 | }
|
| 15 |
|
| 16 | static void brstack_bench(void) {
|
| 17 | void (*brstack_foo_ind)(void) = brstack_foo;
|
| 18 |
|
| 19 | if ((cnt++) % 3)
|
| 20 | brstack_foo();
|
| 21 | brstack_bar();
|
| 22 | brstack_foo_ind();
|
| 23 | }
|
| 24 |
|
| 25 | static int brstack(int argc, const char **argv)
|
| 26 | {
|
| 27 | int num_loops = BENCH_RUNS;
|
| 28 |
|
| 29 | if (argc > 0)
|
| 30 | num_loops = atoi(argv[0]);
|
| 31 |
|
| 32 | while (1) {
|
| 33 | if ((cnt++) > num_loops)
|
| 34 | break;
|
| 35 | brstack_bench();
|
| 36 | }
|
| 37 | return 0;
|
| 38 | }
|
| 39 |
|
| 40 | DEFINE_WORKLOAD(brstack);
|