MCPcopy Create free account
hub / github.com/FastLED/FastLED / main

Function main

tests/profile/audio_detectors.cpp:33–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33int main(int argc, char *argv[]) {
34 bool do_baseline = true;
35
36 if (argc > 1) {
37 if (fl::strcmp(argv[1], "baseline") == 0) {
38 do_baseline = true;
39 } else if (fl::strcmp(argv[1], "optimized") == 0) {
40 do_baseline = false;
41 fl::printf("Error: Optimized variant not implemented yet\n");
42 return 1;
43 }
44 }
45
46 // Warmup
47 for (int i = 0; i < WARMUP_ITERATIONS / PROFILE_ITERATIONS; i++) {
48 benchmarkBaseline();
49 }
50
51 // Benchmark baseline
52 if (do_baseline) {
53 fl::u32 t0 = ::micros();
54 benchmarkBaseline();
55 fl::u32 t1 = ::micros();
56 fl::u32 elapsed_us = t1 - t0;
57 fl::i64 elapsed_ns = static_cast<fl::i64>(elapsed_us) * 1000LL;
58 double ns_per_call = static_cast<double>(elapsed_ns) / PROFILE_ITERATIONS;
59
60 // Structured output for AI parsing
61 fl::printf("PROFILE_RESULT:{\n");
62 fl::printf(" \"variant\": \"baseline\",\n");
63 fl::printf(" \"target\": \"audio_detectors\",\n");
64 fl::printf(" \"total_calls\": %d,\n", PROFILE_ITERATIONS);
65 fl::printf(" \"total_time_ns\": %lld,\n", static_cast<long long>(elapsed_ns));
66 fl::printf(" \"ns_per_call\": %.2f,\n", ns_per_call);
67 fl::printf(" \"calls_per_sec\": %.0f\n", 1e9 / ns_per_call);
68 fl::printf("}\n");
69 }
70
71 return 0;
72}

Callers

nothing calls this directly

Calls 4

strcmpFunction · 0.85
printfFunction · 0.85
benchmarkBaselineFunction · 0.70
microsFunction · 0.50

Tested by

no test coverage detected