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

Function main

tests/profile/profile_flowfield.cpp:43–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43int main(int argc, char *argv[]) {
44 bool do_float = true;
45 bool do_fp = true;
46 bool json_output = false;
47
48 if (argc > 1) {
49 if (fl::strcmp(argv[1], "baseline") == 0) {
50 json_output = true;
51 } else {
52 do_float = false;
53 do_fp = false;
54 if (fl::strcmp(argv[1], "float") == 0) {
55 do_float = true;
56 } else if (fl::strcmp(argv[1], "fp") == 0) {
57 do_fp = true;
58 } else {
59 do_float = true;
60 do_fp = true;
61 }
62 }
63 }
64
65 CRGB leds[N] = {};
66 XYMap xy = XYMap::constructRectangularGrid(W, H);
67
68 u32 float_us = 0;
69 u32 fp_us = 0;
70
71 // ========================
72 // Float FlowField
73 // ========================
74 if (do_float || json_output) {
75 FlowFieldFloat fx(xy);
76
77 renderFloat(fx, leds, WARMUP_FRAMES, 0);
78
79 u32 t0 = ::micros();
80 renderFloat(fx, leds, PROFILE_FRAMES, WARMUP_FRAMES);
81 u32 t1 = ::micros();
82
83 float_us = t1 - t0;
84
85 if (json_output) {
86 ProfileResultBuilder::print_result("float", "flowfield",
87 PROFILE_FRAMES, float_us);
88 } else {
89 printf("Float FlowField: %d frames in %u us (%.1f us/frame)\n",
90 PROFILE_FRAMES, float_us,
91 static_cast<double>(float_us) / PROFILE_FRAMES);
92 }
93 }
94
95 // ========================
96 // FP FlowFieldFP
97 // ========================
98 if (do_fp || json_output) {
99 FlowFieldFP fx(xy);
100

Callers

nothing calls this directly

Calls 5

strcmpFunction · 0.85
printfFunction · 0.85
renderFPFunction · 0.85
renderFloatFunction · 0.70
microsFunction · 0.50

Tested by

no test coverage detected