Skip to content

v1.5.0 - add profiling; add coroutine names

Choose a tag to compare

@bxparks bxparks released this 19 Mar 23:41
· 14 commits to master since this release
8a0666a
  • 1.5.0 (2022-03-19)
    • (Re)add support for human-readable coroutine names.
      • See Coroutine Names in the
        USER_GUIDE.md.
      • Adds the following methods to the Coroutine class: setName(),
        setName(), getCName(), getFName(), getNameType(), and
        printNameTo().
      • Resource consumption
        • Increases flash usage by 6-10 bytes per coroutine.
        • Increases static ram usage by 3 bytes (AVR) or 4 bytes (32-bit)
          per coroutine, plus the additional storage for the string itself.
    • Support profiling of Coroutine::runCoroutine() execution time.
      • See Coroutine Profiling in the
        USER_GUIDE.md.
      • API changes
        • Add CoroutineProfiler interface with a updateElapsedMicros()
          method.
        • Add Coroutine::setProfiler() to store the profiler pointer.
        • Add Coroutine::runCoroutineWithProfiler() which measures the
          elapsed time of runCoroutine() and calls
          CoroutineProfiler::updateElapsedMicros().
        • Add CoroutineScheduler::runCoroutineWithProfiler() which calls
          Coroutine::runCoroutineWithProfiler() instead of the normal
          Coroutine::runCoroutine().
        • Add CoroutineScheduler::loopWithProfiler() public static method
          which calls runCoroutineWithProfiler().
      • Provide LogBinProfiler subclass of CoroutineProfiler.
        • Keeps a frequency count of the elapsed microseconds using 32 bins
          representing the log2() function of the elapsed microseconds.
      • Provide 2 renderers of LogBinProfiler:
        • LogBinTableRenderer::printTo() prints a formatted table of the
          frequency count over all coroutines. This represents a poor-man's
          version of the log-log graph of the frequency count.
        • LogBinJsonRenderer::printTo() prints the frequency count
          in JSON format.
      • See HelloCoroutineWithProfiler
        and HelloSchedulerWithProfiler.
      • Thanks to peufeu2@ who provided the ideas and proof of concept in
        Discussion#50.
    • Coroutine consumes more static RAM
      • due to extra pointers to support setName() and setProfiler()
      • 8-bits: increases from 11 bytes to 16 bytes per coroutine
      • 32-bits: increases from 20 bytes to 28 bytes per coroutine
    • Move Coroutine::sStatusStrings to PROGMEM
      • Saves 12 bytes of static RAM on AVR and 24 bytes on ESP8266, if
        CoroutineScheduler::list() is used.