Universal microsecond timer - returns microseconds since system startup.
This function provides consistent high-resolution timing across all FastLED platforms:
- Arduino/AVR: Hardware timer-based micros()
- ESP32/ESP8266: ESP-IDF timing functions
- ARM: Platform-specific ARM timers
- WASM: JavaScript-based timing with microsecond precision
- Native/Testing: std::chrono implementation
- Stub: Fake timer for testing
- Returns
- Number of microseconds since the system started
- Note
- Wraps around approximately every 71.6 minutes (2^32 microseconds)
-
This function is designed to be zero-overhead - it compiles to a direct platform call in optimized builds
Behavior
- Consistent: All platforms return microseconds since startup/initialization
- Monotonic: Time always increases (except on wraparound)
- Resolution: 1 microsecond resolution on all platforms (platform-dependent precision)
- Wraparound: Consistent wraparound behavior at 2^32 microseconds
Examples
fast_operation();
}
fl::u32 micros() FL_NO_EXCEPT
Universal microsecond timer - returns microseconds since system startup.
Definition at line 92 of file chrono.cpp.hpp.
92 {
93#if FL_CHRONO_HAS_TEST_TIME_PROVIDER
94 fl::u32 injected_millis = 0;
95 if (get_injected_millis(&injected_millis)) {
96 return injected_millis * 1000u;
97 }
98#endif
99
100 return fl::platforms::micros();
101}
References FL_NO_EXCEPT.
Referenced by autoresearch::simd_check::benchFloat4(), autoresearch::simd_check::benchS16x16_4(), autoresearch::simd_check::benchS8x8_4(), autoresearch::simd_check::benchSimd4(), autoresearch::simd_check::benchU16x16_4(), fl::Yves::draw(), fl::Yves_FP::draw(), get_ready(), logFrame(), logOutput(), CMinWait< WAIT >::mark(), micros64(), fl::task::run(), fl::wave_perf::runWavePerf(), fl::wave_perf::runWavePerfLoadsOnly(), fl::wave_perf::runWavePerfRepeat(), CFastLED::show(), CFastLED::showColor(), throttleToMaxRefreshRate(), CMinWait< WAIT >::wait(), fl::ChannelManager::waitForCondition(), fl::IChannelDriver::waitForCondition(), and fl::task::yield_system().