picogl.ui.profiling_decorator

function profiler

Functions

function_profiler([_func, sortby, top_n])

A decorator to profile function performance. Can be used with or without arguments.

Module Contents

picogl.ui.profiling_decorator.function_profiler(_func: Callable | None = None, *, sortby: str = 'cumtime', top_n: int = 50)[source]

A decorator to profile function performance. Can be used with or without arguments.

Usage:

@function_profiler def my_func(): …

@function_profiler(sortby=’tottime’, top_n=25) def another_func(): …

Parameters:
  • _func – Internal placeholder for decorator usage without parameters.

  • sortby – str - Sorting key for profiling (‘cumtime’, ‘tottime’, etc).

  • top_n – int - Number of top functions to show in profile output.