Precise busy wait function - waits for specified nanoseconds
| 69 | |
| 70 | // Precise busy wait function - waits for specified nanoseconds |
| 71 | void busy_wait_ns(int64_t nanoseconds) |
| 72 | { |
| 73 | auto start = std::chrono::high_resolution_clock::now(); |
| 74 | auto target_duration = std::chrono::nanoseconds(nanoseconds); |
| 75 | |
| 76 | while (true) |
| 77 | { |
| 78 | auto now = std::chrono::high_resolution_clock::now(); |
| 79 | auto elapsed = now - start; |
| 80 | if (elapsed >= target_duration) |
| 81 | { |
| 82 | break; |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | // Benchmark functions with predictable timing |
| 88 | void leaf_function(int depth) |
no outgoing calls
no test coverage detected