Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 723 Bytes

README.md

File metadata and controls

30 lines (20 loc) · 723 Bytes

micropython-uprofile

uprofile provides a class for simple profiling of functions in micropython.

Quickstart

  1. Import the Profiler class from uprofile.
  2. Decorate the function you want to profile with the profile decorator.
  3. Run your program.
  4. Print the results.

Example:

from uprofile import Profiler            # 1.

@Profiler.profile                        # 2.
def fun1(inp1):
    return inp1**10

fun1(10)                                 # 3.

Profiler.print_results(time_unit='s')    # 4.

Profiler.results contains a dictonary, that holds a list of the execution times for each time the function ran.

NOTE
This needs micropython v1.3.3 on the pyboard.