simpleperf/runtest/two_functions.cpp
raw| 1 | #include <stdlib.h> |
| 2 | |
| 3 | constexpr int LOOP_COUNT = 100000000; |
| 4 | |
| 5 | volatile int a[2]; |
| 6 | void Function1() { |
| 7 | volatile int* p = a + atoi("0"); |
| 8 | for (int i = 0; i < LOOP_COUNT; ++i) { |
| 9 | *p = i; |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | void Function2() { |
| 14 | volatile int* p = a + atoi("1"); |
| 15 | for (int i = 0; i < LOOP_COUNT; ++i) { |
| 16 | *p = i; |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | int main() { |
| 21 | while (true) { |
| 22 | Function1(); |
| 23 | Function2(); |
| 24 | } |
| 25 | return 0; |
| 26 | } |