| 77 | } // namespace |
| 78 | |
| 79 | float TuningResolver::EvalRatio() { |
| 80 | // With the current settings, 400 iterations and 4 repeats, this test has |
| 81 | // a latency of roughly 80 microseconds on a Cortex-A53 at 1.4 GHz. |
| 82 | static constexpr int kLoopIters = 400; |
| 83 | static constexpr int kRepeats = 4; |
| 84 | |
| 85 | Duration timing_poorly_ordered = Duration::max(); |
| 86 | Duration timing_nicely_ordered = Duration::max(); |
| 87 | |
| 88 | for (int r = 0; r < kRepeats; r++) { |
| 89 | TimePoint t0 = Now(); |
| 90 | PoorlyOrderedKernel(kLoopIters); |
| 91 | TimePoint t1 = Now(); |
| 92 | NicelyOrderedKernel(kLoopIters); |
| 93 | TimePoint t2 = Now(); |
| 94 | timing_poorly_ordered = std::min(timing_poorly_ordered, t1 - t0); |
| 95 | timing_nicely_ordered = std::min(timing_nicely_ordered, t2 - t1); |
| 96 | } |
| 97 | |
| 98 | return ToFloatSeconds(timing_nicely_ordered) / |
| 99 | ToFloatSeconds(timing_poorly_ordered); |
| 100 | } |
| 101 | |
| 102 | float TuningResolver::ThresholdRatio() { |
| 103 | // Empirically (see :tune_tool) determined threshold to distinguish in-order |
no test coverage detected