| 62 | } |
| 63 | |
| 64 | int main(int argc, char *argv[]) { |
| 65 | bool json_output = (argc > 1 && fl::strcmp(argv[1], "baseline") == 0); |
| 66 | |
| 67 | init_test_data(); |
| 68 | |
| 69 | // Warmup |
| 70 | benchmark_baseline(WARMUP_CALLS); |
| 71 | |
| 72 | // Benchmark |
| 73 | u32 t0 = ::micros(); |
| 74 | benchmark_baseline(PROFILE_ITERATIONS); |
| 75 | u32 t1 = ::micros(); |
| 76 | u32 elapsed_us = t1 - t0; |
| 77 | |
| 78 | // Total pixel operations = iterations * NUM_LEDS |
| 79 | int total_pixel_ops = PROFILE_ITERATIONS * NUM_LEDS; |
| 80 | |
| 81 | if (json_output) { |
| 82 | ProfileResultBuilder::print_result("baseline", "five_bit_hd_gamma", |
| 83 | total_pixel_ops, elapsed_us); |
| 84 | } else { |
| 85 | i64 elapsed_ns = static_cast<i64>(elapsed_us) * 1000LL; |
| 86 | double ns_per_pixel = |
| 87 | static_cast<double>(elapsed_ns) / total_pixel_ops; |
| 88 | |
| 89 | fl::printf("\n=== five_bit_hd_gamma Performance ===\n\n"); |
| 90 | fl::printf("Config: %d LEDs x %d iterations = %d pixel ops\n", |
| 91 | NUM_LEDS, PROFILE_ITERATIONS, total_pixel_ops); |
| 92 | fl::printf("Time: %lu us\n", |
| 93 | static_cast<unsigned long>(elapsed_us)); |
| 94 | fl::printf("Per pixel: %.2f ns\n", ns_per_pixel); |
| 95 | fl::printf("Throughput: %.2f Mpixels/sec\n", |
| 96 | total_pixel_ops / static_cast<double>(elapsed_us)); |
| 97 | fl::printf("=====================================\n"); |
| 98 | } |
| 99 | |
| 100 | return 0; |
| 101 | } |
nothing calls this directly
no test coverage detected