FuncProfiler Functions

Available functions:

  • function_profile(export_format: Optional[str] = None, filename: Optional[str] = None, shared_log: bool = False): Decorator factory to profile the execution time and memory usage of a function with optional data export and shared logging.

  • line_by_line_profile(export_format: Optional[str] = None, filename: Optional[str] = None, shared_log: bool = False): Decorator for line-by-line profiling of a function with optional data export and shared logging.


Function profile

Decorator factory to profile the execution time and memory usage of a function with optional data export and shared logging.

Args:
        export_format (Optional[str]): The format to export the profiling data ('txt', 'json', 'csv', 'html').
        filename (Optional[str]): The name of the output file (without extension).
        shared_log (Optional[bool]): If True, log to a shared file for all profiled functions.

Returns:
        Callable: The profiling wrapper or decorator function.

Available values for Function profile:

  • export_format: json, txt, csv, html (str)

  • filename: any (str)

  • shared_log: True/False (Boolean)

All arguments are Optional, but the decorator should still be accompanied by ():

@function_profile()
def someFunctionToProfile():

If no () was passed along with the decorator, you will receive a missing required positional parameter func error from Python.

Line-by-line profile

Decorator for line-by-line profiling of a function with optional data export and shared logging.

Args:
        export_format (Optional[str]): The format to export the profiling data ('json', 'csv', 'html').
        filename (Optional[str]): The name of the output file (without extension).
        shared_log (Optional[bool]): If True, log to a shared file for all profiled functions.

Returns:
        Callable: The profiling wrapper or decorator function.

Available values for Line-by-line profile:

  • export_format: json, csv, html (str)

  • filename: any (str)

  • shared_log: True/False (Boolean)

All arguments are Optional, but the decorator should still be accompanied by ():

@line_by_line_profile()
def someFunctionToProfile():

If no () was passed along with the decorator, you will receive a missing required positional parameter func error from Python.

Last updated