Memory Usage#
The pydecorium.decorators.Memory
decorator is used to measure the runtime of a function.
Memory
is a sub-class of the class pydecorium.ProfilerUtils
and can be use for the pydecorium.decorators.FunctionProfiler
decorator.
In this example, we will only show how to use the Memory
decorator as a standalone decorator.
The usage of the Memory
decorator into the FunctionProfiler
decorator is described in the documentation FunctionProfiler Usage.
First we need to import the Memory
decorator with the following command:
from pydecorium.decorators import Memory
Then we can use the Memory
as describe in the documentation How to use a decorator.
memory = Memory(activated=True, signature_name_format='{name}')
@memory
def example_function():
return [i for i in range(1000000)]
bigdata = example_function()
The output will be:
example_function - memory usage : 38MB 308KB 0B