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

Function main

tests/profile/profile_chasing_spirals.cpp:50–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50int main(int argc, char *argv[]) {
51 bool do_float = true;
52 bool do_q31 = true;
53 bool do_q31_simd = true;
54 bool json_output = false; // Profile framework JSON output mode
55
56 if (argc > 1) {
57 // Check for "baseline" argument (profile framework mode)
58 if (fl::strcmp(argv[1], "baseline") == 0) {
59 json_output = true;
60 // Run best performing variant (Q31_SIMD) for baseline measurements
61 do_float = false;
62 do_q31 = false;
63 do_q31_simd = true; // Best performance variant
64 } else {
65 // Disable all by default if specific variant requested
66 do_float = false;
67 do_q31 = false;
68 do_q31_simd = false;
69
70 if (fl::strcmp(argv[1], "float") == 0) {
71 do_float = true;
72 } else if (fl::strcmp(argv[1], "q31") == 0) {
73 do_q31 = true;
74 } else if (fl::strcmp(argv[1], "simd") == 0 || fl::strcmp(argv[1], "q31_simd") == 0) {
75 do_q31_simd = true;
76 } else {
77 // Unknown argument - enable all
78 do_float = true;
79 do_q31 = true;
80 do_q31_simd = true;
81 }
82 }
83 }
84
85 CRGB leds[N] = {};
86
87 // ========================
88 // Float (Animartrix) path
89 // ========================
90 if (do_float) {
91 XYMap xy = XYMap::constructRectangularGrid(W, H);
92 Animartrix fx(xy, CHASING_SPIRALS);
93
94 // Warmup (not profiled)
95 renderFloat(fx, leds, WARMUP_FRAMES, 0);
96
97 // Profile
98 u32 t0 = ::micros();
99 renderFloat(fx, leds, PROFILE_FRAMES, WARMUP_FRAMES);
100 u32 t1 = ::micros();
101
102 u32 elapsed_us = t1 - t0;
103 printf("Float: %d frames in %u us (%.1f us/frame)\n",
104 PROFILE_FRAMES, elapsed_us,
105 static_cast<double>(elapsed_us) / PROFILE_FRAMES);
106 }
107

Callers

nothing calls this directly

Calls 7

strcmpFunction · 0.85
printfFunction · 0.85
renderFloatFunction · 0.70
renderQ31_DirectFunction · 0.70
microsFunction · 0.50
initFunction · 0.50
mapToIndexMethod · 0.45

Tested by

no test coverage detected