simpleperf/runtest/function_recursive.cpp
raw| 1 | constexpr int LOOP_COUNT = 5000000; |
| 2 | |
| 3 | void FunctionRecursive(int loop) { |
| 4 | for (volatile int i = 0; i < LOOP_COUNT; ++i) { |
| 5 | } |
| 6 | if (loop > 0) { |
| 7 | FunctionRecursive(loop - 1); |
| 8 | } |
| 9 | for (volatile int i = 0; i < LOOP_COUNT; ++i) { |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | int main() { |
| 14 | while (true) { |
| 15 | FunctionRecursive(10); |
| 16 | } |
| 17 | return 0; |
| 18 | } |