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

Function main

tests/profile/sincos32.cpp:38–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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