> For the complete documentation index, see [llms.txt](https://infinitode-docs.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://infinitode-docs.gitbook.io/documentation/package-documentation/funcprofiler-package-documentation/funcprofiler-reference/funcprofiler-functions.md).

# FuncProfiler Functions

**Available functions:**

* [`function_profile`](#function-profile)`(export_format: Optional[str] = None, filename: Optional[str] = None, shared_log: bool = False, enabled: bool = True, log_level: Optional[str])`: Decorator factory to profile the execution time and memory usage of a function with optional data export and shared logging.
* [`line_by_line_profile`](#line-by-line-profile)`(export_format: Optional[str] = None, filename: Optional[str] = None, shared_log: bool = False, enabled: bool = True, log_level: Optional[str])`: 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.

```python
Args:
        export_format (Optional[str]): The format to export the profiling data ('txt', 'json', 'csv', 'html', 'xml', 'md').
        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.
        enabled (bool): If False, the decorator will not perform any profiling.
        log_level (str): The logging level ("info" or "debug").
        
Returns:
        Callable: The profiling wrapper or decorator function.
```

#### Available values for Function profile:

* `export_format`: `json`, `txt`, `csv`, `html`, `xml`, `md` (`str`)
* `filename`: any (`str`)
* `shared_log`: `True`/`False` (`Boolean`)
* `enabled`: `True`/`False` (`Boolean`)
* `log_level`: `info`, `debug` (`str`)

{% hint style="info" %}
All arguments are `Optional`, but the decorator should still be accompanied by `()`:

```python
@function_profile()
def someFunctionToProfile():
```

{% endhint %}

{% hint style="warning" %}
If no `()` was passed along with the decorator, you will receive a missing required positional parameter **`func`** error from Python.
{% endhint %}

### Line-by-line profile

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

```python
Args:
        export_format (Optional[str]): The format to export the profiling data ('json', 'csv', 'html', 'xml', 'md').
        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.
        enabled (bool): If False, the decorator will not perform any profiling.
        log_level (str): The logging level ("info" or "debug").
        
Returns:
        Callable: The profiling wrapper or decorator function.
```

#### Available values for Line-by-line profile:

* `export_format`: `json`, `csv`, `html`, `xml`, `md` (`str`)
* `filename`: any (`str`)
* `shared_log`: `True`/`False` (`Boolean`)
* `enabled`: `True`/`False` (`Boolean`)
* `log_level`: `info`, `debug` (`str`)

{% hint style="info" %}
All arguments are `Optional`, but the decorator should still be accompanied by `()`:

```python
@line_by_line_profile()
def someFunctionToProfile():
```

{% endhint %}

{% hint style="warning" %}
If no `()` was passed along with the decorator, you will receive a missing required positional parameter **`func`** error from Python.
{% endhint %}
